-
Type:
Bug
-
Resolution: Fixed
-
Priority:
High
-
Linux Core SDK
-
LCPD-42251
-
10.00
-
10.01
-
am62xx_lp_sk-fs
Customer reported issues writing to NAND flash on SK-AM62-LP with SDK v10.0, which I was able to re-create. The read-back data doesn't match the data that was written. Note that adding an erase step before the write step did not seem to make any difference (also the read-back data pattern doesn't look like it is an erase problem, as bits go from 0->1 during write).
root@am62xx-lp-evm:~# dd if=/dev/random of=tmp_write.txt bs=1 count=1M 1048576+0 records in 1048576+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 5.66642 s, 185 kB/s root@am62xx-lp-evm:~# mtd_debug write /dev/mtd5 0 1048576 tmp_write.txt Copied 1048576 bytes from tmp_write.txt to address 0x00000000 in flash root@am62xx-lp-evm:~# mtd_debug read /dev/mtd5 0 1048576 tmp_read.txt Copied 1048576 bytes from address 0x00000000 in flash to tmp_read.txt root@am62xx-lp-evm:~# ls -al total 2068 drwx------ 5 root root 4096 Jan 1 00:02 . drwxr-xr-x 18 root root 4096 Jan 1 00:00 .. drwxr-xr-x 3 root root 4096 Jan 1 00:00 .cache drwx------ 3 root root 4096 Jan 1 00:00 .config drwx------ 2 root root 4096 Feb 27 2024 .ssh -rw-r--r-- 1 root root 1048576 Jan 1 00:02 tmp_read.txt -rw-r--r-- 1 root root 1048576 Jan 1 00:02 tmp_write.txt root@am62xx-lp-evm:~# cmp tmp_read.txt tmp_write.txt tmp_read.txt tmp_write.txt differ: char 1, line 1 root@am62xx-lp-evm:~# hexdump -C tmp_write.txt | head 00000000 e6 70 38 4d 2f cb 0f d6 db 2d 5b 1d 18 21 ee 4b |.p8M/....-[..!.K| 00000010 44 2a 70 fc 3e 44 34 b7 be 48 6e 45 d0 0b 0f 6c |D*p.>D4..HnE...l| 00000020 9b 64 73 2a 70 a2 73 7a c6 52 b1 c1 09 ff 4a cf |.ds*p.sz.R....J.| 00000030 94 74 cc 81 3f cf 7b 00 ea 65 aa 24 1d b9 a8 2a |.t..?.{..e.$...*| 00000040 78 16 d0 14 a7 03 ce 91 bd 06 8e f4 05 5f 66 4c |x............_fL| 00000050 76 01 1e d6 1f ed a2 bf 57 6b d0 69 0c f6 2e 96 |v.......Wk.i....| 00000060 4f 02 89 49 4d cb 18 0d 77 0e 24 80 05 8f 01 0e |O..IM...w.$.....| 00000070 80 31 3c 7c 13 33 b5 ec 64 04 e6 92 fd 64 6b b0 |.1<|.3..d....dk.| 00000080 77 9d 0c 20 54 20 2e 18 96 6f 56 45 c5 15 34 4c |w.. T ...oVE..4L| 00000090 5e 93 2b c9 2a 69 ea a9 68 12 74 69 0d a5 92 c8 |^.+.*i..h.ti....| root@am62xx-lp-evm:~# hexdump -C tmp_read.txt | head 00000000 56 73 9b 59 2f 22 f3 2f 45 60 f0 35 59 bf a5 15 |Vs.Y/"./E`.5Y...| 00000010 20 5a c6 24 57 fc 03 80 68 33 1c 08 b3 ee f9 cb | Z.$W...h3......| 00000020 da 5b 53 5b 13 d7 63 12 c3 be 30 73 a9 89 06 29 |.[S[..c...0s...)| 00000030 77 ce d6 e0 c8 bb ba e8 7a 5e 96 16 82 7f 18 f3 |w.......z^......| 00000040 de ea 83 45 3d 9b bb 62 1b 1d 03 fa 28 15 b9 00 |...E=..b....(...| 00000050 77 93 99 ce 15 b0 0b a1 34 4c 4a af fc 2a cf 9d |w.......4LJ..*..| 00000060 24 d1 59 b8 ff eb 66 d0 d9 91 47 d3 37 93 53 5e |$.Y...f...G.7.S^| 00000070 82 af 2f b0 81 cf b2 a8 82 10 fb f7 c1 c1 e0 ab |../.............| 00000080 2c 37 3f b2 da 2e cc d3 bf da df 3e 6c f5 66 60 |,7?........>l.f`| 00000090 c0 bf 05 24 ff a5 08 eb 48 e6 1d e7 7f 31 fa b6 |...$....H....1..| root@am62xx-lp-evm:~#
The same steps/sequence work on an SK-AM62A board without issue (same NAND chip).
root@am62axx-evm:/# dd if=/dev/random of=tmp_write.txt bs=1 count=1M 1048576+0 records in 1048576+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 4.80675 s, 218 kB/s root@am62axx-evm:/# mtd_debug write /dev/mtd5 0 1048576 tmp_write.txt Copied 1048576 bytes from tmp_write.txt to address 0x00000000 in flash root@am62axx-evm:/# mtd_debug read /dev/mtd5 0 1048576 tmp_read.txt Copied 1048576 bytes from address 0x00000000 in flash to tmp_read.txt root@am62axx-evm:/# ls -al total 2116 drwxr-xr-x 19 root root 4096 Jan 6 00:17 . drwxr-xr-x 19 root root 4096 Jan 6 00:17 .. drwxr-xr-x 3 root root 4096 Jan 1 00:00 .cache lrwxrwxrwx 1 root root 7 Mar 9 2018 bin -> usr/bin drwxr-xr-x 4 root root 4096 Mar 9 2018 boot drwxr-xr-x 18 root root 5140 Jan 5 23:47 dev drwxr-xr-x 54 root root 4096 Jan 1 00:00 etc drwxr-xr-x 3 root root 4096 Mar 9 2018 home lrwxrwxrwx 1 root root 7 Mar 9 2018 lib -> usr/lib drwx------ 2 root root 16384 Apr 5 2011 lost+found drwxr-xr-x 2 root root 4096 Mar 9 2018 media drwxr-xr-x 2 root root 4096 Mar 9 2018 mnt drwxr-xr-x 20 root root 4096 Jan 1 00:00 opt dr-xr-xr-x 178 root root 0 Jan 1 00:00 proc drwx------ 4 root root 4096 Jan 1 00:06 root drwxr-xr-x 22 root root 720 Jan 1 00:00 run lrwxrwxrwx 1 root root 8 Mar 9 2018 sbin -> usr/sbin drwxr-xr-x 2 root root 4096 Mar 9 2018 srv dr-xr-xr-x 12 root root 0 Jan 1 00:00 sys drwxrwxrwt 7 root root 180 Jan 1 00:00 tmp -rw-r--r-- 1 root root 1048576 Jan 6 00:17 tmp_read.txt -rw-r--r-- 1 root root 1048576 Jan 6 00:16 tmp_write.txt drwxr-xr-x 13 root root 4096 Mar 9 2018 usr drwxr-xr-x 9 root root 4096 Jan 1 00:00 var root@am62axx-evm:/# cmp tmp_read.txt tmp_write.txt root@am62axx-evm:/# diff tmp_read.txt tmp_write.txt root@am62axx-evm:/# hexdump -C tmp_write.txt | head 00000000 b0 46 a3 0c a5 ec 13 be c3 ab 33 ce e2 ba 8c 1a |.F........3.....| 00000010 b8 78 d9 7f 92 3c 18 20 15 70 da b3 f1 e9 db 67 |.x...<. .p.....g| 00000020 44 14 e4 1c b9 ab c5 ee 55 03 9c 53 8b 57 5e 50 |D.......U..S.W^P| 00000030 9b db e5 9b 97 f7 06 05 1b c6 7a ac df 53 28 3b |..........z..S(;| 00000040 76 0f b3 2e 09 88 c0 11 ae 72 bf 6d cc ae 25 84 |v........r.m..%.| 00000050 9a cf 1b a2 5b 2d 1f 15 12 de 48 48 62 dc ef db |....[-....HHb...| 00000060 3f 59 5f d1 d1 e9 61 f2 0d cb 96 64 57 7f d6 29 |?Y_...a....dW..)| 00000070 8f b4 97 30 31 a0 77 ad d2 46 36 b4 d2 33 60 6c |...01.w..F6..3`l| 00000080 97 d8 db ce eb 31 73 96 eb 91 ba f7 f0 0b 12 60 |.....1s........`| 00000090 2b 74 39 f5 bc 4e 78 14 52 ed f3 5e 95 1e 1e 61 |+t9..Nx.R..^...a| root@am62axx-evm:/# hexdump -C tmp_read.txt | head 00000000 b0 46 a3 0c a5 ec 13 be c3 ab 33 ce e2 ba 8c 1a |.F........3.....| 00000010 b8 78 d9 7f 92 3c 18 20 15 70 da b3 f1 e9 db 67 |.x...<. .p.....g| 00000020 44 14 e4 1c b9 ab c5 ee 55 03 9c 53 8b 57 5e 50 |D.......U..S.W^P| 00000030 9b db e5 9b 97 f7 06 05 1b c6 7a ac df 53 28 3b |..........z..S(;| 00000040 76 0f b3 2e 09 88 c0 11 ae 72 bf 6d cc ae 25 84 |v........r.m..%.| 00000050 9a cf 1b a2 5b 2d 1f 15 12 de 48 48 62 dc ef db |....[-....HHb...| 00000060 3f 59 5f d1 d1 e9 61 f2 0d cb 96 64 57 7f d6 29 |?Y_...a....dW..)| 00000070 8f b4 97 30 31 a0 77 ad d2 46 36 b4 d2 33 60 6c |...01.w..F6..3`l| 00000080 97 d8 db ce eb 31 73 96 eb 91 ba f7 f0 0b 12 60 |.....1s........`| 00000090 2b 74 39 f5 bc 4e 78 14 52 ed f3 5e 95 1e 1e 61 |+t9..Nx.R..^...a| root@am62axx-evm:/#
For completeness, the below shows the Flash erase operation itself works on SK-AM62-LP:
root@am62xx-lp-evm:~# mtd_debug erase /dev/mtd4 0x0000 0x1000 Erased 4096 bytes from address 0x00000000 in flash root@am62xx-lp-evm:~# mtd_debug read /dev/mtd4 0 0x1000 tmp_read.txt Copied 4096 bytes from address 0x00000000 in flash to tmp_read.txt root@am62xx-lp-evm:~# hexdump -C tmp_read.txt | head 00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * 00001000
It seems like something happens during "mass-transfer" / "mass-write" of data to the Flash. All other operations seem to work.
I spent some time double-checking Flash parameters and various settings (device tree) and experimented with updating those including but not limited to max. speed and SPI-width as well as read delay in an attempt to get it going but I could not.