9S08AC128 FLASH In-Circuit Programming

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

9S08AC128 FLASH In-Circuit Programming

664 Views
LDAA_STAB
Contributor I

1. Working Flash programming functions on 9S08AW60 migrated to 9S08AC128. 

2. Erase and Programming functions not working on AC128. 

3. No errors returned when byte programming or segment erase functionis run. 

4. Byte programming does not program bytes.  Returns function complete and no errors.  

5. Migration included checking and changing FDIV clock rate. FCDIV = 0x4C;  /* 19,660,800 Hz /{8 * (12+1)} = 189.03 Hz   */ 

6. Block protection:  const unsigned char NVPROT_INIT @0x0000FFBD = 0x43; /* Protects Flash from 0xC000-0xFFFF */
/* 0x01 - sets the protection range as spec'd by the FPC bits */ 

7. Flash command handler function is relocated from Flash to RAM when Flash command function used.

8. "walking the code" with P&E debug pod indicates no problems. Code relocates and runs out of RAM as expected.

 

Any help would be appreciated!

Thanks.

Labels (1)
0 Kudos
4 Replies

335 Views
bigmac
Specialist III

Hello Wm.B.,

 

Have you taken into account the 'AC128 device contains a MMU module, whereas the 'AW60 device does not.  This means that, if you are programming flash within the paging window range (0x8000 to 0xBFFF), the PPAGE register needs to be correctly set so that the required memory page is visible when writing to the flash memory address.  For a similar flash memory range as the 'AW60, where the flash memory range corresponds to the paging window range, the PPAGE register setting of 2 would be required.

 

I also notice that the 'AC128 has two flash arrays, with a separate array for the extended memory.  The FPROT_FPS setting now protects both arrays, with the extended flash range first becoming unprotected, followed by the normal flash array, as the setting is increased..  For a FPROT setting of 0x43, the 'AC128 Reference Manual (Table 4.19) indicates protection ranges of 0x01000 to 0x0FFFF, and 0x1FC00 to 0x1FFFF.  This seems a little more protection than you had originally intended.

 

As a consequence of the two flash arrays, it is also possible to run the flash programming code from a different array than the array being programmed, and access to the flash based code will be maintained during erase and programming operations.  This would avoid the need to use the more complex RAM based code.

 

Regards,

Mac

 

0 Kudos

335 Views
LDAA_STAB
Contributor I

Hi Big MAc,

 

I am attempting to map the AW60 code directly into the AC128 so there are no plans (at present) to touch PPAGE.  I have checked PPAGE and found 0x02 after reset and have not changed it.  If I am intrepetting the memory map figures correctly then there is Flash from 0x2000 to 0x7FFF and 0xC000 to 0XFFFF and the window to the expansion memory at 0x8000 to 0xDFFF.  

 

When setting NV_FPROT I selected the range 0x0C00 through 0xFFFF, bits [7:1] define the protection range and bit[0] (FPOPEN) which would be 0x01 for a value of 0x43.....

 

Except... just looking back at table 4.19 I see my eyes played a trick.  The 0x42 protection range is 0x0C00 to 0xFFFF  NOT 0xC000 to 0xFFFF.  This is the bug then.  Aging eyesight!  Okay, make that register change and try again 8-)

 

MAc, you just confirmed my thoughts about multiple Flash arrays.  With some prudent programming the ROM to RAM movements and execution from RAM can now disappear.  Thanks for confirming that!

 

One more:  is it your opinion that the Flash is electrically/physically divided into 8 each 16K blocks or two 32K blocks?

 

Best Regards,

BillB

0 Kudos

335 Views
bigmac
Specialist III

Hello Bill B.,

 

I suggest that you specifically refer to the Reference Manual for the 'AC128.  The flash memory protection arrangement is a little different than the 'AW60 - the protection boundary moves in 1024 byte increments, rather than 512 byte increments.  I have previously referred to Table 4.19 of the 'AC128 Reference Manual, which gives examples of the protection range, including a protection value of 0x43.

 

The same table also confirms the the presence and range of the two flash arrays.  The address range of the second array is 0x10000 to 0x1FFFF, within the extended paged memory.  Code access within this array must utilize the appropriate PPAGE setting, and paging window address.

 

Since code access requires a specific, non-default PPAGE setting, programming a specific value to an address within the range 0x8000 to 0xBFFF cannot also be done via the paging window.  The alternative is to make use of the LAP register for the write process.

 

Regards,

Mac

 

0 Kudos

335 Views
LDAA_STAB
Contributor I

Perhaps I was not clear.  I have read (and thought I understood) the memory section of MC9S08AC128/AC96 Reference Manual, Memory, Sections 4.1 - 4.5.  The erasure and protection issues mentioned earlier have been solved.

Thanks for your assistance.

0 Kudos