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!
-----------------------------------------------------------------------------------------------------------------------