Hi Daniel,
The BSP version is BSP32. I have tried to lower the frequency to 166 MHz or below, but the same problem still occurs.
Additionally I tried to use protocol 1_1_1 at normal read mode, and lower the frequency to 40MHz, at which point the read output is correct, but sometimes segmentation fault may occur.
pc : __memcpy_fromio+0x58/0xb0
lr : s32gen1_exec_op+0x10c/0x284
sp : ffffffc0158b3750
x29: ffffffc0158b3750 x28: ffffff8002dd4080
x27: ffffffc0158b3e20 x26: 0000007fa9994010
x25: ffffffc011845000 x24: 00000000030f004c
x23: 000000000000000a x22: ffffff8002e74600
x21: 0000000000000000 x20: ffffffc0158b3b10
x19: ffffff8002e70600 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0000000000000000 x12: ffffffc0114f9b28
x11: 0000000000000001 x10: 0000000000000001
x9 : ffffffc01082206c x8 : 000000006f2d9830
x7 : 0007a12000000000 x6 : 0000000000200000
x5 : ffffffffffffffff x4 : ffffffc0215a07f8
x3 : ffffff8015000000 x2 : 0000000000200000
x1 : ffffffc0215a0000 x0 : ffffff8014e007f8
Call trace:
__memcpy_fromio+0x58/0xb0
spi_mem_exec_op+0x39c/0x3f4
spi_mem_dirmap_read+0x160/0x1bc
spi_nor_spimem_read_data+0xc8/0x154
spi_nor_read+0xe8/0x180
mtd_read_oob_std+0x80/0x90
mtd_read_oob+0x8c/0x150
mtd_read+0x54/0x90
mtdchar_read+0xdc/0x294
vfs_read+0xb8/0x1ec
ksys_read+0x74/0x100
__arm64_sys_read+0x28/0x34
el0_svc_common.constprop.0+0x9c/0x1f0
do_el0_svc+0x78/0xa0
el0_svc+0x20/0x30
el0_sync_handler+0x1a4/0x1b0
el0_sync+0x180/0x1c0
Code: 927df0c6 910020c6 8b060003 d503201f (f9400085)
---[ end trace 13cb3c0a44f3c8b6 ]---
Segmentation fault
I also tried some other methods:
1、protocol 1_1_1 at 200MHz, dummy.nbytes=0
commands: #mtd_debug write dev/mtd0 0x5a0000 0x200000 /data/test.img
#mtd_debug read /dev/mtd0 0x5a0000 0x200000 /data/read.img
the first bytes in read.img is FF, which is not the same with the test.img
2、FAST READ protocol 1_1_1 at 200 MHz with DQS signal, dummy.nbytes=8
Segmentation fault is no longer occur, but sometimes hundrands of bytes in the middle of read.img will be wrong, and the lower the clock frequency, the higher the frequency of errors occurring.
3、STR_1_1_8 at 200MHz with DQS signal, and changed the dummy.nbytes to 8 at the function spi_nor_spimem_read_data()
If I using following commands, the outcome is correct.
mtd_debug read 0x5a0000 0x1000 /data/erase.img
Once I set 0x1000 to 0x200000, the same segmentation fault will occur