Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/21/09 17:05
Modified:
  05/21/09 17:13

Read: times


 
#165533 - MSC1210 FlashCode Memory write problems
Anybody got any experience with writing to Flash Code Memory in User Application Mode?
I'm trying to write code to upgrade firmware in the field, but am unable to successfully overwrite more than just a few pages of new firmware into the MSC1210 flash code memory.

I've written successfully to the Flash data memory (but only actually needed to write 2 or 3 pages), and am aware of the problems with running code from flash whilst writing to it so I'm using the BootRom routines.

I'm trying to write 8k of new code over the first 8k of code space. I've made sure that my code to do this is high up in memory - around 24k - it's written C (Keil) and I've looked at the generated assembler to make sure no calls to any "helper" routines elsewhere are getting called (other than the routines in the bootrom of course). my code is something like:

for (i = 0; i < 64; i++) //64 pages in total in 8k
{
address = i * 128;
src = &xMem.Code[address];
if (page_erase(address, 0, FPM) == 0)
{
for (j = 0; j < 128; j++)
{
hex = *src++;
write_flash_chk(address, hex, FPM);
address++;
}
}
}


Its a simple loop to write 64 pages, each page 128 bytes 1 byte at a time.
It mostly gives up the ghost at around page 10 or 11 -occasionally it will write 17 or 18 pages.

If I make the outer loop (i = 30; i < 32; i++) it writes those page ok, so It doesn't seem to be an addressing problem.
I've played around with lots of different values in the FTCON (flash timeing control) register with no better success.

Anybody got any ideas?







List of 10 messages in thread
TopicAuthorDate
MSC1210 FlashCode Memory write problems            01/01/70 00:00      
   watchdog, interrupts?            01/01/70 00:00      
      MSC1210 FlashCode Memory write problems            01/01/70 00:00      
   I do not know your chip, but            01/01/70 00:00      
      Over optimisation.            01/01/70 00:00      
         case for asm            01/01/70 00:00      
            asm in Keil is not accepted very well            01/01/70 00:00      
               to asm or not to asm            01/01/70 00:00      
                  Horses for courses.            01/01/70 00:00      
                  Not that it applies to THIS case ... but ...            01/01/70 00:00      

Back to Subject List