Skip to main content
linge
Visitor II
July 5, 2012
Question

OTG_FS Rx Interrupt disabled while erasing or writing the flash

  • July 5, 2012
  • 1 reply
  • 493 views
Posted on July 05, 2012 at 18:59

Hi Everyone,

I'm writing a program that receives data from the USB and writes data into the flash. The program also resides in flash.

Before each erase and write operation, the USB is NACKed because the flash erase/write operation disables all the interrupt. After the flash erase/write operation, the NACK is removed. 

But the problem is that after the NACK is removed and the USB interrupt is reenabled, the data that NACKed is lost. 

Is it possible to NACK USB data during flash erase/write operation? Is the program supposed to be put in SRAM to avoid flash read operation during flash erase/write?

Any suggestions?

Thanks!

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    July 5, 2012
    Posted on July 05, 2012 at 20:59

    Yes you will need to place all code, interrupts, vectors, etc into SRAM to avoid the processor stalling. You must not try to read FLASH while an erase or write is in progress, as it will stall the processor. Depending on the part/sector this may be several seconds, which is clearly fatal to any peripheral which expects timely servicing.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..