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

Parents
  • Hi

    The default size (8*1024*1024) is 64Mb, as the 8 represents Bytes in this context. So in order to modify this to fit a 256Mb, you'll have to set .size = 32*1024*1024.

    Best regards,

    Simon

  • Dear Simon,

    Thank you very much for your reply.

    Unfortunately by writing 8*1024*1024 and opening the memory via USB I can see only 8MB free space (by right clicking on the U: disk and selecting proprities). And by putting 64*1024*1024 I can see 64Mb.

    How I have to do to see 256Mb free space inside the proprieties?

    Best regards.

  • I think we might be confusing MB and Mb. I thought you meant Mega-bit (one eighth of a MegaByte) when writing Mb. So if your external flash is 256 MegaByte, you would have to set .size =256*1024*1024.

    Best regards,

    Simon

Reply
  • I think we might be confusing MB and Mb. I thought you meant Mega-bit (one eighth of a MegaByte) when writing Mb. So if your external flash is 256 MegaByte, you would have to set .size =256*1024*1024.

    Best regards,

    Simon

Children
  • 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.