A Debugging Method and System for CC2530 Microcontroller Based on Wireless Communication

By developing UI interface and serial port configuration on the CC2530 microcontroller, combining UART and BasicRF protocols, wireless communication debugging and efficient data monitoring of the CC2530 microcontroller are realized, solving the commonality and data extraction problems of existing debugging methods.

CN118331130BActive Publication Date: 2025-07-29ZHUHAI RADIANCE ELECTRIC
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410461662.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-17
Publication Date
2025-07-29
Estimated Expiration
2044-04-17

AI Technical Summary

Technical Problem

The existing CC2530 microcontroller debugging methods cannot perform wireless communication debugging, have poor versatility, difficult to detect data errors, and difficult to extract effective information.

Method used

Through Visual Studio software development of UI interface and serial port configuration, the UART protocol is used to connect to the CC2530 microcontroller, define custom data transmission and reception formats, receive and display data in real time, and control the microcontroller for parameter analysis and application through the BasicRF software package.

Benefits of technology

It realizes high-versatility debugging of the CC2530 microcontroller, supports dynamic modification of channel and ID code, and customizes data formats, improving debugging efficiency and data monitoring effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331130B_ABST
    Figure CN118331130B_ABST
Patent Text Reader

Abstract

The present invention discloses a debugging method and system for a CC2530 microcontroller based on wireless communication, including: connecting a debugging host computer to the CC2530 microcontroller, obtaining an available communication serial port and opening it; defining a data format to obtain a custom data format for sending and receiving; receiving in real time by the debugging host computer the data sent by the CC2530 microcontroller and storing it in the received data area; automatically extracting in the received data area the data of interest to the user, performing conversion and grouping, and then displaying it in real time through the debugging host computer; inputting debugging parameters according to the real-time displayed data and sending the debugging parameters through the available communication serial port; receiving the debugging parameters by the CC2530 microcontroller, parsing the debugging parameters, and applying them according to the parsing results. The present invention realizes wireless communication debugging of the CC2530 microcontroller, high debugging versatility, and effective monitoring of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of microcontroller debugging, and particularly relates to a debugging method and system for a CC2530 microcontroller based on wireless communication. Background Art

[0002] CC2530 is a wireless transceiver chip invented by TI (Texas Instruments). It can build powerful network nodes at a very low total material cost. CC2530 uses the industry-standard enhanced 8051 core and combines an RF wireless transceiver, and is a system-on-chip (SOC) for Zigbee applications in 2.4GHz IEEE802.15.4. CC2530 has different operating modes, making it particularly suitable for systems with ultra-low power requirements. The short conversion time between CC2530 operating modes further ensures low energy consumption. Therefore, CC2530 is currently widely used in various scenarios with low power requirements.

[0003] Existing serial port debugging tools have basic serial port debugging functions, including serial port detection, baud rate setting, setting the parity mode, etc. However, for the debugging of CC2530 wireless communication, they lack the function of dynamically modifying parameters such as channel settings, network ID codes, and PANID codes. Moreover, the transmitted data is often in a string of hexadecimal format, which is not very intuitive during debugging. If the transmitted data is abnormal (outside the warning value), it is often difficult to detect in time.

[0004] Currently, the debugging software for CC2530 does not support custom communication protocols, so it lacks generality. In addition, when observing the transmitted data on the upper computer side in existing applications, the data is not grouped but a series of data frames, making it difficult to extract effective information.

[0005] In summary, the existing debugging methods for CC2530 have problems such as being unable to implement the debugging of CC2530 wireless communication, poor generality, difficulty in timely detecting data errors, and difficulty in effectively extracting information. Summary of the Invention

[0006] In order to overcome the deficiencies of the prior art, the present invention provides a debugging method and system for a CC2530 microcontroller based on wireless communication, which is used to solve the problems that the existing debugging methods for CC2530 cannot perform wireless communication debugging, have poor generality, are difficult to detect data errors, and are difficult to extract effective information, so as to realize the wireless communication debugging of the CC2530 microcontroller, high generality of debugging, and effective monitoring of data.

[0007] To solve the above problems, the technical solutions adopted by the present invention are as follows:

[0008] A debugging method for a CC2530 microcontroller based on wireless communication, comprising the following steps:

[0009] Use Visual Studio software to develop the UI interface and configure the serial port to obtain a debugging host computer;

[0010] Connect the debugging host computer and the CC2530 microcontroller through the UART protocol, obtain the available communication serial port and open it;

[0011] Define the data format in the debugging host computer to obtain a custom data format for sending and receiving;

[0012] Use the available communication serial port through the debugging host computer to receive the data sent by the CC2530 microcontroller in the custom data format for sending and receiving in real time, and store it in the receiving data area of the debugging host computer;

[0013] Automatically extract the data concerned by the user in the receiving data area, perform conversion and grouping, and then display it in real time through the debugging host computer;

[0014] Input the debugging parameters of the CC2530 microcontroller according to the real-time display data, and send the debugging parameters through the available communication serial port;

[0015] Receive the debugging parameters by the CC2530 microcontroller, parse the debugging parameters, and apply them according to the parsing results;

[0016] Wherein, the application includes: updating the configuration register, changing the working mode or performing corresponding operations.

[0017] As a preferred embodiment of the present invention, when developing the UI interface and configuring the serial port, it includes:

[0018] Select the C# language, select the Windows Form application, and control the serial port through the SerialPort class provided by the C# language. When selecting the serial port, directly search and call.

[0019] As a preferred embodiment of the present invention, when obtaining the available communication serial port and opening it, it includes:

[0020] Use SerialPort.GetPortNames() to obtain the available communication serial port and get the serial port name of the available communication serial port;

[0021] Use SerialPort1.PortName to obtain the port number input by the debugging host computer;

[0022] Obtain the baud rate input by the debug host computer using SerialPort1.BaudRate;

[0023] Obtain the data bits input by the debug host computer using SerialPort1.DataBits;

[0024] Open the available communication serial port using SerialPort1.Open();

[0025] Among them, SerialPort1 is the serial port name of the available communication serial port.

[0026] As a preferred embodiment of the present invention, when obtaining the custom transceiver data format, it includes:

[0027] Select the frame header length, ID code length, and data length, and form a complete data frame with the frame header length, the ID code length, and the data length to obtain the custom transceiver data format;

[0028] Among them, the transceiver of the data frame is stored in the form of an array and is in hexadecimal;

[0029] When automatically extracting the concerned data, it includes:

[0030] Retrieve the corresponding data through the array subscript, convert it to decimal, and group it.

[0031] As a preferred embodiment of the present invention, when receiving the data sent by the CC2530 microcontroller in real time, it includes:

[0032] Receive each frame of temperature data sent by the CC2530 microcontroller in the format of frame header + ID code + temperature data + frame sequence + signal strength in real time;

[0033] Among them, the user can define the number of bits of each part of the data by themselves, and the debug host computer will automatically wrap lines according to the frame length defined by the user when receiving the data sent by the CC2530 microcontroller.

[0034] As a preferred embodiment of the present invention, when receiving the debug parameters and parsing them, it includes:

[0035] According to the parsing result, use the API functions provided by the BasicRF software package to control the CC2530 microcontroller to receive the debug parameters and parse them;

[0036] Among them, 4 wireless parameters need to be configured in the BasicRF software package, including: the local address, the target address, the network ID, and the communication channel; the local address, the network ID, and the communication channel are written into the CC2530 microcontroller during initialization; the target address is used during data transmission and reception.

[0037] As a preferred embodiment of the present invention, when using the API functions provided by the BasicRF software package to control the CC2530 microcontroller, it includes:

[0038] Establish a basicRfCfg_t structure to save the basic settings of BasicRF wireless transmission;

[0039] Call the basicRfInit() function to initialize the data structure of BasicRF;

[0040] Pack the debugging parameters according to the format of the BasicRF data frame, and send the data packet to the CC2530 microcontroller according to the address of the CC2530 microcontroller;

[0041] The CC2530 microcontroller continuously calls the basicRfPacketIsReady() function to identify whether there is a data packet arriving at the hardware abstraction layer and judge whether the format of the data packet is correct;

[0042] If it is correct, retain the basic information of the data packet and judge whether the basic information is legal;

[0043] If so, enter the data packet receiving link and call the basicRfReceive() function to receive the data packet;

[0044] Among them, the basic information includes: the length of the data packet, the source address of the data packet, and the network end of the data packet.

[0045] As a preferred embodiment of the present invention, when applying according to the parsing result, it includes:

[0046] Perform real-time monitoring on the available communication serial ports. When the debugging parameters from the available communication serial ports are received, turn on the switch of the initialization function;

[0047] According to the parsing result of the debugging parameters, initialize the hardware of the CC2530 microcontroller through the initialization function, and after the initialization is completed, turn off the switch of the initialization function.

[0048] As a preferred embodiment of the present invention, when initializing the hardware of the CC2530 microcontroller through the initialization function, it includes:

[0049] Configure the control register for supplying the internal module clock source of the CC2530 microcontroller;

[0050] Configure the operating mode register of the CC2530 microcontroller;

[0051] Configure the memory parameter configuration register of the CC2530 microcontroller;

[0052] Obtain the starting address of SDRAM, the target address of the transfer code in SDRAM, and the starting address of the code in flash, and transfer all the codes in Nor flash to SDRAM in a per-loop manner;

[0053] Configure the REMAP register of the CC2530 microcontroller;

[0054] Make the pc pointer point to the starting address of the main program.

[0055] A debugging system for the CC2530 microcontroller based on wireless communication, comprising:

[0056] Configuration unit: used to develop the UI interface and configure the serial port using Visual Studio software to obtain a debugging host computer;

[0057] Communication connection unit: used to connect the debugging host computer and the CC2530 microcontroller through the UART protocol, obtain an available communication serial port and open it;

[0058] Data format customization unit: used to define the data format in the debugging host computer to obtain a customized data format for sending and receiving;

[0059] Real-time receiving unit: used to use the available communication serial port through the debugging host computer to real-time receive the data sent by the CC2530 microcontroller in the customized data format for sending and receiving, and store it in the receiving data area of the debugging host computer;

[0060] Real-time display unit: used to automatically extract the data concerned by the user in the receiving data area, perform conversion and grouping, and then perform real-time display through the debugging host computer;

[0061] Debugging unit: used to input the debugging parameters of the CC2530 microcontroller according to the real-time display data, and send the debugging parameters through the available communication serial port; receive the debugging parameters through the CC2530 microcontroller, parse the debugging parameters, and apply according to the parsing result;

[0062] Among them, the application includes: updating the configuration register, changing the working mode, or performing corresponding operations.

[0063] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0064] (1) The present invention provides a wireless communication debugging method and system for CC2530 microcontrollers with high versatility. It has basic serial port setting functions and also supports setting RF channels, ID codes, PAN ID codes, transmission periods, etc. on the software side of the upper computer. After the user sets the parameters, the CC2530 microcontroller can be configured with one key.

[0065] (2) The present invention supports custom communication protocols. Users can easily modify the format of communication data, and at the same time support data transcoding, such as converting hexadecimal data into easily recognizable decimal data, etc. And when the data difference exceeds the warning value, the data frame can be automatically extracted and warned.

[0066] (3) The method and system provided by the present invention have versatility, saving unnecessary data recognition time for users and greatly improving development efficiency. In addition, the added function of custom communication format can effectively cope with usage scenarios with different requirements.

[0067] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. Description of the Drawings

[0068] Figure 1 is a step diagram of the debugging method of the CC2530 microcontroller based on wireless communication provided by the present invention;

[0069] Figure 2 is the overall flowchart of the debugging method of the CC2530 microcontroller based on wireless communication provided by the embodiments of the present invention;

[0070] Figure 3 Flowchart of configuring the CC2530 microcontroller in the embodiments of the present invention;

[0071] Figure 4 Function framework diagram of the debugging software side in the embodiments of the present invention. Specific Embodiments

[0072] The debugging method of the CC2530 microcontroller based on wireless communication provided by the present invention, as Figure 1 shown, includes the following steps:

[0073] Step S1: Use Visual Studio software to develop the UI interface and configure the serial port to obtain the debugging upper computer;

[0074] Step S2: Connect the debugging host computer and the CC2530 microcontroller through the UART protocol, obtain the available communication serial port and open it;

[0075] Step S3: Define the data format in the debugging host computer to obtain a custom data format for sending and receiving;

[0076] Step S4: Use the available communication serial port through the debugging host computer to receive the data sent by the CC2530 microcontroller in the custom data format for sending and receiving in real time, and store it in the receiving data area of the debugging host computer;

[0077] Step S5: Automatically extract the data concerned by the user in the receiving data area, perform conversion and grouping, and then display it in real time through the debugging host computer;

[0078] Step S6: Input the debugging parameters of the CC2530 microcontroller according to the real-time display data, and send the debugging parameters through the available communication serial port;

[0079] Step S7: Receive the debugging parameters through the CC2530 microcontroller, parse the debugging parameters, and apply them according to the parsing results;

[0080] Among them, the application includes: updating the configuration register, changing the working mode or performing corresponding operations. The real-time display data includes: the configuration information of the CC2530 microcontroller.

[0081] Specifically, in the present invention, the carrier of the host computer includes a computer. The CC2530 microcontroller is used as a transceiver module, or a single-chip microcomputer. The computer and the CC2530 microcontroller are connected by wire (serial port), and the CC2530 microcontrollers are connected wirelessly.

[0082] Most of the time, the CC2530 microcontroller connected to the host computer acts as a receiver. The receiver sends the signal received from other CC2530 microcontrollers (senders) (the information is sent wirelessly by the sender) to the host computer for display.

[0083] Since the CC2530 microcontrollers communicate wirelessly, users do not know what data is sent and received. By connecting the receiver to the host computer and displaying the data sent and received on the host computer, it is convenient for users to observe and debug.

[0084] In the above step S1, when developing the UI interface and configuring the serial port, it includes:

[0085] Select the C# language, select the Windows Form application, and control the serial port through the SerialPort class provided by the C# language. When selecting the serial port, directly search and call.

[0086] In the above step S2, when obtaining and opening an available communication serial port, it includes:

[0087] Use SerialPort.GetPortNames() to obtain available communication serial ports and get the serial port names of the available communication serial ports;

[0088] Use SerialPort1.PortName to obtain the port number input by the debug host computer;

[0089] Use SerialPort1.BaudRate to obtain the baud rate input by the debug host computer;

[0090] Use SerialPort1.DataBits to obtain the data bits input by the debug host computer;

[0091] Use SerialPort1.Open() to open the available communication serial port;

[0092] Among them, SerialPort1 is the serial port name of the available communication serial port.

[0093] In the above step S3, when obtaining the custom data format for sending and receiving, it includes:

[0094] Select the frame header length, ID code length, and data length, and form a complete data frame with the frame header length, ID code length, and data length to obtain the custom data format for sending and receiving;

[0095] Among them, the sending and receiving of the data frame are stored in the form of an array and are in hexadecimal;

[0096] When automatically extracting the concerned data, it includes:

[0097] Retrieve the corresponding data through the array subscript, convert it to decimal, and group it.

[0098] In the above step S4, when receiving the data sent by the CC2530 microcontroller in real time, it includes:

[0099] Receive each frame of temperature data sent by the CC2530 microcontroller in the format of frame header + ID code + temperature data + frame sequence + signal strength in real time;

[0100] Among them, the user can define the number of bits of each part of the data by themselves, and when the debug host computer receives the data sent by the CC2530 microcontroller, it will automatically wrap lines according to the frame length defined by the user.

[0101] In the above step S7, when receiving the debug parameters and parsing them, it includes:

[0102] According to the parsing result, use the API functions provided by the BasicRF software package to control the CC2530 microcontroller to receive debugging parameters and parse them;

[0103] Among them, 4 wireless parameters need to be configured in the BasicRF software package, including: the local address, the destination address, the network ID, and the communication channel; the local address, the network ID, and the communication channel are written into the CC2530 microcontroller during initialization; the destination address is used during data sending and receiving.

[0104] Specifically, the BasicRF software package provided by the present invention supports setting the RF channel, ID code, PAN ID code, sending period, etc. on the software side of the host computer.

[0105] Furthermore, when using the API functions provided by the BasicRF software package to control the CC2530 microcontroller, it includes:

[0106] Establish a basicRfCfg_t structure to save the basic settings of BasicRF wireless transmission;

[0107] Call the basicRfInit() function to initialize the data structure of BasicRF;

[0108] Pack the debugging parameters according to the format of the BasicRF data frame, and send the data packet to the CC2530 microcontroller according to the address of the CC2530 microcontroller;

[0109] The CC2530 microcontroller continuously calls the basicRfPacketIsReady() function to identify whether there is a data packet coming in the hardware abstraction layer and judge whether the format of the data packet is correct;

[0110] If it is correct, retain the basic information of the data packet and judge whether the basic information is legal;

[0111] If so, enter the data packet receiving link and call the basicRfReceive() function to receive the data packet;

[0112] Among them, the basic information includes: the length of the data packet, the source address of the data packet, and the network side (PAN ID) of the data packet.

[0113] Specifically, when the present invention uses the basicRfCfg_t structure to save the basic settings of BasicRF wireless transmission, it includes: saving the 16-bit short address (i.e., the address of the node), the PAN ID of the node, the RF channel, the target confirmation, and the encryption setting.

[0114] Specifically, the present invention can also set the warning value of the data by itself. Once the data difference exceeds the warning value, the data frame can be automatically extracted and a warning can be issued.

[0115] In the above step S7, when applying according to the parsing result, it includes:

[0116] Perform real-time monitoring on the available communication serial ports. When the debugging parameters are received from the available communication serial ports, turn on the switch of the initialization function;

[0117] According to the parsing result of the debugging parameters, initialize the hardware of the CC2530 microcontroller through the initialization function, and after the initialization is completed, turn off the switch of the initialization function.

[0118] Furthermore, when initializing the hardware of the CC2530 microcontroller through the initialization function, it includes:

[0119] Configure the control register for supplying the internal module clock source of the CC2530 microcontroller;

[0120] Configure the working mode register of the CC2530 microcontroller;

[0121] Configure the memory parameter configuration register of the CC2530 microcontroller;

[0122] Obtain the starting address of SDRAM, the target address of the transfer code in SDRAM, and the starting address of the code in flash, and transfer all the codes in Nor flash to SDRAM in a per-loop manner;

[0123] Configure the REMAP register of the CC2530 microcontroller;

[0124] Make the pc pointer point to the starting address of the main program.

[0125] The debugging system of the CC2530 microcontroller based on wireless communication provided by the present invention includes: a configuration unit, a communication connection unit, a data format customization unit, a real-time receiving unit, a real-time display unit, and a debugging unit.

[0126] Configuration unit: used to develop the UI interface and configure the serial port using Visual Studio software to obtain a debugging host computer.

[0127] Communication connection unit: used to connect the debugging host computer and the CC2530 microcontroller through the UART protocol, obtain the available communication serial ports and open them.

[0128] Data format customization unit: used to obtain a customized data format for sending and receiving by defining the data format in the debugging host computer.

[0129] Real-time receiving unit: It is used to receive the data sent by the CC2530 microcontroller in a custom data transceiver format in real time through the debugging host computer using an available communication serial port, and store it in the received data area of the debugging host computer.

[0130] Real-time display unit: It is used to automatically extract the data concerned by the user in the received data area, perform conversion and grouping, and then perform real-time display through the debugging host computer.

[0131] Debugging unit: It is used to input the debugging parameters of the CC2530 microcontroller according to the real-time display data, and send the debugging parameters through the available communication serial port; receive the debugging parameters through the CC2530 microcontroller, parse the debugging parameters, and apply according to the parsing results.

[0132] Among them, the application includes: updating the configuration register, changing the working mode or performing corresponding operations.

[0133] The following embodiments further illustrate the present invention, but the scope of the present invention is not limited thereto.

[0134] The overall process of the debugging method for the CC2530 microcontroller based on wireless communication provided in this embodiment is as Figure 2 shown.

[0135] I. Development of the host computer UI interface and serial port communication

[0136] This embodiment is developed using the C# language. As an object-oriented programming language, C# has powerful functions and rich library support, which can meet complex automation requirements, and the network programming library of C# can be used to easily create applications that interact with sensors and devices. At the same time, using relevant graphics libraries and algorithm libraries, a user-friendly interface can be created and data processing and analysis can be performed.

[0137] As a cross-platform programming language, C# can use the.net Core framework for cross-platform development, making the host computer application developed using C# in this embodiment applicable to multiple operating systems such as Windows, Mac, and Linux, providing greater flexibility and coverage.

[0138] This embodiment uses Visual Studio software for development. When creating a project, select the C# language and select "Windows Forms Application (.NET Framework)", which is a project for creating an application with a Windows Forms (WinForms) user interface. For the selection of the serial port, C# provides a class called "SerialPort" for serial port control, which can be directly searched and called on the toolbox page.

[0139] II. Dynamically Modify the Configuration Information of the CC2530 Module at the Host Computer End

[0140] The CC2530 microcontroller communicates with the host computer end through the serial port. After the hardware connection is completed, the data on the software side can be sent to the CC2530 microcontroller through the serial port, and the CC2530 microcontroller modifies the hardware configuration through the BasicRF software package.

[0141] Among them, establish a connection: The host computer end and the CC2530 microcontroller are connected through the UART protocol. The hardware serial port module selects a USB-to-TTL module or other serial port modules.

[0142] Write communication code: Write communication code in the host computer end software to send and receive data. C# provides the SerialPort class as the interface for serial communication. Use this interface to open the communication port, send data frames, and receive responses. After the hardware connection is completed, use SerialPort.GetPortNames() to obtain the available serial ports, take the serial port name as serialPort1, use serialPort1.PortName, serialPort1.BaudRate, and serialPort1.DataBits to obtain the port number, baud rate, and data bits input by the user at the host computer end respectively, and open the serial port through serialPort1.Open(). At this time, the host computer end and the CC2530 microcontroller have established a connection.

[0143] Dynamically modify parameters: Through the host computer software interface, the user can input or modify the parameters of the CC2530 microcontroller. These parameters are sent to the CC2530 microcontroller through the serial port. For the data input by the user, it is first converted to hexadecimal and then sent to the CC2530 microcontroller.

[0144] The CC2530 receives and applies the parameters: After the CC2530 microcontroller receives the parameters through the serial port, it parses and applies them as needed, and at the same time updates the configuration register, changes the working mode, or performs corresponding operations. Specifically: The CC2530 receives data through the serial port and uses the API functions provided by the BasicRF software package to control the hardware. Four wireless parameters need to be configured in the BasicRF software package: the local address, the target address, the network ID, and the communication channel. Among them, the local address, network ID, and communication channel are written into the CC2530 microcontroller during initialization, and the target address is used during data sending and receiving. In each node for point-to-point communication, the network ID and communication channel are the same.

[0145] In addition, listen to the information of the serial port in the program of the CC2530 microcontroller. When a modification instruction is received from the serial port, re-initialize the hardware. After the initialization is complete, turn off the switch of the initialization function in the main loop until the switch of the initialization function is turned on again when the next modification instruction is received.

[0146] The process of configuring the CC2530 microcontroller is as Figure 3 shown.

[0147] III. Custom Communication Protocol and Data Processing

[0148] Users can independently select data segments such as the frame header length, ID code length, and data length in the drop-down menu on the upper computer side to form a complete data frame. The sending and receiving of data frames are stored in the form of arrays and are in hexadecimal. In the receiving data area of the upper computer, the information that the user is concerned about is automatically extracted, and the digital information is converted to decimal. In the receiving data area, according to the data format defined by the user, the corresponding data is retrieved and grouped through the array subscript. Users can not only directly observe the complete data frame, but also directly observe the grouped data, and they are updated synchronously, making the observation more intuitive. In addition, this embodiment also supports exporting to a txt file with one click by setting a button, and this process is completed using the StreamWriter class in C#.

[0149] When the user defines the data frame format on the upper computer side, taking the transmission of a frame of temperature data as an example, the data frame format can be defined as: frame header (4B) + ID code (8B) + temperature data (2B) + frame sequence (1B) + signal strength (1B). Among them, 1B = 1Byte = 8bits. Users can define the number of bits of each part of the data by themselves. When the upper computer side receives data, it will automatically wrap lines according to the frame length defined by the user. After the user defines the data frame format, the sent and received data frames are stored using arrays, and the corresponding information can be directly extracted according to the array subscript.

[0150] As Figure 4 shown, the debugging method provided by this embodiment includes: basic serial port settings and additional settings for CC2530.

[0151] Among them, the basic serial port settings include: serial port selection, baud rate setting, stop bit setting, data bit setting, parity mode setting, serial port opening and closing, data sending and receiving.

[0152] The additional settings for CC2530 include: querying configuration information, modifying configuration information, data transcoding, log export, custom frame format, warning value setting.

[0153] The above embodiments are only preferred embodiments of the present invention, and the scope of protection of the present invention cannot be limited thereby. Any non-substantive changes and substitutions made by those skilled in the art based on the present invention fall within the scope of protection required by the present invention.

Claims

1. A debugging method for a CC2530 microcontroller based on wireless communication, characterized in that Including the following steps: Use Visual Studio software to develop the UI interface and configure the serial port to obtain a debugging host computer; Connect the debugging host computer to the CC2530 microcontroller through the UART protocol, obtain the available communication serial port and open it; Define the data format in the debugging host computer to obtain a custom data format for sending and receiving; among them, select the frame header length, ID code length, and data length, and form a complete data frame with the frame header length, the ID code length, and the data length to obtain the custom data format for sending and receiving; Use the available communication serial port through the debugging host computer to receive the data sent by the CC2530 microcontroller in the custom data format for sending and receiving in real time, and store it in the receiving data area of the debugging host computer; among them, receive each frame of temperature data sent by the CC2530 microcontroller in the format of frame header + ID code + temperature data + frame sequence + signal strength in real time; Automatically extract the data concerned by the user in the receiving data area, perform conversion and grouping, and then display it in real time through the debugging host computer; Input the debugging parameters of the CC2530 microcontroller according to the real-time display data, and send the debugging parameters through the available communication serial port; Receive the debugging parameters through the CC2530 microcontroller, parse the debugging parameters, and apply them according to the parsing results; Among them, the application includes: updating the configuration register, changing the working mode or performing corresponding operations; Among them, when receiving the debugging parameters and parsing them, it includes: using the API functions provided by the BasicRF software package to control the CC2530 microcontroller to receive the debugging parameters and parse them; 4 wireless parameters need to be configured in the BasicRF software package, including: local address, target address, network ID, and communication channel; the local address, the network ID, and the communication channel are written into the CC2530 microcontroller during initialization; the target address is used when sending and receiving data; When controlling the CC2530 microcontroller using the API functions provided by the BasicRF software package, it includes: establishing a basicRfCfg_t structure to save the basic settings for BasicRF wireless transmission; calling the basicRfInit() function to initialize the data structure of BasicRF; packing the debug parameters according to the format of the BasicRF data frame, and sending the data packet to the CC2530 microcontroller according to the address of the CC2530 microcontroller; continuously calling the basicRfPacketIsReady() function through the CC2530 microcontroller to identify whether there is a data packet arriving at the hardware abstraction layer and judge whether the format of the data packet is correct; if correct, retain the basic information of the data packet and judge whether the basic information is legal; if so, enter the data packet receiving link and call the basicRfReceive() function to receive the data packet; the basic information includes: the length of the data packet, the source address of the data packet, and the network end of the data packet. When applying according to the parsing result, it includes: Real-time monitoring of the available communication serial ports, and when receiving the debug parameters from the available communication serial ports, turning on the switch of the initialization function; According to the parsing result of the debug parameters, initializing the hardware of the CC2530 microcontroller through the initialization function, and after the initialization is completed, turning off the switch of the initialization function; When initializing the hardware of the CC2530 microcontroller through the initialization function, it includes: Configuring the control register for the internal module clock source supply of the CC2530 microcontroller; Configuring the working mode register of the CC2530 microcontroller; Configuring the memory parameter configuration register of the CC2530 microcontroller; Obtaining the starting address of SDRAM, the target address of the SDRAM for transporting the code, and the starting address of the code in the flash, and transporting all the codes in the Nor flash to the SDRAM in a per-loop manner; Configuring the REMAP register of the CC2530 microcontroller; Making the pc pointer point to the starting address of the main program.

2. The debugging method of the CC2530 microcontroller based on wireless communication according to claim 1, characterized in that, When developing the UI interface and configuring the serial port, it includes: Selecting the C# language, selecting the Windows Form application, and controlling the serial port through the SerialPort class provided by the C# language. When selecting the serial port, directly search and call.

3. The debugging method of the CC2530 microcontroller based on wireless communication according to claim 1, wherein When obtaining and opening the available communication serial ports, it includes: Using SerialPort.GetPortNames() to obtain the available communication serial ports and getting the serial port names of the available communication serial ports; Using SerialPort1.PortName to obtain the port number input by the debug host computer; Using SerialPort1.BaudRate to obtain the baud rate input by the debug host computer; Using SerialPort1.DataBits to obtain the data bits input by the debug host computer; Open the available communication serial port using SerialPort1.Open(); where SerialPort1 is the serial port name of the available communication serial port.

4. The debugging method of the CC2530 microcontroller based on wireless communication according to claim 1, wherein When obtaining the custom data format for sending and receiving, it includes: The sending and receiving of the data frame are stored in the form of an array and in hexadecimal. When automatically extracting the concerned data, it includes: Retrieve the corresponding data through the array subscript, convert it to decimal, and group it.

5. The debugging method of the CC2530 microcontroller based on wireless communication according to claim 4, characterized in that, When receiving the data sent by the CC2530 microcontroller in real time, it includes: The user can define the number of bits of each part of the data by themselves. When the debug host computer receives the data sent by the CC2530 microcontroller, it will automatically wrap lines according to the frame length defined by the user.

6. A debugging system for a CC2530 microcontroller based on wireless communication, characterized in that, It includes: Configuration unit: used to develop the UI interface and configure the serial port using Visual Studio software to obtain the debug host computer; Communication connection unit: used to connect the debug host computer and the CC2530 microcontroller through the UART protocol, obtain the available communication serial port and open it; Data format customization unit: used to obtain the custom data format for sending and receiving by defining the data format in the debug host computer; among them, select the frame header length, ID code length, and data length, and form a complete data frame with the frame header length, the ID code length, and the data length to obtain the custom data format for sending and receiving; Real-time receiving unit: used to use the available communication serial port through the debug host computer to receive the data sent by the CC2530 microcontroller in the custom data format for sending and receiving in real time and store it in the receiving data area of the debug host computer; among them, receive each frame of temperature data sent by the CC2530 microcontroller in the format of frame header + ID code + temperature data + frame sequence + signal strength in real time; Real-time display unit: used to automatically extract the data concerned by the user in the receiving data area, convert and group it, and then display it in real time through the debug host computer; Debug unit: used to input the debug parameters of the CC2530 microcontroller according to the real-time display data and send the debug parameters through the available communication serial port; receive the debug parameters through the CC2530 microcontroller, parse the debug parameters, and apply according to the parsing result; where the application includes: updating the configuration register, changing the working mode, or performing corresponding operations; where, when receiving the debug parameters and parsing them, it includes: using the API functions provided by the BasicRF software package to control the CC2530 microcontroller to receive the debug parameters and parse them; 4 wireless parameters need to be configured in the BasicRF software package, including: local address, target address, network ID, and communication channel; the local address, the network ID, and the communication channel are written into the CC2530 microcontroller during initialization; the target address is used during data sending and receiving; When controlling the CC2530 microcontroller using the API functions provided by the BasicRF software package, it includes: establishing a basicRfCfg_t structure to save the basic settings of BasicRF wireless transmission; calling the basicRfInit() function to initialize the data structure of BasicRF; packing the debugging parameters according to the format of the BasicRF data frame, and sending the data packet to the CC2530 microcontroller according to the address of the CC2530 microcontroller; continuously calling the basicRfPacketIsReady() function through the CC2530 microcontroller to identify whether there is a data packet arriving at the hardware abstraction layer and judging whether the format of the data packet is correct; if correct, retain the basic information of the data packet and judge whether the basic information is legal; if so, enter the data packet receiving link and call the basicRfReceive() function to receive the data packet; the basic information includes: the length of the data packet, the source address of the data packet, and the network end of the data packet. When applying according to the parsing result, it includes: Monitoring the available communication serial ports in real time, and when receiving the debugging parameters from the available communication serial ports, turning on the switch of the initialization function; According to the parsing result of the debugging parameters, initializing the hardware of the CC2530 microcontroller through the initialization function, and after the initialization is completed, turning off the switch of the initialization function; When initializing the hardware of the CC2530 microcontroller through the initialization function, it includes: Configuring the control register for the internal module clock source supply of the CC2530 microcontroller; Configuring the working mode register of the CC2530 microcontroller; Configuring the memory parameter configuration register of the CC2530 microcontroller; Obtaining the starting address of SDRAM, the target address of the SDRAM for transporting the code, and the starting address of the code in the flash, and transporting all the codes in the Nor flash to the SDRAM in a per-loop manner; Configuring the REMAP register of the CC2530 microcontroller; Making the pc pointer point to the starting address of the main program.

Citation Information

Patent Citations

  • Debugging program monitoring method and device

    CN101876935A

  • On-site equipment debugging method based on wireless communication

    CN110763927A

  • Automatic test method and automatic test equipment

    CN112491645A

  • User-defined logic calculation method and system based on logic diagram configuration

    CN116661753A