1016 views|0 replies

6593

Posts

0

Resources
The OP
 

What are the methods for upgrading the msp430 microcontroller program? [Copy link]

I am working on the custom method (using the serial port) to program the FLASH of 430. After the program is completed, the power is turned off and reset, and the reset button can run the new program. However, after discussing with my senior, this method is not good enough, and I hope there is a soft reset method. So I searched on Baidu and found that there are some methods to write special values to the watchdog to reset the CPU of 430. Anyway, I personally did not use it.
  

  Since I was working on downloading and burning programs, I looked at the BSL of the 430. I saw a paragraph in it about how to start the BSL from C code. It is as follows:
  Starting the BSL from an external application
  Set the program counter to the memory location 0x1000 to start the BSL. The stack is always reset and the RAM is cleared. It should be noted that the GIE bit is not disabled, so if interrupts are not needed, this step should be completed by calling the application, and if they are used, this step should be returned from "Return to BSL".
  Since the stack is reset, the location 0x1000 can also be called as a C function, and the sample code is as follows:
  ((void (*) ()) 0x1000) ()
  So I thought, since it is possible to jump to 0x1000 from C, it is also possible to jump to other addresses, such as the reset address.
  Take the 6638 as an example. The reset interrupt vector address of the 430 is 0xFFFE, which stores the physical address to jump to. The starting address of the code area of 6638 is 0x8000. Normal reset is to enter the reset interrupt first, then the PC pointer is imported to the address 0x8000, and then the code is executed from 0x8000. Then the soft reset is to execute ((void (*) ()) 0x8000) (), and the PC pointer is directly imported to the address of 0x8000, which is exactly the starting address of the code area of 6638, so it is soft reset. I will analyze this instruction personally. If there is any error, please correct me.
  From the code point of view, (void (*) () is a pointer to a null function, ((void (*) ()) 0x8000) () is to force 0x8000 to be converted into a function pointer and then call the function, so 0x8000 is sent to the PC pointer.
  For other 430 chips, check the FLASH section of its data manual to find out the starting address of its code area, and you can also use this method to soft reset.
  Actual measurement, compiled under IAR, CCS, and passed in practice.

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list