cancel
Showing results for 
Search instead for 
Did you mean: 

OTG_FS Rx Interrupt disabled while erasing or writing the flash

linge
Associate
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!

1 REPLY 1
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 Up vote any posts that you find helpful, it shows what's working..