I have a problem for writing data on internal flash of at91sam7s256. I use GNU compiler and sample code of Atmel for mass storage device (msd).
In framework “AT91 USB Framework - Core 1.02 + MSD 1.0”, there are functions FLA_Init, FLA_Read and FLA_Write that I used (media_flash.c).
I also made the the corresponding initializations, but my code hangs in FLA_WritePage. I though its because of running code in flash (It is said that the code should run in ram when writing on flash in Atmel document “USB Mass Storage Device Driver Implementation”) so I used attribute ((section (“data”))) for putting the write functions in ram. My code still hangs in FLA_WritePage in the following instruction.
SET(pFlash->FLA_FCR,
AT91C_MC_CORRECT_KEY
| AT91C_MC_FCMD_START_PROG
| ((dPage << 8) & AT91C_MC_PAGEN));
Any suggestion for writing on flash?
Thanks,
Alireza