ISP function in remote RS485 communication network
After the initial development of MCU application software is completed, the program is typically burned into the MCU's ROM or EPROM using a programmer. This process requires removing the chip from the circuit board, which is inconvenient for both development and future software updates. As new generations of microcontrollers emerged, those with In-System Programming (ISP) capabilities became increasingly popular among embedded system developers. The use of ISP has grown significantly, as it allows programming and reprogramming without physically removing the chip from the board. One of the early examples of such a high-performance processor is the Philips 89LPC932.
ISP (In-System Programming) refers to the ability to program a device while it remains on the circuit board, eliminating the need to remove it. This makes it easier to update firmware, debug, and maintain systems. The 89LPC932 includes an ISP function that can be accessed through a communication interface, making it ideal for applications requiring remote or in-field updates.
To understand how the ISP function works, we decompiled the Boot ROM source code of the 89LPC932 into an assembly file. By analyzing the data processing and communication control mechanisms, we gained insight into the implementation of the ISP function. We then modified the code to suit our specific needs, particularly for use in an RS485 communication network, where stability and reliability are crucial.
### Analysis of Some Code in the Boot ROM
Here, we focus on the communication part of the Boot ROM code.
#### 1.1 Determination and Verification of Automatic Baud Rate
The host computer sends an uppercase English character "U" to the lower device at its own baud rate. The ASCII value of "U" is 55H, which corresponds to the binary pattern "01010101B". This sequence of 0s and 1s is used to determine the communication speed.
When the lower device receives this data, it calculates the time interval between two consecutive 1s, which helps in determining the actual baud rate. Once the baud rate is calculated, the serial port is adjusted accordingly. The device then sends and receives a byte, comparing the received data with the expected ASCII value of "U". If they match, the program continues; otherwise, it loops and waits for another attempt.
This mechanism ensures reliable communication, but it also requires that the host sends at least two "U" characters to guarantee successful detection.
Below is a snippet of the assembly code responsible for this process:
```
EXECHO.
RET ; return
```
This simple routine demonstrates how the system handles incoming data and verifies the baud rate before proceeding with further communication.
Hdg And Painted Radiator,Weather Proof Hdg And Painted Radiator,Weather Proof Hdg Radiator With Coating,Leak Free Hdg And Painted Radiator
Shenyang Tiantong Electricity Co., Ltd. , https://www.ttradiator.com