2012-07-05 09:59 AM
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!2012-07-05 11:59 AM
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.