Serial boot mode example?

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial boot mode example?

886 Views
kenwoodruff
Contributor II

Is there an example for downloading code through the serial port, then booting from that code? I'm not looking for a memory resident bootloader, but for downloading and executing code. thanks

0 Kudos
5 Replies

594 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

you didn't mention which MCU you have.

There's Rappid bootloader, for example which supports many MPC5 devices:

RAppID Boot Loader Utility 

Regards,

Lukas

0 Kudos

594 Views
kenwoodruff
Contributor II

Lukas, 

I'm still having issues getting serial boot mode to work on a MPC5605B device. When I write a very small piece of code, the RAppID BL Tool works fine, but anything over about 10K of code causes the boot loader to hang and time out before loading finishes. I thought I'd just write my own bootloader, but I seem to be missing some information. The protocol described in the RM doesn't match what is displayed in RAppID BL Tool's trace window.

 

From the Reference Manual:

Table 5-8. UART boot mode download protocol
Protocol
step         Host sent message      BAM response      message      Action
1        64-bit password(MSB first)  64-bit password                Password checked for validity and compared against
                                                                                               stored password.
2       32-bit store address          32-bit store address             Load address is stored for future use.
3       VLE bit + 31-bit number of bytes(MSB first)
                                                   VLE bit + 31-bit number of bytes (MSB first)

                                                                                                 Size of download are stored for future use.

                                                                                                  Verify if VLE bit is set to 1
4       8 bits of raw binary data   8 bits of raw binary data      8-bit data are packed into a 32-bit word. This word is
                                                                                              saved into SRAM starting from the “Load address”.

                                                                                              “Load address” increments until the number of data
                                                                                               received and stored matches the size as specified in the
                                                                                               previous step.
5       None                               None                                       Branch to downloaded code

 

RAppID BL doesn't have an option to simply program SRAM. Erase and Program is the only option for loading code into the processor. Skipping past the section that's doing "BTL"  (by the way - what's BTL?) the trace window has the following:

TX:   01 00 00 00 aa aa aa aa

RX:    ff  00 00  fe 00 00 00 00      Init

TX:   02 01 00 00 40 00 01 00

RX:    ff  00 01 fe  00 00 00 00      Erasing

TX:   10 02 00 00 02  e0 aa aa

RX:    ff  00 02 fe  00 00 00 00      Erasing

TX:     22 03 02 36 02 47 02 58   

                      ^ My code starts here and continues on the subsequent lines

RX:     ff  00 03 00 40  00 01 0C

The first two bytes transmitted appear to be some sort of header as the second byte increments with each message. What are the first two bytes that are transmitted? and what is returned isn't exactly what was transmitted.

The last messages transmitted are here:

TX: 22 56 00 00 00 00 00 00 APP 99%
TX: 22 57 00 00 00 00 00 00 APP 99%
TX: 22 58 00 00 00 00 00 00 APP 100%
TX: 22 59 00 00 00 00 00 00 APP 100%
TX: 22 5A 00 00 FF FF FF FF APP 100%
TX: 20 5B 08 40 00 01 00 AA Start Application

 

While the code for this small test program blinks an led on the evaluation board, as expected, the data transmitted, as shown in the RAppID BL trace window does not include all the zeros I added to make the code contiguous. I don't really understand that either.

When my simple program executes, it transmits the data as described in the reference manual, and the data goes across and is reflected back, but it doesn't branch to the start address once the last data byte has been transmitted. 

 

Is there a document that describes the RAppID BL tool Trace window format and what the extra bytes transmitted are about? Or is more information available than what is in the reference manual about serial boot mode? i have and have read the manual embedded in RAppID BL tool.  I'd be happy to use the RAppID tool if it didn't crash (always with a timeout error message) before it finishes loading.

Here are my questions:

1. Why does RAppID BL crash before uploading my larger files?

2. Why does the data RAppID BL transmits to the evaluation board differ from what is described in the MPC5605B Reference manual?

3. Why does my small program that loads memory (SRAM) not jump to the start address when upload is complete?  (The program runs fine when uploaded with RAppID BL or using the JTAG port.)

3. a. The data below is where the RAppID BL transitions from "BTL" to "App". Is there a document that describes what's going on here? I don't know what BTL is and there is apparently an Initiation process and an Erasing process that happens before the application begins to load. I'd like to understand what is happening here 

 TX: 00 00 00 00 BTL 99%
TX: 00 00 00 00 BTL 99%
TX: 00 00 00 00 BTL 99%
TX: 00 00 00 00 BTL 100%
TX: 01 00 00 00 AA AA AA AA
RX: FF 00 00 FE 00 00 00 00 Init
TX: 02 01 00 00 40 00 01 00
RX: FF 00 01 FE 00 00 00 00 Erasing
TX: 10 02 00 00 02 E0 AA AA
RX: FF 00 02 FE 00 00 00 00 Erasing
TX: 22 03 02 36 02 47 02 58 APP 0%
TX: 22 04 78 00 00 A7 78 00 APP 0%
TX: 22 05 01 19 18 21 06 F8 APP 0%
TX: 22 06 48 00 D0 01 2C 00 APP 1%
TX: 22 07 D1 01 78 00 00 AD APP 1%

3.b. Why does RAppID BL not transmit all of the zeros in my Motorola S-record file?

I attached the small s-record file I am using to program the device: 

I'm using an XPC56XX EVB Motherboard and an XPC560B daughtercard with an SPC5605B processor on it.

thanks,

ken

0 Kudos

594 Views
kenwoodruff
Contributor II

Couldn't figure out how to attach s-record file. :smileysad:  ken

0 Kudos

594 Views
kenwoodruff
Contributor II

MPC5605

0 Kudos

594 Views
kenwoodruff
Contributor II

Is there any documentation for the Rapid bootloader utility?

0 Kudos