problems with NCS 2.6.0 usb_mass_storage example with custom PCB

I made a custom PCB with the NRF52840-CKAA and the same 8MB flash memory chip as the PCA10056 NRF528040DK

I used the MX25R6435FZAIL0 because the MX25R6435FZNIL0 was not available from LCSC

The only difference is the package code  ("M2" instead of "ZN")

I altered the NCS 2.6.0 usb_mass_storage example to change the pins to match the ones I used on my PCB. 

I could not get it to work so I suspected the chip was not connected properly.

So I made a test using the nrf_qspi peripheral directly and eventually managed to confirm single wire mode worked. Later I was able to set the QuadEnable bit in the MX25 status register to get 4-wire mode working. So that suggests the chip is connected 

I then went back to the usb_mass_storage example and located the driver code and found that it failed to read the JEDEC ID in qspi_init (line 1063 in nrf_qspi_nor.c). It got zeros instead of the JEDEC code. I stepped through the code and discovered that it worked. But only if I single stepped in the debugger. if I ran the code then it still failed. 

I then found that if I introduce a delay between the calls to nrf_qspi_task_trigger, then it works

I also found the "rx_delay" dts parameter, and I tried setting it to 250 (almost the maximum 255), but it didn't work

I am struggling to understand what might be causing this. 

I'm reaching out to see if this "rings any bells" with one of your developers.

The current "fix" is obviously a hideous hack, and I do not understand why I need to add this delay. I believe the driver code only failed to read the JEDEC code, but perhaps it impacts other communications that I've not encountered. So I will have to find a better solution.

I also tried to run the NCS2.8.0 usb mass storage example but it doesn't compile with the nrf52840DK (PCA10056)

Any suggestions are greatly appreciated. 

Kind regards,

-Jason

Parents
  • Hello Jason,

    Is the QSPI flash IC connected to the same power rail as the nRF, or is it power-gated and powered on by the nRF at startup? Based on your description, it seems like the flash requires more time to power up.

    I also tried to run the NCS2.8.0 usb mass storage example but it doesn't compile with the nrf52840DK (PCA10056)

    In nRF Connect SDK v2.7.0 and above, we enable sysbuild by default for all samples, which requires the Partition Manager to be used instead of the Devictree to manage the partition layout. To test the mass storage sample in SDK v2.8.0 without allocating a new parition for fatfs with the partition manager, you can use the following build configuration:

    Best regards,

    Vidar

Reply
  • Hello Jason,

    Is the QSPI flash IC connected to the same power rail as the nRF, or is it power-gated and powered on by the nRF at startup? Based on your description, it seems like the flash requires more time to power up.

    I also tried to run the NCS2.8.0 usb mass storage example but it doesn't compile with the nrf52840DK (PCA10056)

    In nRF Connect SDK v2.7.0 and above, we enable sysbuild by default for all samples, which requires the Partition Manager to be used instead of the Devictree to manage the partition layout. To test the mass storage sample in SDK v2.8.0 without allocating a new parition for fatfs with the partition manager, you can use the following build configuration:

    Best regards,

    Vidar

Children
Related