S12ZVL32 Bootloader

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

S12ZVL32 Bootloader

Jump to solution
1,143 Views
priyagupta
Contributor II

Hi,

   I successfully implemented the SCI bootloader for S12ZVL32 MCU.

But, I have few questions:

1. S12Z MagniV Serial Bootloader PC Application does not respond for baud rate other than 19200. But, i wanted to work on higher baud rate.

2. MCU reset is required everytime, before bootloading the updated application. As, Bootloader section is executed only after reset. Is there any way to connect bootloader as well to application code (like some SCI Interrupt etc.., so that no need to reset the MCU again and again while uploading application).

 

Thanks..!!!

Labels (1)
Tags (1)
0 Kudos
1 Solution
775 Views
RadekS
NXP Employee
NXP Employee

Hi Priya,

The speed of MagniV_Serial_Bootloader_Interface is limited mainly by 200ms periodic task for sending data to MCU.

In attachment is updated version of this software from application engineer.

 

The possibility to change the target baud rate was added. However, some changes need to be made in the code warrior project to be able to simply modify the baud rate of the SCI module.

Attached example project is modified that makes the change of baudrate easier. In the comms.h file you will find a macro that contains the baud rate value.

#define BAUDRATE 115200

 

By changing this value, it changes the SCI baudrate configuration. In the comms.c you will find another macro that is the one that converts from an understandable value to the one that should be loaded in the register.

#define BAUD_VALUE 32000000/BAUDRATE

 

The 32000000 value represents the bus clock. The BAUD_VALUE is the one that is being loaded into the register.

 

According to application engineer measurements, the previously version it lasted about 8 minutes to load an 80Kb program, now it last 40 seconds.

 

Let me know if you have any troubles running the interface.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

4 Replies
775 Views
RadekS
NXP Employee
NXP Employee

Hi Priya,

1. The AN4723 bootloader Comms.c file contains code for initiate SCI1 with BaudRate = 19200. If you want to communicate at different baud rate, please edit SCI1BDH and SCI1BDL values.

Divider = bus clock/baud rate … e.g. 0x683=1667=32MHz/19200bps.

Note: The maximum error given by rounding to prescaler integer number should be below approximately 2% for keeping communication stable.

2. Yes, that is possible the same way as you jump from bootloader to application. However, this solution is quite limited by additional overhead. There are two basic potential issues:

a)The registers should be reverted into their default states prior that application/bootloader switch. So, your application must contain code also for de-initialize MCU modules and registers. Since this is part of the application, there is considerable chance that any small mistake in application software version may block this functionality – which is quite a criticalb)The second potential issue relates to the first, but from a hardware point of view. Some of MCU registers/bits may be written just once. So, we cannot change some of the configurationsThat implies that either bootloader code has to be prepared for all options and configuration combinations or that bootloader has to be updated the same way as an application. In that case, we must keep a list of allowed combinations of bootloader and application versions.

b)The second potential issue relates to the first, but from a hardware point of view. Some of MCU registers/bits may be written just once. So, we cannot change some of the configurationsThat implies that either bootloader code has to be prepared for all options and configuration combinations or that bootloader has to be updated the same way as an application. In that case, we must keep a list of allowed combinations of bootloader and application versions.

The AN4723 bootloader is quite simple code which strictly does not configure write-once registers. The more robust bootloader solution should jump between bootloader and application also through MCU reset.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
775 Views
priyagupta
Contributor II

Hi Radek,

   Thanks for reply...!! 

For changing the baud rate, i already tried modifying the SCI1BDH and SCI1BDL values. While testing on HyperTerminal it works fine, but S12Z_MagniV_Serial_Bootloader_Interface[PC Interface to bootload application] doesn't respond to the modified baudrate[except 19200].

I looked into the "S12Z_MagniV_Serial_Bootloader_Interface.jar" file & found that in "S12Z_MagniV_Serial_Bootloader_Interface$SERIAL_Sender.class" file, for Serial Communication baud rate is set as 19200.[Line 75, attached .java file snapshot]Serial_Sender.png

I also tried, to compile the file in eclipse[attaching the original .jar files] but didn't make out successfully. Could you please help me out with the modifications?

0 Kudos
776 Views
RadekS
NXP Employee
NXP Employee

Hi Priya,

The speed of MagniV_Serial_Bootloader_Interface is limited mainly by 200ms periodic task for sending data to MCU.

In attachment is updated version of this software from application engineer.

 

The possibility to change the target baud rate was added. However, some changes need to be made in the code warrior project to be able to simply modify the baud rate of the SCI module.

Attached example project is modified that makes the change of baudrate easier. In the comms.h file you will find a macro that contains the baud rate value.

#define BAUDRATE 115200

 

By changing this value, it changes the SCI baudrate configuration. In the comms.c you will find another macro that is the one that converts from an understandable value to the one that should be loaded in the register.

#define BAUD_VALUE 32000000/BAUDRATE

 

The 32000000 value represents the bus clock. The BAUD_VALUE is the one that is being loaded into the register.

 

According to application engineer measurements, the previously version it lasted about 8 minutes to load an 80Kb program, now it last 40 seconds.

 

Let me know if you have any troubles running the interface.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

775 Views
priyagupta
Contributor II

Hi Radek,

      The attached new S12_MagniV_Bootloader_Interface PC application is working.

                 I am able to flash application with modified baudrate.

Thank you so much for your support...!!

0 Kudos