Why does my 5566 bootloader fail if power cycled?

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why does my 5566 bootloader fail if power cycled?

Contributor I

I have an application running on a 5566 processor that will reset the processor into the flexcan bootload mode if it receives a specific CAN message. The application clears the RCHW and performs a soft reset.

At this point, I can use the BAM process to send a bootloader over CAN, then the 5566 will then start running that program which periodically sends out CAN messages.

If I power off the 5566 while loading the bootloader image, then power back on, the 5566 is still using BAM and accepting images. I can go through the entire protocol of loading the same bootloader over CAN, but at the end, I never see any CAN messages from my bootloader. 


Why would the BAM process work when an application put it into BAM using a soft reset, but it does not work when I perform a hard power cycle?

Labels (1)
Tags (3)
0 Kudos
2 Replies

Contributor I

Problem appears to be that my bootloader application is using SRAM outside of what is specified in the image.

In the soft reset, this is probably okay because the SRAM is still initialized from the flash image that was running. But after a hard power cycle, nothing was initializing the SRAM.

I couldn't figure out how to get Codewarrior to initialize all of SRAM, so I ended up padding my image to 128,000 bytes before sending to BAM. Once I did that, the bootloader runs and sends out CAN messages even when loaded after a power cycle.

0 Kudos

NXP TechSupport
NXP TechSupport

Hi Ryan,

when creating RAM project in CodeWarrior, startup file doesn’t initialize the RAM. The reason is that it would overwrite the code in RAM. In case of RAM projects, it’s responsibility of debugger to initialize the RAM before loading RAM image.

When using this RAM project to develop RAM image to be downloaded by BAM, there are two options:

  1. RAM is initialized by BAM when loading the image. But only up to size of the image. So, if you want to use RAM outside of this image, it is possible to pad the image. The disadvantage is that it will take much more time to load all the data.
  2. Second option is to initialize the rest of the RAM by your code. The code below can be found in startup files in CodeWarrior project. Start address and size need to be updated accordingly.


/* MPC5566 L2SRAM initialization code                         */

    lis r11,L2SRAM_LOCATION@h /* Base address of the L2SRAM, 64-bit word aligned */

    ori r11,r11,L2SRAM_LOCATION@l


    li r12,1024                /* Loop counter to get all of L2SRAM; 128k/4 bytes/32 GPRs = 1024 */

    mtctr r12



        stmw r0,0(r11)        /* Write all 32 GPRs to L2SRAM */

        addi r11,r11,128      /* Inc the ram ptr; 32 GPRs * 4 bytes = 128 */

        bdnz init_l2sram_loop /* Loop for all L2SRAM */




0 Kudos