|
16 | 16 | #include <EEPROM.h> |
17 | 17 | #include "SpdReaderWriterSettings.h" // Settings |
18 | 18 |
|
19 | | -#define VERSION 20211201 // Version number (YYYYMMDD) |
| 19 | +#define VERSION 20211202 // Version number (YYYYMMDD) |
20 | 20 |
|
21 | 21 | // RSWP RAM support bitmasks |
22 | 22 | #define DDR5 (1 << 5) // Offline mode control |
@@ -675,9 +675,16 @@ bool getRswp(uint8_t block) { |
675 | 675 | byte commands[] = { RPS0, RPS1, RPS2, RPS3 }; |
676 | 676 | byte cmd = (block > 0 || block <= 3) ? commands[block] : commands[0]; |
677 | 677 |
|
678 | | - setHighVoltage(OFF); |
| 678 | + // Jedec EE1002(A), TSE2002av compliance |
| 679 | + if (block == 0 && !ddr4Detect()) { |
| 680 | + setHighVoltage(ON); |
| 681 | + } |
| 682 | + |
| 683 | + bool status = probeDeviceTypeId(cmd); |
679 | 684 |
|
680 | | - return probeDeviceTypeId(cmd); // true = unprotected; false = protected or rswp not supported |
| 685 | + resetPins(); |
| 686 | + |
| 687 | + return status; // true = unprotected; false = protected or rswp not supported |
681 | 688 | } |
682 | 689 |
|
683 | 690 | // Clears reversible software write protection |
@@ -1037,18 +1044,18 @@ bool probeDeviceTypeId(uint8_t deviceSelectCode) { |
1037 | 1044 | return Wire.requestFrom(cmd, (uint8_t)1) > 0; // true when ACK is received after control byte |
1038 | 1045 | } |
1039 | 1046 |
|
1040 | | -// DDR4 detection test |
| 1047 | +// DDR4 detection test (address) |
1041 | 1048 | bool ddr4Detect(uint8_t address) { |
| 1049 | + return probeBusAddress(address) && ddr4Detect(); |
| 1050 | +} |
1042 | 1051 |
|
1043 | | - if (!probeBusAddress(address) || !scanBus()) { |
1044 | | - return false; |
1045 | | - } |
1046 | | - |
| 1052 | +// DDR4 detection test (generic) |
| 1053 | +bool ddr4Detect() { |
1047 | 1054 | return ((setPageAddress(0) ^ getPageAddress(true)) != |
1048 | 1055 | (setPageAddress(1) ^ getPageAddress(true))); |
1049 | 1056 | } |
1050 | 1057 |
|
1051 | | -// DDR5 detetion |
| 1058 | +// DDR5 detection test |
1052 | 1059 | bool ddr5Detect(uint8_t address) { |
1053 | 1060 |
|
1054 | 1061 | if (!probeBusAddress(address) || !scanBus()) { |
|
0 commit comments