Part Number: MSPM33C321A
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG
1. Background
- For bank swap, what really swapped is the address of bank0 and bank1. However for MSPM33C321A, not only MAIN FLASH but also NONMAIN FLASH will swap the address.
- Every time power up(BOOTRST or higher level reset), ROM code configures the device(like debug port config and so on) based on the user's setting in NONMAIN FLASH(0x80101800 and 0x80101c00), however bank swap happens after CSC INITDONE set. So when device execute ROM code, bank swap has not happened (bank swap is reset by BOOTRST). If the value in Nonmain FLASH is all 0xFF, then device will be stuck in ROM code without debug port enable, which means permanent lock(cannot recover).
- Current CCS/UNIFLASH(flash loader provided by TI) erase/program M33 FLASH based on logical address, no matter bank swap happens or not.
- For example, if user program data to address 0x00000000, if bank is not swapped, data is programmed to bank0. However if bank is swapped, then data is programmed to bank1.
| Before bank swapped | After bank swapped | |
| Nonmain FLASH |
BCR - 0x80101800 BSL - 0x080101c00 |
BCR - 0x80103800 BSL - 0x080103c00 |
| Nonmain FLASH backup |
BCR backup - 0x80103800 BSL backup - 0x080103c00 |
BCR backup - 0x80101800 BSL backup - 0x080101c00 |
| Main FLASH bank0 | 0x00000000-0x0007FFFF | 0x00080000-0x000FFFFF |
| Main FLASH bank1 | 0x00080000-0x000FFFFF | 0x00000000-0x0007FFFF |
2. Phenomenon
When user try to program firmware with bank swap function (CSC or bank swap example). In general, user need to erase and program MAIN and NONMAIN FLASH.
- In first programming everything works well and user can observe bank swap happened, however in second programming and reset, device is locked and cannot debug then.
3. Root cause
- For first time programming and free run, everything is good with bank swap occurred.
- When start second programming, CPU is still running at APP with bank swapped. So an erase will be applied on both Nonmain FLASH and Nonmain FLASH backup. Then new NM value is written to 0x80101800 and 0x80101c00(logical address). However because of bank swap, new value is actually written to Nonmain FLASH backup, and Nonmain FLASH is still all 0xFF.
- After re-powered, ROM will check Nonmain FLASH and find all 0xFF. Then device is locked without recover method.
4. Workaround
When reprogram NONMAIN, put same new value at both Nonmain FLASH and Nonmain FLASH backup.
- Put same BCR value at 0x80101800 and 0x80103800
- Put same BSL value at 0x80101c00 and 0x80103c00
Then no matter bank swap happens or not, new value will always be programmed to Nonmain FLASH.
Steps to generate standalone NM file:
- Configure NM in sysconfig, generate new boot_config.c/h
- After compiling, generating bin file or txt file.
- For bin file, delete other code manually and leave NM data alone .
- Erase NM and program bin file to both (0x80101800, 0x80101c00) and (0x80103800, 0x80103c00).
- For txt file, copy and paste Nonmain FLASH(0x80101800, 0x80101c00) value manually, and change its address to (0x80103800, 0x80103c00).
- Erase NM and program txt file.
- Hex file should be similar to txt file.
5. Furthermore
TI plans to update the tool to better resolve the issue in the future.
- Schedule - TBD