44 #if defined(MONETA_DEVICE) 71 uint8_t MID[8] = {0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x43};
74 for(uint32_t a = 0; a < 100; a++)
76 dataWrite[a] = (uint8_t) 0xA+a;
83 printf(
"\n\nTesting Read MID, WEnable, and WDisable ----------\n\n");
92 printf(
"ReadMID Success.\n");
96 printf(
"ReadMID fail.\n");
107 if(!((dataRead[0] >> 1) & 1))
109 printf(
"Error with WE or Read SR\n");
114 printf(
"WE success.\n");
126 printf(
"\n\nTesting read and write -----------------------------\n\n");
141 printf(
"Program and read operations successful.\n");
145 printf(
"Program and read operations fail.\n");
153 printf(
"\n\nTesting UDPD Mode and JEDEC Reset --------------------\n\n");
163 printf(
"DEVICE IS IN UDPD MODE. DATA MISMATCH EXPECTED. TEST PASSED.\n");
167 printf(
"DEVICE FAILED UDPD TEST. The device is reading stored data when the line should be in Hi-Z state.\n");
174 printf(
"JEDEC reset performed, device should be operational.\n");
179 printf(
"JEDEC reset operation success.\n");
183 printf(
"JEDEC reset operation fail.\n");
188 printf(
"\n\n#############################################\n\n");
189 printf(
"Testing complete.\n");
190 printf(
"Total errors detected: %d\n", errorCount);
191 printf(
"Terminating testbench...\n");
192 printf(
"\n#############################################\n\n");
196 #elif defined(FUSION_DEVICE) 200 uint32_t fusionTest()
214 uint32_t errorCount = 0;
221 #if PARTNO == AT25XE512C 223 uint8_t MID[4] = {0x1F, 0x65, 0x01, 0x00};
224 #elif PARTNO == AT25XE011 226 uint8_t MID[4] = {0x1F, 0x42, 0x00, 0x00};
227 #elif PARTNO == AT25XE021A 229 uint8_t MID[4] = {0x1F, 0x43, 0x01, 0x00};
230 #elif PARTNO == AT25XE041B 232 uint8_t MID[4] = {0x1F, 0x44, 0x02, 0x00};
233 #elif PARTNO == AT25DN256 235 uint8_t MID[4] = {0x1F, 0x40, 0x00, 0x00};
236 #elif PARTNO == AT25DN512C 238 uint8_t MID[4] = {0x1F, 0x65, 0x01, 0x00};
239 #elif PARTNO == AT25DN011 241 uint8_t MID[4] = {0x1F, 0x42, 0x00, 0x00};
242 #elif PARTNO == AT25DF256 244 uint8_t MID[4] = {0x1F, 0x40, 0x00, 0x00};
245 #elif PARTNO == AT25DF512C 247 uint8_t MID[4] = {0x1F, 0x64, 0x01, 0x00};
248 #elif PARTNO == AT25DF011 250 uint8_t MID[4] = {0x1F, 0x42, 0x00, 0x00};
251 #elif PARTNO == AT25DF021A 253 uint8_t MID[4] = {0x1F, 0x43, 0x01, 0x00};
254 #elif PARTNO == AT25DF041B 256 uint8_t MID[4] = {0x1F, 0x44, 0x02, 0x00};
257 #elif PARTNO == AT25XV021A 259 uint8_t MID[4] = {0x1F, 0x43, 0x01, 0x00};
260 #elif PARTNO == AT25XV041B 262 uint8_t MID[4] = {0x1F, 0x44, 0x02, 0x00};
266 for(uint32_t a = 0; a < 100; a++)
268 dataWrite[a] = (uint8_t) 0xA+a;
275 printf(
"\n\nTesting Read MID, WEnable, and WDisable ----------\n\n");
284 printf(
"ReadMID Success.\n");
288 printf(
"ReadMID fail.\n");
300 if(!((dataRead[0] >> 1) & 1))
302 printf(
"Error with WE or Read SR");
307 printf(
"WE success.\n");
318 if(((dataRead[0] >> 1) & 1))
320 printf(
"Error with WD or Read SR");
325 printf(
"WD success.\n");
328 #if (PARTNO == AT25XE021A) || \ 329 (PARTNO == AT25XE041B) || \ 330 (PARTNO == AT25DF021A) || \ 331 (PARTNO == AT25DF041B) || \ 332 (PARTNO == AT25XV021A) || \ 333 (PARTNO == AT25XV041B) || \ 340 printf(
"\n\nTesting Un/protect Sector ------------------------\n\n");
347 if(dataRead[0] != 0xFF)
349 printf(
"Error with protection SR of sector 0");
354 printf(
"Protect success.\n");
366 if(dataRead[0] != 0x00)
368 printf(
"Error unprotecting sector 0");
373 printf(
"Unprotect success.\n");
380 printf(
"\n\nTesting Erase ------------------------------------\n\n");
394 printf(
"PageErase success.\n");
398 printf(
"PageErase fail.\n");
402 #if (PARTNO == AT25XE021A) || \ 403 (PARTNO == AT25XE041B) || \ 404 (PARTNO == AT25DF021A) || \ 405 (PARTNO == AT25DF041B) || \ 406 (PARTNO == AT25XV021A) || \ 407 (PARTNO == AT25XV041B) || \ 413 printf(
"\n\nTesting Sequential Program Mode -------------------\n\n");
425 for(
int j = 1; j < 50; j++)
427 dataTest[j] = (uint8_t) j;
445 printf(
"Sequential operation success.\n");
449 printf(
"Sequential operation fail.\n");
454 if(dataRead[0x50] != 0xFF)
456 printf(
"Error, data programmed when write disabled.");
464 printf(
"\n\nTesting Dual Read/Write Mode -------------------------\n\n");
488 printf(
"Dual input program operation success.\n");
492 printf(
"Dual input program operation fail.\n");
502 printf(
"Dual output read operation success.\n");
506 printf(
"Dual output read operation fail.\n");
514 printf(
"\n\nTesting Deep Power Down functionality -----------------\n\n");
527 printf(
"DEVICE IS IN DPD MODE. DATA MISMATCH EXPECTED. TEST PASSED.\n");
531 printf(
"DEVICE FAILED DPD TEST. The device is reading stored data when the line should be in Hi-Z state.\n");
536 printf(
"Resuming from Deep Power Down Mode...\n");
545 printf(
"Resume from DPD operation success.\n");
549 printf(
"Resume from DPD operation fail.\n");
553 #if (PARTNO == AT25XE021A) || \ 554 (PARTNO == AT25XE041B) || \ 555 (PARTNO == AT25DF021A) || \ 556 (PARTNO == AT25DF041B) || \ 557 (PARTNO == AT25XV021A) || \ 558 (PARTNO == AT25XV041B) || \ 564 printf(
"\n\nTesting Global Un/Protect -----------------------------\n\n");
574 if(dataRead[0] != 0x00)
576 printf(
"Error with sector 0 protection");
586 if(dataRead[0] != 0xFF)
588 printf(
"Error with global protect");
593 printf(
"Global protect success.\n");
602 if(dataRead[0] != 0x00)
604 printf(
"Error with global unprotect");
609 printf(
"Global unprotect success.\n");
616 printf(
"\n\nTesting UDPD Mode and JEDEC Reset --------------------\n\n");
628 printf(
"DEVICE IS IN UDPD MODE. DATA MISMATCH EXPECTED. TEST PASSED.\n");
632 printf(
"DEVICE FAILED UDPD TEST. The device is reading stored data when the line should be in Hi-Z state.\n");
639 printf(
"JEDEC reset performed, device should be operational.\n");
644 printf(
"JEDEC reset operation success.\n");
648 printf(
"JEDEC reset operation fail.\n");
653 printf(
"\n\n#############################################\n\n");
654 printf(
"Testing complete.\n");
655 printf(
"Total errors detected: %d\n", errorCount);
656 printf(
"Terminating testbench...\n");
657 printf(
"\n#############################################\n\n");
662 #elif defined(DATAFLASH_DEVICE) 666 uint32_t dataflashTest()
680 uint32_t errorCount = 0;
682 #if PARTNO == AT45DB021E 684 uint8_t MID[5] = {0x1F, 0x23, 0x00, 0x01, 0x00};
685 #elif PARTNO == AT45DB041E 687 uint8_t MID[5] = {0x1F, 0x24, 0x00, 0x01, 0x00};
688 #elif PARTNO == AT45DB081E 690 uint8_t MID[5] = {0x1F, 0x25, 0x00, 0x01, 0x00};
691 #elif PARTNO == AT45DB161E 693 uint8_t MID[5] = {0x1F, 0x26, 0x00, 0x01, 0x00};
694 #elif PARTNO == AT45DB321E 696 uint8_t MID[5] = {0x1F, 0x27, 0x01, 0x01, 0x00};
697 #elif PARTNO == AT45DB641E 699 uint8_t MID[5] = {0x1F, 0x28, 0x00, 0x01, 0x00};
700 #elif PARTNO == AT45DQ161 702 uint8_t MID[5] = {0x1F, 0x26, 0x00, 0x01, 0x00};
703 #elif PARTNO == AT45DQ321 705 uint8_t MID[5] = {0x1F, 0x27, 0x01, 0x01, 0x00};
706 #elif PARTNO == AT25PE20 708 uint8_t MID[5] = {0x1F, 0x23, 0x00, 0x01, 0x00};
709 #elif PARTNO == AT25PE40 711 uint8_t MID[5] = {0x1F, 0x24, 0x00, 0x01, 0x00};
712 #elif PARTNO == AT25PE80 714 uint8_t MID[5] = {0x1F, 0x25, 0x00, 0x01, 0x00};
715 #elif PARTNO == AT25PE16 717 uint8_t MID[5] = {0x1F, 0x26, 0x00, 0x01, 0x00};
731 printf(
"\n\nTesting Read MID -----------------------------------\n\n");
740 printf(
"ReadMID Success.\n");
744 printf(
"ReadMID fail.\n");
760 printf(
"\n\nTesting Read and Write functionality ---------------\n\n");
770 printf(
"Buffer 1 Write or ReadLF failure.\n");
775 printf(
"Buffer 1 Write and ReadLF success.\n");
780 printf(
"Buffer 1 Write or ReadHF failure.\n");
785 printf(
"Buffer 1 Write and ReadHF success.\n");
797 printf(
"Main memory through Buffer 1 r/w failure.\n");
802 printf(
"Main memory through Buffer 1 r/w success.\n");
805 #if (PARTNO == AT45DB021E) || \ 806 (PARTNO == AT45DB041E) || \ 807 (PARTNO == AT45DB081E) || \ 808 (PARTNO == AT45DB161E) || \ 809 (PARTNO == AT45DB321E) || \ 810 (PARTNO == AT45DB641E) || \ 811 (PARTNO == AT45DQ161) || \ 812 (PARTNO == AT45DQ321) || \ 813 (PARTNO == AT25PE40) || \ 814 (PARTNO == AT25PE80) || \ 815 (PARTNO == AT25PE16) || \ 826 printf(
"Buffer 2 Write or ReadLF failure.\n");
831 printf(
"Buffer 2 Write and ReadLF success.\n");
836 printf(
"Buffer 2 Write or ReadHF failure.\n");
841 printf(
"Buffer 2 Write and ReadHF success.\n");
854 printf(
"Main memory through Buffer 2 r/w failure.\n");
859 printf(
"Main memory through Buffer 2 r/w success.\n");
877 printf(
"Buffer 1 to main memory failure.\n");
882 printf(
"Buffer 1 to main memory success.\n");
885 #if (PARTNO == AT45DB021E) || \ 886 (PARTNO == AT45DB041E) || \ 887 (PARTNO == AT45DB081E) || \ 888 (PARTNO == AT45DB161E) || \ 889 (PARTNO == AT45DB321E) || \ 890 (PARTNO == AT45DB641E) || \ 891 (PARTNO == AT45DQ161) || \ 892 (PARTNO == AT45DQ321) || \ 893 (PARTNO == AT25PE40) || \ 894 (PARTNO == AT25PE80) || \ 895 (PARTNO == AT25PE16) || \ 908 printf(
"Buffer 2 to main memory failure.\n");
913 printf(
"Buffer 2 to main memory success.\n");
924 printf(
"Program through Buffer 1 failure.\n");
929 printf(
"Program through Buffer 1 success.\n");
931 #if (PARTNO == AT45DB021E) || \ 932 (PARTNO == AT45DB041E) || \ 933 (PARTNO == AT45DB081E) || \ 934 (PARTNO == AT45DB161E) || \ 935 (PARTNO == AT45DB321E) || \ 936 (PARTNO == AT45DB641E) || \ 937 (PARTNO == AT45DQ161) || \ 938 (PARTNO == AT45DQ321) || \ 939 (PARTNO == AT25PE40) || \ 940 (PARTNO == AT25PE80) || \ 941 (PARTNO == AT25PE16) || \ 950 printf(
"Program through Buffer 2 failure.\n");
955 printf(
"Program through Buffer 2 success.\n");
965 printf(
"\n\nTesting Deep Power Down functionality ---------------\n\n");
985 printf(
"DEVICE IS IN DPD MODE. DATA MISMATCH EXPECTED. TEST PASSED.\n");
989 printf(
"DEVICE FAILED DPD TEST. The device is reading stored data when the line should be in Hi-Z state.\n");
994 printf(
"Resuming from Deep Power Down Mode...\n");
1004 printf(
"Resume from DPD operation success.\n");
1008 printf(
"Resume from DPD operation fail.\n");
1019 printf(
"\n\nTesting UDPD Mode and JEDEC Reset --------------------\n\n");
1031 printf(
"DEVICE IS IN UDPD MODE. DATA MISMATCH EXPECTED. TEST PASSED.\n");
1035 printf(
"DEVICE FAILED UDPD TEST. The device is reading stored data when the line should be in Hi-Z state.\n");
1042 printf(
"JEDEC reset performed, device should be operational.\n");
1047 printf(
"JEDEC reset operation success.\n");
1051 printf(
"JEDEC reset operation fail.\n");
1065 printf(
"\n\nTesting Erase Commands ------------------------------\n\n");
1080 printf(
"Device r/w fail.\n");
1091 printf(
"Device page erase fail.\n");
1096 printf(
"Page erase successful.\n");
1111 printf(
"Device r/w fail.\n");
1122 printf(
"Device block erase fail.\n");
1127 printf(
"Block erase successful.\n");
1137 printf(
"Device r/w fail.\n");
1146 printf(
"Device sector erase fail.\n");
1151 printf(
"Sector erase successful.\n");
1161 printf(
"Device r/w fail.\n");
1186 printf(
"\n\nTesting Memory to Buffer Commands -------------------\n\n");
1197 #if (PARTNO == AT45DB021E) || \ 1198 (PARTNO == AT45DB041E) || \ 1199 (PARTNO == AT45DB081E) || \ 1200 (PARTNO == AT45DB161E) || \ 1201 (PARTNO == AT45DB321E) || \ 1202 (PARTNO == AT45DB641E) || \ 1203 (PARTNO == AT45DQ161) || \ 1204 (PARTNO == AT45DQ321) || \ 1205 (PARTNO == AT25PE40) || \ 1206 (PARTNO == AT25PE80) || \ 1207 (PARTNO == AT25PE16) || \ 1218 if(dataRead[0] & (1<<6))
1220 printf(
"Error with ReadSR, Buffer 1 to Memory Compare, or Memory Program.\n");
1225 printf(
"Memory to Buffer 1 commands successful.\n");
1227 #if (PARTNO == AT45DB021E) || \ 1228 (PARTNO == AT45DB041E) || \ 1229 (PARTNO == AT45DB081E) || \ 1230 (PARTNO == AT45DB161E) || \ 1231 (PARTNO == AT45DB321E) || \ 1232 (PARTNO == AT45DB641E) || \ 1233 (PARTNO == AT45DQ161) || \ 1234 (PARTNO == AT45DQ321) || \ 1235 (PARTNO == AT25PE40) || \ 1236 (PARTNO == AT25PE80) || \ 1237 (PARTNO == AT25PE16) || \ 1243 if(dataRead[0] & (1<<6))
1245 printf(
"Error with ReadSR, Buffer 2 to Memory Compare, or Memory Program.\n");
1250 printf(
"Memory to Buffer 2 commands successful.\n");
1260 printf(
"\n\nTesting RMW Commands --------------------------------\n\n");
1266 if(dataWrite[4] != 0xAA)
1268 dataWrite[4] = 0xAA;
1272 dataWrite[4] = 0x55;
1281 printf(
"Error with RMW through Buffer 1 command.\n");
1286 printf(
"RMW through Buffer 1 command successful.\n");
1288 #if (PARTNO == AT45DB021E) || \ 1289 (PARTNO == AT45DB041E) || \ 1290 (PARTNO == AT45DB081E) || \ 1291 (PARTNO == AT45DB161E) || \ 1292 (PARTNO == AT45DB321E) || \ 1293 (PARTNO == AT45DB641E) || \ 1294 (PARTNO == AT45DQ161) || \ 1295 (PARTNO == AT45DQ321) || \ 1296 (PARTNO == AT25PE40) || \ 1297 (PARTNO == AT25PE80) || \ 1298 (PARTNO == AT25PE16) || \ 1305 if(dataWrite[5] != 0xAA)
1307 dataWrite[5] = 0xAA;
1308 dataWrite[6] = 0xAB;
1312 dataWrite[5] = 0x55;
1313 dataWrite[6] = 0x56;
1322 printf(
"Error with RMW through Buffer 2 command.\n");
1327 printf(
"RMW through Buffer 2 command successful.\n");
1331 #if (PARTNO == AT45DQ161) || \ 1332 (PARTNO == AT45DQ321) || \ 1340 printf(
"Error with Quad Output Read command.\n");
1345 printf(
"Quad Output Read command successful.\n");
1351 printf(
"\n\n#############################################\n\n");
1352 printf(
"Testing complete.\n");
1353 printf(
"Total errors detected: %d\n", errorCount);
1354 printf(
"Terminating testbench.\n");
1355 printf(
"\n#############################################\n\n");
1360 #elif defined(STANDARDFLASH_DEVICE) 1362 uint32_t
defaultTest(){
return standardflashTest();};
1364 uint32_t standardflashTest()
1366 #if PARTNO == AT25SF641 1369 uint8_t modeByteValue = 0xA0;
1371 uint8_t MID[3] = {0x1F, 0x32, 0x17};
1372 #elif PARTNO == AT25SF321 1375 uint8_t modeByteValue = 0x20;
1377 uint8_t MID[3] = {0x1F, 0x87, 0x01};
1378 #elif PARTNO == AT25SF161 1381 uint8_t modeByteValue = 0x20;
1383 uint8_t MID[3] = {0x1F, 0x86, 0x01};
1384 #elif PARTNO == AT25SF081 1387 uint8_t modeByteValue = 0x20;
1389 uint8_t MID[3] = {0x1F, 0x85, 0x01};
1390 #elif PARTNO == AT25SF041 1393 uint8_t modeByteValue = 0x20;
1395 uint8_t MID[3] = {0x1F, 0x84, 0x01};
1396 #elif PARTNO == AT25SL321 1399 uint8_t modeByteValue = 0xA0;
1401 uint8_t MID[3] = {0x1F, 0x42, 0x16};
1402 #elif PARTNO == AT25SL641 1405 uint8_t modeByteValue = 0xA0;
1407 uint8_t MID[3] = {0x1F, 0x43, 0x17};
1408 #elif PARTNO == AT25SL128A 1411 uint8_t modeByteValue = 0xA0;
1413 uint8_t MID[3] = {0x1F, 0x42, 0x18};
1414 #elif PARTNO == AT25DL081 1416 uint8_t MID[3] = {0x1F, 0x45, 0x02};
1417 #elif PARTNO == AT25DL161 1419 uint8_t MID[3] = {0x1F, 0x46, 0x03};
1420 #elif PARTNO == AT25DF081A 1422 uint8_t MID[3] = {0x1F, 0x45, 0x01};
1423 #elif PARTNO == AT25DF321A 1425 uint8_t MID[3] = {0x1F, 0x47, 0x01};
1426 #elif PARTNO == AT25DF641A 1428 uint8_t MID[3] = {0x1F, 0x48, 0x00};
1429 #elif PARTNO == AT25QL321 1432 uint8_t modeByteValue = 0xA0;
1434 uint8_t MID[3] = {0x1F, 0x42, 0x16};
1435 #elif PARTNO == AT25QL641 1438 uint8_t modeByteValue = 0xA0;
1440 uint8_t MID[3] = {0x1F, 0x43, 0x17};
1441 #elif PARTNO == AT25QL128A 1444 uint8_t modeByteValue = 0xA0;
1446 uint8_t MID[3] = {0x1F, 0x42, 0x18};
1447 #elif PARTNO == AT25QF641 1450 uint8_t modeByteValue = 0xA0;
1452 uint8_t MID[3] = {0x1F, 0x32, 0x17};
1467 uint32_t errorCount = 0;
1480 printf(
"\n\nTesting Read MID -----------------------------------\n\n");
1489 printf(
"ReadMID Success.\n");
1493 printf(
"ReadMID fail.\n");
1506 printf(
"\n\nTesting Standard Write and Read Commands -----------\n\n");
1510 #if (PARTNO == AT25DL081) || \ 1511 (PARTNO == AT25DL161) || \ 1512 (PARTNO == AT25DF081A) || \ 1513 (PARTNO == AT25DF321A) || \ 1514 (PARTNO == AT25DF641A) || \ 1532 printf(
"Write or ReadLF failure.\n");
1537 printf(
"Write and ReadLF success.\n");
1550 printf(
"Write or ReadHF failure.\n");
1555 printf(
"Write and ReadHF success.\n");
1557 #if (PARTNO == AT25SF641) || \ 1558 (PARTNO == AT25SF321) || \ 1559 (PARTNO == AT25SF161) || \ 1560 (PARTNO == AT25SF081) || \ 1561 (PARTNO == AT25SF041) || \ 1562 (PARTNO == AT25SL128A) || \ 1563 (PARTNO == AT25SL641) || \ 1564 (PARTNO == AT25SL321) || \ 1565 (PARTNO == AT25QL128A) || \ 1566 (PARTNO == AT25QL641) || \ 1567 (PARTNO == AT25QL321) || \ 1568 (PARTNO == AT25QF641) || \ 1597 printf(
"Write or Dual Output Read failure.\n");
1602 printf(
"Write and Dual Output Read success.\n");
1613 printf(
"Write or Dual IO Read failure.\n");
1618 printf(
"Write and Dual IO Read success.\n");
1659 printf(
"Write or Quad Output Read failure.\n");
1664 printf(
"Write and Quad Output Read success.\n");
1675 printf(
"Write or Quad IO Read failure.\n");
1680 printf(
"Write and Quad IO Read success.\n");
1699 printf(
"Leave Quad IO failure.\n");
1704 printf(
"Leave Quad IO success.\n");
1715 printf(
"\n\nTesting Deep Power Down functionality ---------------\n\n");
1739 printf(
"DEVICE IS IN DPD MODE. DATA MISMATCH EXPECTED. TEST PASSED.\n");
1743 printf(
"DEVICE FAILED DPD TEST. The device is reading stored data when the line should be in Hi-Z state.\n");
1748 printf(
"Resuming from Deep Power Down Mode...\n");
1758 printf(
"Resume from DPD operation success.\n");
1762 printf(
"Resume from DPD operation fail.\n");
1768 #if (PARTNO == AT25SF641) || \ 1769 (PARTNO == AT25SL128A) || \ 1770 (PARTNO == AT25SL641) || \ 1771 (PARTNO == AT25SL321) || \ 1772 (PARTNO == AT25QL128A) || \ 1773 (PARTNO == AT25QL641) || \ 1774 (PARTNO == AT25QL321) || \ 1775 (PARTNO == AT25QF641) || \ 1778 printf(
"\n\nThis device has Quad IO Capabilities.\n");
1780 printf(
"\n\nTesting Read MID Quad IO ----------------------------\n\n");
1798 printf(
"ReadMID in Quad IO Success.\n");
1802 printf(
"ReadMID Quad IO fail.\n");
1817 printf(
"ReadMID Success.\nLeft Quad IO successfully.\n");
1821 printf(
"ReadMID fail.\nFailed to Leave Quad IO.\n");
1839 printf(
"\n\nTesting Write and Read Quad IO Commands --------------\n\n");
1856 printf(
"Write or ReadHF failure.\n");
1861 printf(
"Write and ReadHF success.\n");
1874 printf(
"Write or ReadHF failure.\n");
1879 printf(
"Write and ReadHF success.\n");
1906 printf(
"Write or Quad Output Read failure.\n");
1911 printf(
"Write and Quad Output Read success.\n");
1927 printf(
"Write or Quad IO Read failure.\n");
1932 printf(
"Write and Quad IO Read success.\n");
1943 #if (PARTNO == AT25DL081) || \ 1944 (PARTNO == AT25DL161) || \ 1945 (PARTNO == AT25DF081A) || \ 1946 (PARTNO == AT25DF321A) || \ 1947 (PARTNO == AT25DF641A) || \ 1954 printf(
"\nThis device has the ability to program using 2 IOs.\n");
1968 printf(
"Dual Write or HF Read failure.\n");
1973 printf(
"Dual Write and HF Read success.\n");
1979 printf(
"\n\n#############################################\n\n");
1980 printf(
"Testing complete.\n");
1981 printf(
"Total errors detected: %d\n", errorCount);
1982 printf(
"Terminating testbench.\n");
1983 printf(
"\n#############################################\n\n");
void monetaWaitOnReady()
: Wait while Read/Busy Status bit in SRB is 1 (device is busy).
void dataflashArrayReadLowPower(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x01 Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void fusionUDPDMode()
OPCODE: 0x79 Sends the device into Ultra Deep Power Down Mode. Exit UDPD Mode by toggling CS with c...
void dataflashMemoryProgramThruBuffer1WithErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x82 Programs main memory through buffer 1 starting at the address indicated by 'address' w...
void dataflashBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x87 Programs 'txNumBytes' bytes of data to buffer 2 starting at the address indicated by a...
void dataflashBlockErase(uint32_t address)
OPCODE: 0x50 Erases a block of data (8 pages) starting from page address 'address.'.
void fusionWriteEnable()
OPCODE: 0x06 Sends opcode to enable writing.
void fusionReadSectorProtectionRegisters(uint32_t address, uint8_t *rxBuffer)
OPCODE: 0x3C Reads the sector protection register at address 'address.' 0x00 -> Sector is unprotect...
void standardflashResumeFromDPD()
OPCODE: 0xAB Wake the device from deep power down mode. See dataflashDPD().
void standardflashEnableQPI()
OPCODE: 0x38 Switches the device from SPI mode to QPI mode, and sets a variable to quad mode...
void dataflashDPD()
OPCODE: 0xB9 Put the device into deep power down mode. Call dataflashResumeFromDPD() to wake up...
void fusionReadMID(uint8_t *rxBuffer)
OPCODE: 0x9F Reads the manufacturer ID and stores the data in rxBuffer.
void monetaReadArray(uint16_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x03 Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void dataflashArrayReadHighFreq0(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x0B Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void fusionResumeFromDeepPowerDown()
OPCODE: 0xAB Wakes the device up from Deep Power Down mode (fusionDeepPowerDown()).
void dataflashBuffer2ReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD3 Reads rxNumBytes starting from location 'address' in buffer 2 and stores the data in t...
void standardflashContinuousReadModeDualReset()
OPCODE: 0xFFFF Resets the dual continuous read mode that was entered with standardflashDualIORead()...
void monetaHardwareReset()
Exits Ultra Deep Power Down mode using the hardware reset option.
void fusionHardwareReset()
Performs a hardware (JEDEC) reset on the device.
void dataflashMemtoBuffer1Compare(uint32_t address)
OPCODE: 0x60 Compare the contents of a page in main memory to the contents of buffer 1...
void dataflashBuffer1ToMainMemoryWithoutErase(uint32_t address)
OPCODE: 0x88 Programs the entire buffer 1 page to main memory starting at the address indicated by ...
void standardflashDPD()
OPCODE: 0xB9 Put the device into deep power down mode. Call dataflashResumeFromDPD() to wake up...
bool compareByteArrays(uint8_t *arr1, uint8_t *arr2, uint32_t arrLength)
Helper function to compare 2 byte arrays and print an error message if they do not match...
void standardflashQuadIORead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes, uint8_t readMode, uint8_t modeByteValue)
OPCODE: 0xEB Reads 'txNumBytes' bytes of data in Quad IO Mode starting at 'address' using SI...
void standardflashDualIORead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes, uint8_t readMode, uint8_t modeByteValue)
OPCODE: 0xBB Reads 'txNumBytes' bytes of data in Dual IO Mode starting at 'address' using both SI a...
Test layer declarations exist here.
void dataflashBuffer2ToMainMemoryWithoutErase(uint32_t address)
OPCODE: 0x89 Programs the entire buffer 2 page to main memory starting at the address indicated by ...
void standardflashReadArrayLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x03 Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void dataflashUDPDMode()
OPCODE: 0x79 Put the device into ultra deep power down mode. Wake the device with dataflashHardware...
void dataflashArrayReadLegacy(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xE8 Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void dataflashRMWThruBuffer1(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x58 Reads main memory to buffer 1, modifies it, then writes the data back to main memory w...
void dataflashQuadEnable()
OPCODE: 0x3D2A8166 Programs the NV-QE bit to a logical 1 to enable the Quad I/O commands...
void standardflashSetQEBit()
: Sets the QE bit in status register byte 2. Does not modify any other bits. This is accomplished by ...
void fusionDeepPowerDown()
OPCODE: 0xB9 Enters the device into Deep Power Down mode. fusionResumeFromDeepPowerDown() will wake...
void dataflashHardwareReset()
Perform a JEDEC reset on the flash device.
void dataflashBuffer2ToMainMemoryWithErase(uint32_t address)
OPCODE: 0x86 Programs the entire buffer 2 page to main memory starting at the address indicated by ...
void fusionGlobalUnprotect()
Unprotects all sectors by issuing a WE, then write of 0x00 to status register byte 1...
void standardflashDualInputBytePageProgram(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0xA2 Programs 'txNumBytes' bytes of data starting at the address indicated by address using...
void dataflashBuffer1ReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD1 Reads rxNumBytes starting from location 'address' in buffer 1 and stores the data in t...
void dataflashReadSR(uint8_t *rxBuffer)
OPCODE: 0xD7 Reads the value in the device status register (bytes 1 and 2).
void standardflashUnprotectSector(uint32_t address)
OPCODE: 0x39 Un-protects a sector containing the address address.
void fusionWaitOnReady()
: Wait while Read/Busy Status bit in SRB is 1 (device is busy).
void monetaWriteDisable()
OPCODE: 0x04 Sends opcode to disable writing.
void standardflashContinuousReadModeQuadReset()
OPCODE: 0xFF Resets the quad continuous read mode that was entered with standardflashQuadIORead() w...
void standardflashReadMID(uint8_t *rxBuffer)
OPCODE: 0x9F Reads the manufacturer ID and stores the data in rxBuffer.
void fusionWriteDisable()
OPCODE: 0x04 Sends opcode to disable writing.
void dataflashArrayReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x03 Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void dataflashReadMID(uint8_t *rxBuffer)
OPCODE: 0x9F Reads the manufacturer ID and stores the data in rxBuffer.
void fusionBlockErase4K(uint32_t address)
OPCODE: 0x20 Erases a block of data (4 KBytes) starting from page address 'address.'.
void standardflashClearQEBit()
: Clears the QE bit in status register byte 2. Does not modify any other bits. This is accomplished b...
void dataflashPageErase(uint32_t address)
OPCODE: 0x81 Erases a page of data (256/264 Bytes) starting from page address 'address.'.
void dataflashBuffer1ReadHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD4
void fillArrayPattern(uint8_t *byteArray, uint32_t numBytes, int seedNumber)
Helper function to display fill a byte array/buffer with a pattern based on a seedNumber. The seed will be incremented by the index of the array.
void standardflashQuadOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x6B Reads 'txNumBytes' bytes of data in Quad Output Mode starting at 'address' using SI...
void fusionDualInputProgram(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0xA2 Programs 'txNumBytes' bytes of data in Dual Input Mode starting at 'address' using bot...
void monetaReadMID(uint8_t *rxBuffer)
OPCODE: 0x9F Reads the manufacturer ID and stores the data in rxBuffer.
void dataflashSectorErase(uint32_t address)
OPCODE: 0x7C
void standardflashReadArrayHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x0B Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void fusionGlobalProtect()
Protects all sectors by issuing a WE, then write of 0x7F to status register byte 1. These 2 write are accomplished with fusionWriteEnable() and fusionWriteSRB1().
void standardflashWaitOnReady()
: Wait while Read/Busy Status bit in SRB is 1 (device is busy). This is accomplished by reading the f...
void dataflashBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x84 Programs 'txNumBytes' bytes of data to buffer 1 starting at the address indicated by a...
void dataflashBuffer1ToMainMemoryWithErase(uint32_t address)
OPCODE: 0x83 Programs the entire buffer 1 page to main memory starting at the address indicated by ...
void standardflashWriteEnable()
OPCODE: 0x06 Sends opcode to enable writing.
void dataflashResumeFromDPD()
OPCODE: 0xAB Wake the device from deep power down mode. See dataflashDPD().
void fusionSequentialProgramMode(uint8_t txBuffer)
OPCODE: 0xAD Sends the byte in txBuffer to the flash device for programming. This command should on...
#define MAXIMUM_BUFFER_SIZE
void monetaWriteEnable()
OPCODE: 0x06 Sends opcode to enable writing.
void dataflashWaitOnReady()
: Wait while Read/Busy Status bit in SRB is 1 (device is busy).
void dataflashQuadOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x6B Reads 'txNumBytes' bytes of data in Quad Output Mode starting at 'address' using SI...
void monetaReadSR(uint8_t *rxBuffer)
OPCODE: 0x05 Reads the value in the status registers.
uint32_t defaultTest()
The default test function can be called by the user to perform the default test prepared for each dev...
void dataflashMemtoBuffer2Compare(uint32_t address)
OPCODE: 0x61 Compare the contents of a page in main memory to the contents of buffer 2...
void fusionReadArray(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x0B Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void dataflashBuffer2ReadHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD6 Reads rxNumBytes starting from location 'address' in buffer 2 and stores the data in t...
void fusionDualOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x3B Reads 'txNumBytes' bytes of data in Dual Output Mode starting at 'address' using both ...
void fusionPageErase(uint32_t address)
OPCODE: 0x81 Erases a page of data (256 Bytes) starting from page address 'address.'.
void dataflashMemtoBuffer1Transfer(uint32_t address)
OPCODE: 0x53 Transfer the contents of a page in main memory at the address indicated by 'address' t...
void standardflashDualOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x3B Reads 'txNumBytes' bytes of data in Dual Output Mode starting at 'address' using both ...
void fillArrayConst(uint8_t *byteArray, uint32_t numBytes, int constantNum)
Helper function to display fill a byte array/buffer with a constant number.
void fusionSequentialProgramModeEnable(uint32_t address, uint8_t txBuffer)
OPCODE: 0xAD Enables sequential program mode and loads the starting address into the device...
void standardflashBlockErase4K(uint32_t address)
OPCODE: 0x20 Erases a block of data (4 KBytes) starting from page address 'address.'.
void fusionUnprotectSector(uint32_t address)
OPCODE: 0x39 Sends opcode to enable writing.
void fusionReadSR(uint8_t *rxBuffer)
OPCODE: 0x05 Reads the value in the status register (bytes 1 and 2).
void standardflashBytePageProgram(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x02 Programs 'txNumBytes' bytes of data starting at the address indicated by address...
void dataflashMemtoBuffer2Transfer(uint32_t address)
OPCODE: 0x55
void dataflashArrayReadHighFreq1(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x1B Reads rxNumBytes starting from location 'address' and stores the data in the byte arra...
void standardflashDisableQPI()
OPCODE: 0xFF Switches the device from QPI mode to SPI mode, and sets a variable to spi mode...
void monetaWriteArray(uint16_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x02 Writes txNumBytes bytes of data starting at the address indicated by address...
void monetaUDPDMode1()
OPCODE: 0x79 Sends the device into Ultra Deep Power Down Mode 1. Exit UDPD Mode 1 by power cycling ...
void SPI_ConfigureSingleSPIIOs()
Configure the IOs for SPI bit banging usage. 4 pins are needed: CSb, SCK, MOSI, MISO.
void dataflashQuadDisable()
OPCODE: 0x3D2A8167 Programs the NV-QE bit to a logical 0 to disable the Quad I/O commands...
void dataflashMemoryProgramThruBuffer2WithErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x85 Programs main memory through buffer 2 starting at the address indicated by 'address' w...