Disclosure of Invention
The application aims to provide a program burning circuit and a program burning method based on RS485, which can perform program burning without disassembling an equipment case to find a software downloading interface of a board card.
In order to solve the technical problems, the application provides a program burning circuit based on RS485, which comprises an Ethernet interface terminal, an OTA download identification circuit, an RS485 communicator and an RS485 enabling circuit;
The first pin triggered by the connection of the OTA download line in the Ethernet interface terminal is connected with the input end of the OTA download identification circuit, the output end of the OTA download identification circuit is connected with the OTA download identification signal receiving end of the processor, the data pin in the Ethernet interface terminal is connected with the slave-end data interface of the RS485 communicator, and the host-end data interface of the RS485 communicator is correspondingly connected with the data transmitting interface of the processor and the data receiving interface of the processor;
The RS485 enabling circuit is an inverter circuit, the input end of the RS485 enabling circuit is connected with the data transmission interface of the processor, and the output end of the RS485 enabling circuit is connected with the receiving enabling end of the RS485 communicator;
The OTA download identification circuit is used for outputting different levels when the Ethernet interface terminal is connected with the OTA download line and when the Ethernet interface terminal is not connected with the OTA download line, so that the processor can enable the RS485 communicator through the RS485 enabling circuit after receiving the level of the OTA download identification signal output by the OTA download identification circuit and representing the OTA download identification signal, and the RS485 communicator and the OTA download line are utilized to receive program burning signals.
Optionally, the OTA download identifying circuit specifically includes a first resistor, a second resistor, a third resistor and a first triode;
The first end of the first resistor is connected with the first pin, the second end of the first resistor is connected with the base electrode of the first triode, the collector electrode of the first triode, the second end of the second resistor is connected with the first end of the third resistor, the first end of the second resistor is connected with the first direct current power supply, the second end of the third resistor is connected with the OTA download identification signal receiving end of the processor, and the emitter electrode of the first triode is grounded.
Optionally, the system further comprises an external communication identification circuit;
The input end of the external communication identification circuit is connected with a second pin triggered by the connection of the external communication equipment in the Ethernet interface terminal, the output end of the external communication identification circuit is connected with an external communication identification signal receiving end of the processor, and the external communication identification circuit is used for outputting different levels when the Ethernet interface terminal is connected with the external communication equipment and when the Ethernet interface terminal is not connected with the external communication equipment.
Optionally, the external communication identification circuit specifically includes a fourth resistor, a fifth resistor and a first capacitor;
The first end of the fourth resistor is grounded, the second end of the fourth resistor and the first end of the fifth resistor are connected with the second pin, the second end of the fifth resistor and the first end of the first capacitor are connected with an external communication identification signal receiving end of the processor, and the second end of the first capacitor is grounded.
In order to solve the technical problem, the application also provides a program burning method based on RS485, which is based on a processor and comprises the following steps:
when the OTA download identification signal receiving end of the processor receives the level representing the OTA download identification signal output by the OTA download identification circuit, transmitting an enabling signal through the data transmitting interface of the processor by the RS485 enabling circuit to activate the receiving enabling of the RS485 communicator;
Receiving a program burning signal of an RS485 data bus through the RS485 communicator;
The OTA download identification signal receiving end of the processor is connected with the output end of the OTA download identification circuit, the input end of the OTA download identification circuit is connected with a first pin triggered by an OTA download line in an Ethernet interface terminal, a data pin in the Ethernet interface terminal is connected with a slave-end data interface of the RS485 communicator, and a host-end data interface of the RS485 communicator is correspondingly connected with a data transmitting interface of the processor and a data receiving interface of the processor;
The RS485 enabling circuit is an inverter circuit, the input end of the RS485 enabling circuit is connected with the data transmission interface of the processor, and the output end of the RS485 enabling circuit is connected with the receiving enabling end of the RS485 communicator;
The OTA download identification circuit is used for outputting different levels when the Ethernet interface terminal is connected with the OTA download line and when the Ethernet interface terminal is not connected with the OTA download line.
Optionally, the OTA download identifying circuit specifically includes a first resistor, a second resistor, a third resistor and a first triode;
The first end of the first resistor is connected with the first pin, the second end of the first resistor is connected with the base electrode of the first triode, the collector electrode of the first triode, the second end of the second resistor is connected with the first end of the third resistor, the first end of the second resistor is connected with the first direct current power supply, the second end of the third resistor is connected with the OTA download identification signal receiving end of the processor, and the emitter electrode of the first triode is grounded.
Optionally, the method further comprises:
When an external communication identification signal receiving end of the processor receives the level of the external communication identification circuit, which characterizes the Ethernet interface terminal to be accessed to external communication equipment, the RS485 communicator is controlled to enter an external communication mode;
The input end of the external communication identification circuit is connected with a second pin triggered by the connection of the external communication equipment in the Ethernet interface terminal, the output end of the external communication identification circuit is connected with an external communication identification signal receiving end of the processor, and the external communication identification circuit is used for outputting different levels when the Ethernet interface terminal is connected with the external communication equipment and when the Ethernet interface terminal is not connected with the external communication equipment.
Optionally, the external communication identification circuit specifically includes a fourth resistor, a fifth resistor and a first capacitor;
The first end of the fourth resistor is grounded, the second end of the fourth resistor and the first end of the fifth resistor are connected with the second pin, the second end of the fifth resistor and the first end of the first capacitor are connected with an external communication identification signal receiving end of the processor, and the second end of the first capacitor is grounded.
The program burning circuit based on the RS485 is characterized in that an RS485 communicator which is externally connected through an Ethernet interface terminal is adopted in the device, an OTA download identification circuit is arranged between a first pin which is triggered after the OTA download line is connected in the Ethernet interface terminal and an OTA download identification signal receiving end of a processor and is used for outputting different levels when the Ethernet interface terminal is connected with the OTA download line and outputting different levels when the Ethernet interface terminal is not connected with the OTA download line, an RS485 enabling circuit is arranged between a data transmitting interface of the processor and a receiving enabling end of the RS485 communicator, and therefore after the program burning device is connected with the Ethernet interface terminal of the device to be burned through the OTA download line, the processor of the device to be burned identifies the level of an OTA download identification signal which is output by the OTA download identification circuit, the RS485 communicator is enabled through the RS485 enabling circuit, program burning is not needed to be received through the RS485 communicator, and the program burning can be updated through the RS485 communicator.
The application also provides a program burning method based on RS485, which has the beneficial effects and is not repeated here.
Detailed Description
The core of the application is to provide a program burning circuit and a program burning method based on RS485, which can perform program burning work without disassembling an equipment case to find a software downloading interface of a board card.
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Fig. 1 is a circuit diagram of a first part of an RS 485-based program recording circuit according to an embodiment of the present application, and fig. 2 is a circuit diagram of a second part of the RS 485-based program recording circuit according to an embodiment of the present application.
It should be noted that fig. 1 and fig. 2 together form a program burning circuit based on RS485 in the embodiment of the present application.
As shown in fig. 1 and fig. 2, the program burning circuit based on RS485 provided by the embodiment of the present application is characterized by comprising an ethernet interface terminal J1, an OTA download identification circuit, an RS485 communicator U3 and an RS485 enabling circuit;
The first pin triggered by the connection of the OTA download line in the Ethernet interface terminal J1 is connected with the input end of the OTA download identification circuit, the output end BOOT0 of the OTA download identification circuit is connected with the OTA download identification signal receiving end of the processor, the data pin in the Ethernet interface terminal J1 is connected with the slave-end data interface A, B of the RS485 communicator U3, and the host-end data interface D, R of the RS485 communicator U3 is correspondingly connected with the data transmitting interface TXD of the processor and the data receiving interface RXD of the processor;
the RS485 enabling circuit is an inverter circuit, the input end of the RS485 enabling circuit is connected with the data transmission interface TXD of the processor, and the output end of the RS485 enabling circuit is connected with the receiving enabling ends RE and DE of the RS485 communicator U3;
The OTA download identification circuit is used for outputting different levels when the Ethernet interface terminal J1 is connected to an OTA download line and when the Ethernet interface terminal J1 is not connected to the OTA download line, so that the processor can enable the RS485 communicator U3 through the RS485 enabling circuit after receiving the level of the OTA download identification signal which is represented by the output of the OTA download identification circuit, and the program burning signal can be received by the RS485 communicator U3 and the OTA download line.
In the embodiment of the application, the Ethernet interface terminal is selected as the downloading port in consideration of the fact that the Ethernet interface terminal is usually reserved on the equipment for external communication, and the program downloading and updating without unpacking the equipment are realized through the RS485 communicator and the Ethernet interface terminal.
OTA, over-the-Air Technology (OTA), is a Technology that enables remote management of mobile terminal devices and SIM card data Over the Air interface of mobile communications. The embodiment of the application is beneficial to triggering a specific pin of an Ethernet interface terminal by an interface of an OTA downloading line, and setting an OTA downloading identification circuit between the specific pin and an OTA downloading identification signal receiving end of a processor, thereby being triggered by a signal of the OTA downloading line connected to the Ethernet interface terminal and informing the processor of program burning.
The program burning can be performed when the software is updated in the using process of the equipment, and also can be performed when the equipment is put into use for the first time. When the device is put into use except for this, there is no control program for the rest of the hardware of the device in the processor, and the RS485 communicator needs to be activated to receive the program burning signal. Therefore, in the embodiment of the application, an RS485 enabling circuit is arranged between the data transmitting port TXD of the processor and the receiving enabling ends RE and DE of the RS485 communicator U3.
When the program burning circuit based on RS485 provided by the embodiment of the application is used for first putting equipment into use, the program burning equipment is connected with the Ethernet interface terminal J1 reserved by the equipment to be burned through the OTA downloading line, and the OTA downloading line triggers the first pin (such as pin1 of J1 in fig. 1) of the Ethernet interface terminal J1, so that the OTA downloading identification circuit is triggered to output the level representing the OTA downloading identification signal.
In a specific implementation, the OTA download identification circuit may be implemented using a switching circuit. For example, the ethernet interface terminal J1 is RJ45, and pin1 thereof is pulled down after the OTA download line is inserted, and the pin1 is used as the first pin defined herein, and the switch circuit is designed by using this characteristic, so that the OTA download identification signal can be sent to the processor.
As shown in fig. 1, the OTA download identifying circuit J1 may specifically include a first resistor R13, a second resistor R12, a third resistor R5, and a first transistor Q1;
The first end of the first resistor R13 is connected to the first pin, the second end of the first resistor R13 is connected to the base of the first triode Q1, the collector of the first triode Q1, the second end of the second resistor R12 is connected to the first end of the third resistor R5, the first end of the second resistor R12 is connected to the first direct current (e.g., +3.3v direct current) power supply as shown in fig. 1, the second end of the third resistor R5 is connected to the OTA download identification signal receiving end of the processor, and the emitter of the first triode Q1 is grounded.
In the conventional device, if the ethernet interface terminal J1 is RJ45, the pin1 is originally connected to only +5v dc power supply. The embodiment of the application is additionally provided with the OTA download identification circuit shown in figure 1, and when the Ethernet interface terminal J1 is not connected with any interface, the output end BOOT0 of the OTA download identification circuit defaults to be low level. After the Ethernet interface terminal J1 is connected to an OTA downloading line, the first pin1 is pulled down, the output end BOOT0 of the OTA downloading identification circuit is pulled up, and when the processor detects that the signal is effective, the signal is identified as OTA downloading and enters a serial port downloading mode.
As shown in fig. 2, the connection circuit of the RS485 communicator U3 is shown in fig. 2, pin2 of the ethernet interface terminal J1 is connected to the second end of the inductor L1 through the data bus a, the first end of the inductor L1, the first end of the capacitor C10, the second end of the resistor R9, the first end of the capacitor C11 is connected to the slave data interface a of the RS485 communicator U3, the first end of the resistor R9 is connected to the +5v dc power supply, the first end of the capacitor C10 is grounded, pin7 of the ethernet interface terminal is connected to the second end of the inductor L2 through the data bus B, the first end of the inductor L2, the first end of the capacitor C9, the second end of the capacitor C11, the first end of the resistor R10 is connected to the slave data interface B of the RS485 communicator U3, and the second end of the resistor R10 is grounded to the second end of the capacitor C9. The host end data interface D of the RS485 communicator U3 is connected with the second end of the resistor R3, the first end of the capacitor R3 and the second end of the capacitor R7 are connected with the data transmission interface TXD of the processor, the host end data interface R of the RS485 communicator U3 is connected with the second end of the resistor R8 and the input end of the inverter U1, the first end of the resistor R8 is connected with a +5V direct current power supply, the output end of the inverter U1 is connected with the input end of the inverter U2, and the output end of the inverter U2 is connected with the data receiving interface RXD of the processor through the resistor R4.
Because the data is low-level effective in the bus communication of the RS485 communicator U3, after receiving the OTA download identification signal, the processor inputs an enabling signal RTS into receiving enabling ends RE and DE of the RS485 communicator U3 through an RS485 enabling circuit (an inverter circuit consisting of an inverter U2 and a resistor R6), so that the RS485 communicator U3 enters a receiving mode, and software updating can be completed through receiving a program burning signal through an AB data bus, and the whole process does not need to disassemble an equipment case.
In order to save the space of the board card and adapt to the miniaturization trend of equipment, because the RS485 communicator is commonly used for being in communication connection with external communication equipment, the RS485 communicator used for external communication can be multiplexed into the RS485 communicator U3 used for program burning. On the basis of the above embodiment, the RS 485-based program burning circuit provided by the embodiment of the present application further includes an external communication identification circuit;
The input end of the external communication identification circuit is connected with a second pin triggered by the connection of the external communication equipment in the Ethernet interface terminal J1, the output end of the external communication identification circuit is connected with an external communication identification signal receiving end of the processor, and the external communication identification circuit is used for outputting different levels when the Ethernet interface terminal J1 is connected with the external communication equipment and when the Ethernet interface terminal J1 is not connected with the external communication equipment.
In a specific implementation, as shown in fig. 1, the external communication identification circuit may specifically include a fourth resistor R1, a fifth resistor R2, and a first capacitor C2;
The first end of the fourth resistor R1 is grounded, the second end of the fourth resistor R1 and the first end of the fifth resistor R2 are connected with the second pin, the second end of the fifth resistor R2 and the first end of the first capacitor C2 are connected with an external communication identification signal receiving end of the processor, and the second end of the first capacitor C2 is grounded.
The ethernet interface terminal J1 is for example RJ45, the second pin defined herein is pin8 of RJ 45. When the external communication equipment is accessed, pin8 of RJ45 is pulled high, and after the external communication identification signal receiving end of the processor receives the signal RJ45_SEL and identifies that the signal is valid, the signal is confirmed to be external communication.
Based on the RS 485-based program burning circuit provided by the embodiment of the present application, when the RS485 communicator U3 is in the receiving mode and the processor transmits the data signal TXD to be high level by default, the RS485 communicator U3 enables the signal RTS to be low level, and for receiving the enabling, the data on the AB data bus is converted into the processor receiving signal RXD by the RS485 communicator U3 and sent to the processor.
In the RS485 transmission mode, TXD is a data signal, and RTS is a data signal with a high-low level change. The RS485 communicator U3 will switch between transmit and receive modes. Note that in RS485 communication, data is low-efficient. When TXD is low, RTS is high, at which time RS485 communicator U3 sends an enable, and the TXD data signal is transmitted through RS485 communicator U3 onto the AB data bus. When TXD is high, RTS is low, and RS485 communicator U3 enters a receive mode, but is now in a transmit mode for the processor, and no data is received, so the received data will not cause a false disturbance to the processor.
Various embodiments corresponding to the RS485 based programming circuit are described above in detail, based on which, the application also discloses an RS 485-based program burning method corresponding to the RS 485-based program burning circuit.
Based on a processor, the program burning method based on RS485 provided by the embodiment of the application comprises the following steps:
When the OTA download identification signal receiving end of the processor receives the level representing the OTA download identification signal output by the OTA download identification circuit, transmitting an enabling signal through the RS485 enabling circuit through the data transmitting interface of the processor to activate the receiving enabling of the RS485 communicator;
receiving a program burning signal of an RS485 data bus through an RS485 communicator;
The OTA download identification signal receiving end of the processor is connected with the output end of the OTA download identification circuit, the input end of the OTA download identification circuit is connected with a first pin triggered by the connection of an OTA download line in an Ethernet interface terminal, a data pin in the Ethernet interface terminal is connected with a slave computer end data interface of the RS485 communicator, and a host computer end data interface of the RS485 communicator is correspondingly connected with a data transmitting interface of the processor and a data receiving interface of the processor;
The RS485 enabling circuit is an inverter circuit, the input end of the RS485 enabling circuit is connected with the data transmission interface of the processor, and the output end of the RS485 enabling circuit is connected with the receiving enabling end of the RS485 communicator;
the OTA download identification circuit is used for outputting different levels when the Ethernet interface terminal is connected with the OTA download line and when the Ethernet interface terminal is not connected with the OTA download line.
In a specific implementation, the OTA download identifying circuit may specifically include a first resistor, a second resistor, a third resistor, and a first triode;
The first end of the first resistor is connected with the first pin, the second end of the first resistor is connected with the base electrode of the first triode, the collector electrode of the first triode, the second end of the second resistor is connected with the first end of the third resistor, the first end of the second resistor is connected with the first direct current power supply, the second end of the third resistor is connected with the OTA download identification signal receiving end of the processor, and the emitter electrode of the first triode is grounded.
Further, the RS 485-based program burning method provided by the embodiment of the present application may further include:
When the external communication identification signal receiving end of the processor receives the level of the external communication identification circuit output representation Ethernet interface terminal access external communication equipment, controlling the RS485 communicator to enter an external communication mode;
The input end of the external communication identification circuit is connected with a second pin triggered by the connection of the external communication equipment in the Ethernet interface terminal, the output end of the external communication identification circuit is connected with an external communication identification signal receiving end of the processor, and the external communication identification circuit is used for outputting different levels when the Ethernet interface terminal is connected with the external communication equipment and when the Ethernet interface terminal is not connected with the external communication equipment.
In a specific implementation, the external communication identification circuit specifically comprises a fourth resistor, a fifth resistor and a first capacitor;
The first end of the fourth resistor is grounded, the second end of the fourth resistor and the first end of the fifth resistor are connected with the second pin, the second end of the fifth resistor and the first end of the first capacitor are connected with an external communication identification signal receiving end of the processor, and the second end of the first capacitor is grounded.
Since the embodiment of the RS 485-based program recording method portion corresponds to the embodiment of the RS 485-based program recording circuit portion, the embodiment of the RS 485-based program recording method portion is referred to the description of the embodiment of the RS 485-based program recording circuit portion, and is not repeated herein.
The program burning circuit and the program burning method based on RS485 provided by the application are described in detail. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the program writing method based on the RS485 disclosed in the embodiment, since the method corresponds to the program writing circuit based on the RS485 disclosed in the embodiment, the description is relatively simple, and the relevant points are only needed to be described by referring to the program writing circuit part based on the RS 485. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the application can be made without departing from the principles of the application and these modifications and adaptations are intended to be within the scope of the application as defined in the following claims.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.