Texas Instruments ' MSP430 series microcontrollers are widely used in intelligent instruments, medical electronics, consumer electronics, etc. Most MSP430 series microcontrollers have non-volatile Flash memory. There are generally two ways for users to debug or update programs in Flash: JTAG and Bootstrap Loader (BSL).
The MSP430 series microcontrollers have an integrated JTAG simulation debugging module, and the parallel port converter can be used as a low-cost JTAG hardware simulation debugging tool. However, in order to protect the user program code, the fuse inside the MSP430 microcontroller must be burned after the product development is completed, which makes it impossible for the MSP430 microcontroller to access the CPU or update the user program in the Flash through the JTAG interface. If you want to access or update the user program in the Flash again, you need to use the BSL interface. The BSL interface is also the only way to upgrade the program of the MSP430 microcontroller after the fuse is burned.
The MSP430 series microcontrollers have a boot code, namely BSL, solidified in a specific memory space when they leave the factory. This boot code can be entered by adding a specific timing on a specific pin of the microcontroller. Users can then access the internal resources of the microcontroller, such as Flash, RAM, etc., through a standard asynchronous serial port (a password verification is required for read operations). This provides a convenient way to upgrade and maintain embedded applications.
A low-cost, easy-to-use, and simple-to-operate BSL programming tool is designed and implemented using a USB-to-serial port chip and VB6.0 programming language. It can erase, program, automatically download files, sound prompts, and automatically run codes for the MSP430 series microcontrollers through the serial port. The overall design block diagram of the system is shown in Figure 1.
1 System Hardware Design
The hardware of the BSL programming tool is designed using the USB to serial port chip PL2303, which has the advantages of easy use and low design cost. PL2303 is a USB bus conversion chip produced by Prolific, which has all modem control signals such as TXD, RXD, DTR, RTS, etc., and can realize USB to 3.3 V or 5 V full-duplex serial port TTL level.
After the PL2303 chip is connected to the PC, a virtual serial port device will be generated. Using the MSComm serial port control provided by VB6.0 for programming, TXD, RXD, DTR, and RTS can be controlled to generate the required timing signals. Although the same function can be achieved using the physical serial port of the PC, not every PC has a physical serial port. The USB-to-serial port chip eliminates the limitation of the physical serial port for this programming tool and can provide power for the MSP430 microcontroller. Therefore, PL2303 is an ideal choice for mobile systems and embedded systems, and its small package can be embedded in any connector and handheld device.
This programming tool connects the DTR and RTS pins of the PL2303 chip to the RST and TCK (or TEST) pins of the MSP430 series microcontrollers. If the MSP430 microcontroller has a TEST pin, the TCK pin should be replaced by the TEST pin. TXD and RXD are the serial port sending and receiving pins, which need to be connected to the corresponding BSL pins of the MSP430 microcontroller. The receiving and sending pins of different microcontrollers are not exactly the same. The fourth pin VDD_325 of the PL2303 chip is used to determine the logic level of the control signal. The MSP430 series microcontrollers all have a 3.3 V operating voltage. Therefore, VDD_325 should be connected to 3.3 V so that TXD, RXD, DTR and RTS can generate a 3.3 V logic level. AMS1117 is used to convert 5 V voltage to 3.3 V voltage. In addition to providing voltage to VDD_325, it can also provide 3.3 V power to the external MSP430 microcontroller. The schematic diagram of the system hardware design is shown in Figure 2.
2 System Software Design
The software design of BSL programming tool is realized by VB6.0. Although the software design can be realized by using VC++, Delphi and other programming tools, choosing VB6.0 has more advantages because VB is a relatively simple event-driven programming language with low requirements for beginners. VB has a graphical user interface and rapid application development system, and the software design can be completed by using the components it provides.
2.1 Introduction to BSL Timing of MSP430 MCU
To make the MSP430 microcontroller enter the BSL reset vector, a specific timing needs to be applied to the RST and TCK (or TEST) pins of the microcontroller. After the MSP430 microcontroller receives this specific timing, the CPU program pointer (PC) points to the address 0x 0C00, which is a 1 KB ROM area (0x 0C00 ~ 0x 1000).
When the BSL program starts to execute, the TCK pin has received at least two negative jumps, and when RST jumps from low to high, TCK remains at a low level. At this time, the MSP430 microcontroller enters the BSL state; if it is an MSP430 microcontroller with a TEST pin, the TCK pin should be replaced by the TEST pin, and the TEST pin receives at least two positive jumps, and when RST jumps from low to high, TEST remains at a high level. The MSP430 microcontroller BSL startup timing is shown in Figure 3.
2.2 BSL serial communication protocol
The MSP430 microcontroller uses an internal timer to simulate serial communication timing on specific pins. The P1.1 pin of most MSP430 microcontrollers is used as the transmitter of the BSL (ie, TXD), and the P2.2 pin is used as the receiver of the BSL (ie, RXD). Different models of microcontrollers will have different timings.
The default serial port protocol of the MSP430 microcontroller is: 9600 baud rate, half-duplex mode, 1 start bit, 8 data bits (the lowest bit first), 1 even parity bit, 1 stop bit. The handshake is carried out through a confirmation character. Before sending any command, a synchronization character with a value of 80H must be sent to the BSL, which provides the BSL system time base. After the BSL receives the synchronization character, it will send a 90H character to confirm successful reception.
The commands provided by BSL to users are mainly divided into two categories: one type of commands requires a password to be executed, such as accessing the MCU Flash, RAM, and peripherals; the other type of commands can be executed without a password, such as erasing the Flash as a whole, reading the BSL version, etc. The data frame format of some BSL commands is listed in Table 1.
Among them, the 8 bytes from HDR to LH are required, xx represents any data; data D1~Dn are optional; CKL is the low bit of the checksum, CKH is the high bit of the checksum, these two bytes are required; ACK confirmation byte is not required for every command.
2.3 BSL software design
In BSL software design, several key controls in VB6.0 are mainly used, such as MSComm, CommandDialog, ComboBox, Timer, TextBox, ProgressBar, CommandButton, CheckBox and other standard controls.
The program file format downloaded by the BSL programming software is the TI company's txt plain text format. It uses "@" to indicate the start of the address, and the data content to be stored starting from the address is indicated after the address. Each line after the address is 16 bytes, each byte is represented by a hexadecimal number, and each two bytes are separated by a space. Every time an "@" character is encountered, it indicates the start of a new address, and the data content to be stored starting from the address is also indicated after the address. The file ends with a lowercase "q" character plus a line break. According to the format of the TI-txt file, you must first use the CommandDialog control to open the file to be downloaded, use a certain algorithm to separate the multiple start addresses in the entire TI-txt file and the data content corresponding to each start address, and then send them to BSL step by step through the serial port and write them to the specified address segment. The processing flow of the BSL programming software for the TI-txt file is shown in Figure 4.
To exchange data between the host computer software and the BSL of the MSP430 microcontroller through the serial port, the most critical step is to first make the MSP430 microcontroller enter the BSL state. In order to make the MSP430 microcontroller enter the BSL state, a specific timing must be applied to the RST and TCK (or TEST) pins. The required timing can be generated by using the two properties of MSComm, DTREnable and RTSEnable. The DTREnable property determines whether the DTR (Data Terminal Ready) line is used during the communication process. If DTREnable is set to True, the DTR line is used; if it is False (default), the DTR line is disabled. The RTSEnable property is similar to the DTREnable property. The RTSEnable property is used to determine whether the RTS (Request To Send) line is used. If RTSEnable is set to True, the RTS line is used; if it is False (default), the RTS line is not used. Using these two properties of MSComm, you can use the following code in VB6.0 to make the MSP430 microcontroller enter the BSL state.
Among them, the two controls DTRCheck and RTSCheck are very useful. They can invert the logic levels of DTR and RTS outputs without changing the hardware. This makes the BSL host computer software suitable for both microcontrollers with TCK pins and microcontrollers with TEST pins, greatly enhancing the flexibility of the BSL software.
It is a key step to make the MSP430 MCU enter the BSL state. After opening up this key link of the underlying communication, you can write and debug other software modules step by step. The design flow chart of the MSP430 MCU BSL programming software and the BSL programming software interface are shown in Figures 5 and 6.
Conclusion
A cost-effective BSL programming tool was designed using the USB to serial port chip PL2303 and the VB6.0 programming language. The BSL programming tool has the advantages of easy use, simple operation, and low cost. Through the USB virtual serial port, it can not only perform program upgrades on the MSP430 series microcontrollers with blown fuses, but also serve as a cheap programming tool for users to learn MSP430 microcontrollers. After repeated modifications and improvements, the BSL programming tool was applied to an actual project in a machine tool factory and was used by college students in practice innovation in many universities, achieving good results.
Previous article:Design of intelligent detection robot car based on STC single chip
Next article:CAN bus and MSP430 infrared detection system circuit
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- 【MM32 eMiniBoard Review】2b: Collection of board problems found so far and suggestions for board modification
- What are the uses of SVC and PendSV exceptions?
- MSP430F5529 IO port pin interrupt study notes
- The value of an electronics engineer
- When using RTT for recording data output, data loss is particularly serious. Does anyone know how to increase the RTT rate?
- Thank you for your company in my spare time
- NXP imx8m series product data sheet (based on Mir MYD-JX8MX)
- Serial communication between Matlab and microcontroller
- CC2640 Software Architecture
- When installing the emulator in CCS, a prompt appears saying that the bh2usb.sys file is needed. Solution