Hello Freescale Community,
I am new in this forum and appologise if this question has already been answered.
The customer support told me to write my questions in this forum so here I am.
I have finished programming the Freescale MKL02Z32VFM4 processor and also set up the Rx/Tx axynchronous serial communication with the main CPU (continous transfer and not Master / Slave).
In future we would like to be able to flash the KL02 MCU using the the main CPU.
Is it possible to flash the KL02-CPU using the same UART connection? Or do we need a second UART connection? Is it possible at all?
What is the flash procedure in general? Do we have to modify the internal programm when a flash command is set in motion or does it stop automatically etc..
Basically, all the information to implement a working flash procedure.
I thank everyone in advance who can help me.
Edward.
Hi, Edward
Yes, you no need to use another UART channel.
The general process as below.
Main MCU send change flash command -> KL02 write a fixed byte a special value -> software reset -> enter bootloader mode -> program flash -> change that fixed byte to 0x00 -> software reset -> normal run mode -> UART communication.
Hope my reply can help you.
Best Regards
Paul
Hi, Paul.
Thank you for your answer. I did not have the time to answer you recently.
Sadly it does not help me a noob like me at all. Therfore I have lots of open questions for (I apologise in advance!).
Main MCU send change flash command: - No problem there.
KL02 write a fixed byte a special value:
- what is the "fixed byte"?
- what is meant by special value and write it where?
Software Reset:
- I have been trying to figure this out but do not know which register I have to write so the SYSRESETREQ is set ... ?
Enter Bootloader mode:
- How can I enter this mode?
I am very sorry for all the questions, but I have to start from scratch.
Regards,
Edward.
Hi, Edward
Please see my comment below.
KL02 write a fixed byte a special value:
- what is the "fixed byte"?
I think you can set to 0xAA
- what is meant by special value and write it where?
One byte in flash where you do not place any code or other data.
Software Reset:
- I have been trying to figure this out but do not know which register I have to write so the SYSRESETREQ is set ... ?
You can reference following code.
#define NVIC_SystemReset()
{
SCB_AIRCR = SCB_AIRCR_VECTKEY(0x5FA)| SCB_AIRCR_SYSRESETREQ_MASK;
while(1);
}
Enter Bootloader mode:
- How can I enter this mode?
You can reference this application note. http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2295.pdf
Hope my reply can help you.
Best Regards
Paul
Hello Paul,
Thank you for your very quick response.
I hope I can take a look at your advices. I still have 3 other projects which I am working at.
Have a nice week,
Edward.
Hi, Edward
OK. No problem. Any questions, we can discuss in community.
Best Regards
Paul