This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

External Flash with USBD_MSC example

Dear All,

I need your help because I created a PCB with the nrf52840 and a flash connected exactly as the one on the dev-board.

The only difference is that the one on the dev-board is a 64Mb 80MHz and the new one is a 256Mb 120MHz (both NOR).

If I program the dev-board with the USBD_MSC example it works as expected showing the files inside the flash when connected via USB to the PC but if I run the same on the board with the new flash the PC shows that it is impossible to access to the memory because of an I/O device error.

I think that this is caused by the configuration that has to be set correctly because if I simply print UART data via USB it works correctly (so it seems that it is not an USB problem or hardware issue) and if I use the QSPI example to write random data and read them it also works correctly (so it seems that the flash works correctly).

Thank you very much.

Best regards

  • Dear Simon,

    You're right, I didn't see that the flash memory was shown in Mega-Bits in the datasheet but I was watching inside it with windows that shows the memory in MegaBytes.

    Therefore my memory of 256Mb has to be correctly set with .size = 32*1024*1024 as for your first suggestion and windows shows it correctly as 32MB.

    I am sorry for the misunderstanding but I thought that I was watching at the same measure unit.

    Thank you very much.

    Best regards.

  • Dear Simonr,

    I am trying to understand a bit better how the flash works.

    Therefore I have some questions:

    1) I see that inside the main I have to set the flash block size with the function NRF_BLOCK_DEV_QSPI_CONFIG.

    The default size is 512 but how can I check that this size is also ok for my new flash memory?

    2) The function MSC_WORKBUFFER_SIZE is used to set the buffer size.

    The default size is 1024 but how can I check that this size is also ok for my new flash memory?

    3) I understood what id and size parameters means inside static const nrf_serial_flash_params_t m_sflash_params[].

    Can you please explain what are the other parameters (.capabilities = 0x00, .erase_size = 4 * 1024, and .program_size = 256) and where I can find these information about my flash so that I can set them correctly?

    Because I am using the flash memory to continuously save data.

    I create a new file every 5 minutes and every file is about 750kB (kilobytes).

    If I save data for 1 hour and 45 minutes it is all ok and by connecting the board to the PC I can see the memory that is almost half full (105 minutes means 21 files that is almost 16MB).

    But if I save data for 2 hours my PC can't read the memory and asks only if I want to format it.

    I think that is because the parameters or initialization is not set correctly but I am not sure.

    Can you please help me?

    Currently I am using the MX25L25673GZNI-08G flash model.

    Thank youvery much.

    Best regards.

Related