AnsweredAssumed Answered

KBOOT LPUART baudrate estimation error?

Question asked by Jef Daems on Jan 20, 2017
Latest reply on Jan 22, 2017 by Jef Daems

Dear all,

 

I'm using an MKL17Z128V chip that's built into a sealed enclosure. It can be accessed via LPUART0, and I want to update the firmware using the KinetisFlashTool. When trying to update the flash, the tool attempts to send a ping message to detect the bootloader first. The user code will detect this ping message and enter the bootloader as described in the reference manual:

uint32_t runBootloaderAddress;
void (*runBootloader)(void * arg);
runBootloaderAddress = **(uint32_t **)(0x1c00001c);
runBootloader = (void (*)(void * arg))runBootloaderAddress;
runBootloader(NULL);

The flash tool will of course display that the first ping attempt fails, but should work on the second attempt. The bootloader is successfully executed and attempts to respond to the incoming ping message. The following image shows what happens on the TX and RX lines on the second ping attempt:

The baudrate is configured to be 9600 baud. The ping messages are sent at almost exactly this rate, but the response is sent at a lower rate, in this case 9070 baud. As a result, framing errors occur and the flash tool displays the "Connect device failed" error for each attempt. This happens for every standard baudrate I tried to configure (9600, 19200, 38400, 57600).

 

After some experimenting, I managed to get everything to work as expected by setting the baudrate in the flash tool to 9070 (and reconfiguring baudrate in user code as well). The baudrate of the microcontroller is 8600 baud in this case. Again too low, but this does not seem to create framing errors.

 

Is there any apparent reason why the baudrate estimation fails in this situation? I currently do not write anything to the BCA, so the bootloader works in its default configuration.

 

Thank you!

 

Jef Daems

Outcomes