I'm working with CW4.6 and both HCS12A128 and HCS12A256. The project was started with 128 and then because we have stock of 256 MCU's we decided to use them.
My doubt is how can the firmware enter bootloader (bootloading?) mode itself? I mean, normally bootloader is entered by an external action like a switch, but what I want is to send a string via SCI and so the program enters bootlaoder anytime I want it to. This said, my first thought was to JUMP to bootloader address (in my case 0xF0C0) when the string arrives but I don't know how the MCU will behave, or if there would be a problem with other registers configuration (remember the code was in normal execution before entering bootloading mode).
Then I thought on writing EEPROM and reseting the equipment. Then the bootloder will read this EEPROM address and if it founds an special code, enters bootloading mode. This was working great with 128 but it hangs with 256.
The problem with the 256 MCU is kind of rare... Let's assume I download the code via BDM and left it connected to the board. If I send this special string via SCI, the EEPROM is written and if I hit the reset button on HiWave and then RUN again the code, it works fine and enters BOOTLOADING MODE. But if I reset the MCU by a switch connected to RESET line instead of hitting HiWave button, then when it startup again, it hagns and I don't have a clue about why's that and I cannot debug it because if I debug it, it works ok. (The only thing I know is that this problem is related to INITRM register because the main firmware has a value for it, the bootloader another one; and if I don't touch this it runs ok but cannot enter bootloader)
Do you know about any other method for entering bootloaing mode?
Or if you think is safe to just JUMP to bootloader address, that's ok with me and work.
Thanks as always, I hope someone can help me out