AnsweredAssumed Answered

Image Selection on JN5169

Question asked by Matt Ferrari on Sep 30, 2019
Latest reply on Oct 2, 2019 by Matt Ferrari

I am coding a firmware update utility for the JN5169 and have a question about invalidating a resident code image in flash.

My initial code image is running fine, based at Segment 0 (Flash Address 0x00080000).  I am also able to make a copy of it and base the copy at the beginning of Segment 8 (Flash Address 0x000C0000) - I can see it there in memory via the IDE. So far so good.

 

Now, I want to invalidate the first image at Flash Address 0x00080000 so that upon restart, the JN5169's bootloader will find the first valid BIR at 0x000C0000 and then remap and use the new image.

 

Page 7 of JN-AN-1003 says: "One method to achieve this is to program the Status field byte (of the BIR) to 0x00, which will mark the image as invalid".  But since the BIR (the first entry in the Flash Header) is in FLASH, you can't just write to a single byte.  You have to first erase the entire sector, then write in blocks of 16-Byte "pagewords".

 

JN-UG-3087 Page-127 suggests reading the entire flash sector into RAM, then erasing the flash sector, then change the desired byte in RAM and then write the sector from RAM back into the flash sector.  But the JN5169 Flash Sector is 32k Bytes - there is not enough RAM available to actually do this!

 

I have tried invalidating the initial image at Sector 0 by simply erasing all of  Sector 0, then looping in a while(1) waiting for the Watchdog to reset, with the hopes that after reset, the bootloader will then find the valid BIR based at flash sector 8 and remap and run ithe code image based there, but this does not work. 

 

Can anyone advise on how to invalidate the image based at Sector 0 and make the bootloader then find and run the new image which is based at Sector 8?

 

Thanks,  Matt

Outcomes