MB96F646RB Bootloader

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
anfic_4136416
Level 1
Level 1
First question asked

Hi,

I'm trying to write a bootloader to run on the MB96F646RB microcontroller. I will be uploading the bootloader into RAM using the serial communication mode, and then running it with the serial RUN command. The goal is to have the bootloader manipulate the flash memory on the device (erase, program, etc). I'm using this template as my starting point: https://www.cypress.com/documentation/software-and-drivers/mb96640-series-template-projects

What modifications should I make to the template to have my program run as a bootloader rather than a normal program being uploaded to flash? Below is what I have tried so far.

I've written a small test program that changes a GPIO pin and transmits/receives on one of the UART ports. This code works as expected if I use a programming tool to program it into flash memory and run like normal. But, I'm running into problems when I try to send the program via the serial communication mode and run it in RAM. Through the Project Setup menu in Softune Workbench, I set up the linker so that the CODE_START and CODE_main sections are located in _INRAM01. That seems to get my program code mapped to RAM instead of flash. But, when I try to run the code via the serial communication mode, it doesn't work as expected.

The GPIO pin that I was able to set before doesn't change at all. The UART transmit still seems to work; the code transmits what I have told it to. The UART receive does not seem to work. I set up my program to transmit one thing if the received byte is 0x31, and another byte if it is different. My bootloader only transmits the latter, as if the received byte never matches 0x31, even when I do send 0x31.

Also, the UART baud rate is very different when run as a bootloader. I have an 8MHz external oscillator and changed the following line in start.asm accordingly:

     #set      CRYSTAL         FREQ_8MHZ

I am using the following clock setting:

     #set      CLOCK_SPEED     CPU_32MHZ_CLKP1_32MHZ_CLKP2_16MHZ

I have set up my UART Baud Rate Generator (BGR) register to 1665 to obtain a baud rate of 19200 bits/s as recommended in Table 19-11 of the MB96600 Hardware Manual. This does achieve the desired baud rate when my program is run from flash, but the baud rate is much lower when run as a bootloader in RAM. To get a baud rate of 19200 for my bootloader, I found that I need to set the BGR to 97. I'm guessing this is because there is some clock setup that I am missing, but I don't know where.

Any help would be appreciated.

Thank you

0 Likes
1 Solution
HongyanW_86
Moderator
Moderator
Moderator
100 solutions authored 100 replies posted 50 solutions authored

Hello,

Please kindly check if the following bootloader uart (async) example code can meet your requirement:

https://www.cypress.com/documentation/software-and-drivers/96380-bootloader-uart-async-v10

Best regards,

Amy Wang

View solution in original post

0 Likes
1 Reply
HongyanW_86
Moderator
Moderator
Moderator
100 solutions authored 100 replies posted 50 solutions authored

Hello,

Please kindly check if the following bootloader uart (async) example code can meet your requirement:

https://www.cypress.com/documentation/software-and-drivers/96380-bootloader-uart-async-v10

Best regards,

Amy Wang

0 Likes