read problem with nor flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

read problem with nor flash

1,106 Views
xiuqi_huang
Contributor I

Hi Team:

    When I use the mtd_debug tool to read memory from nor flash, the first seven bytes of every 128 bytes in the output result are zero.

    following are mtd commands:

     #mtd_debug erase /dev/mtd0 0x5a0000 0x200000

     #mtd_debug read /dev/mtd0 0x5a0000 0x200000 /data/erase.img

    If I change dummy.nbytes to 8 in function spi_nor_create_read_dirmap() in drivers/mtd/spi-nor/core. c, the 7-byte zero will disappear, but occasionally the first, third, and fourth data lines will be delayed by one cycle when pulled up. Therefore the first byte in the output will become F2 or FE or F8

    The read protocol I am using is STR_1_1_8, the clock frequency is 200MHz 

    How can I solve this problem?

Huang

0 Kudos
7 Replies

1,093 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Which BSP version are you using? Also, have you tried lowering the frequency? Do you have the same problem?

Please, let us know.

0 Kudos

1,072 Views
xiuqi_huang
Contributor I

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

 

0 Kudos

1,059 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Thanks for feedback.

We will comment this out with the internal team, to see if they have any recommendations on this regard.

Also, forgot to ask, are you using an NXP provided platform? Or is it a custom board?

Please, let us know.

0 Kudos

1,014 Views
xiuqi_huang
Contributor I

Hi Daniel,

    I'm sorry for taking so long to reply.

    I'm using a customized board based on NXP provided platform, the flash chip model is mt35xu512aba. Now I use SNOR_PROTO_1_1_1 to read data from memory without DQS signal at 40MHz, the output is perfectly right. It seems that the DQS signal caused the segmentation fault.

    However, the SNOR_PROTO_1_1_8 and SNOR_PROTO_8_8_8_DTR still have the same problems like I posted before.

0 Kudos

1,001 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

No problem. Thanks for your feedback.

We will send this information to our internal team. Also, the internal team provided some comments on regards of the previous information:

"I have not used the mtd_debug tool. but It is not a usage issue and It would be caused by the QSPI configuration.

Firstly, the different flash chip has different configuration. And different frequencies also need different QSPI configurations. As customer side. "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". We understand that the configuration of QSPI and the flash chip is on the SDR with low frequency/clock, and if the customer wants to use the high frequency/clock to operate the flash they should configure the QSPI controller and switch the mode of the Flash chip.

So If customers want to use the high frequencies of QSPI, customer should know how to configure the QSPI parameter for different modes. Please let the customer refer to the AN S32G Quad Serial Peripheral Interface (QSPI) Deep Dive at firstly"

Please, let us know.

0 Kudos

980 Views
xiuqi_huang
Contributor I

Hi Daniel,

    Thank you for your suggestion. Does this mean taht I need to modify the configurations of some registers in drivers/spi/s32gen1-qspi.c, such as LUT[0]? Is there a relevant guide of how to support and use a new flash chip in linux kernel. And what's the default QSPI configurations in linux kernel at BSP32.

0 Kudos

960 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

The NOR Flash itself needs to be reconfigured to be able to use a wider bus, DDR or even higher frequencies. This needs to be done prior to attempting any access in a different way than the default NOR Flash configuration is shipped with.

As for new chips, the only information available under S32G2 is the AN13563, which is the QSPI Deep Dive mentioned by our internal team.

As for specific instruction on how to do it on Linux, we did not seem to find anything, we apologize.

Please, let us know.

0 Kudos