Simulation data binding method of DSP board card under embedded system
By initializing hardware resources and serial port modules in the embedded system, data binding automation of DSP boards is solved, and the joint debugging interruption caused by untimely binding of equipment is improved, testing efficiency and flexibility are improved, and costs are reduced.
Patent Information
- Application Number
- CN202411451060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-01-10
AI Technical Summary
In embedded systems, due to the untimely binding of the equipment during the data binding process of the DSP board, the joint debugging is interrupted, and the interface test and functional test cannot be carried out in time. The existing technology is difficult to effectively solve this problem.
A simulated data binding method for DSP boards under embedded systems is designed. By initializing hardware resources and serial port modules, including setting clocks, timers, interrupts and serial port self-test, the data binding process is automated and flexible.
The board data simulation binding function of embedded system is realized, saving time and equipment costs, and can dynamically adjust protocol rules and reuse the binding process.
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of application programs under embedded systems. In an application scenario where the system is a DSP, the invention designs and implements a simulation data binding method for a DSP board under an embedded system based on the characteristics of a DSP board and in combination with the characteristics of a serial port channel. Background Art
[0002] As TI's high-performance 32-bit floating-point DSP processor, TMS320F28335 has the characteristics of high precision, low cost, low power consumption, high performance, and high peripheral integration. It is often selected as a communication module node in practical applications.
[0003] In the control equipment system, a large amount of predetermined data needs to be bound to special equipment. The binding equipment based on specific processes usually leads to interruption of joint debugging because it cannot enter the site in time. In order to solve the problem of timely interface testing and functional testing of upstream and downstream data of the equipment, it is necessary to develop simulated binding data equipment. Summary of the invention
[0004] (I) Purpose of the invention
[0005] The purpose of the present invention is to provide a method for simulating data binding of a DSP board in an embedded system, so as to solve the data binding problem of the DSP board in the embedded system.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention provides a method for binding analog data of a DSP board in an embedded system, which comprises the following steps:
[0008] S1: Initialize hardware resources
[0009] Initialize system resources, including clock, timer, and interrupt settings;
[0010] S2: Initialize the serial port module
[0011] First, set the baud rate, stop bit, and check bit parameters of the SCI register, and then perform a serial port self-test;
[0012] S3: Send self-check status and wait for instructions from upper-layer applications
[0013] When the serial port device self-test is completed, the self-test state of the sending binding device is simulated, and during the sending period, it waits to receive the upper-layer application instruction and executes the data binding process according to the upper-layer application instruction.
[0014] Among them, in step S1, when initializing system resources, the operations performed include: setting the system clock; setting the GPIO switch quantity of the board, including the input and output pin settings of the SCI module; initializing the board main frequency and starting the timer; setting the interrupt vector table and interrupt entry function; setting the Flash burning address.
[0015] Wherein, in step S2, initializing the serial port module includes the following steps:
[0016] S21: Set the current serial port device baud rate, stop bit, self-loop, check bit, and data bit attributes according to the channel number;
[0017] S22: Enable the sending and receiving channels;
[0018] S23: Set the receive interrupt receive enable;
[0019] S24: Enable the reset function and fifo function of the serial port;
[0020] S25: Perform a self-test process of the serial port sending and receiving, and judge whether the serial port channel is normal according to the consistency of data sending and receiving. If it is normal, set the self-test flag selfResult to 1;
[0021] S26: Set the sending interface function;
[0022] S27: Set the interrupt receiving interface;
[0023] S28: Set the single data interface getSciChar to read from the receiving register;
[0024] S29: Set the pointer for falling back to get the received message array data.
[0025] Wherein, step S26 comprises the following steps:
[0026] S261: Determine whether the current serial port channel number is legal, if so, proceed to the next step, otherwise exit the sending process;
[0027] S262: loop to determine whether the serial port device of the current channel is ready to send, if yes, proceed to the next step, otherwise jump to step S265;
[0028] S263: Set the waiting time count count minus 1;
[0029] S264: Determine whether the waiting time count is zero, if so, exit the loop waiting process and proceed to the next step, otherwise jump to S262;
[0030] S265: Determine again whether the waiting time count is zero, if so, return the sending incomplete flag, otherwise proceed to the next step;
[0031] S266: Write the sent data into the sending array of the serial port;
[0032] S267: Returns a sending success flag.
[0033] Wherein, step S27 includes the following steps:
[0034] S271: Determine whether the serial port receiving error flag of the current channel is not 1, if so, proceed to the next step, otherwise jump to step S275;
[0035] S272: Read the current byte data from the receiving register of the serial port, store the received data into the receiving array, and move the receiving pointer;
[0036] S273: Determine whether the receiving pointer exceeds the sum of the receiving array length and the first address, if yes, proceed to the next step, if not, jump to step S276;
[0037] S274: reassign the first address of the receiving array to the receiving pointer;
[0038] S275: set the error flag to 1;
[0039] S276: Clear the receive interrupt flag.
[0040] Wherein, step S28 comprises the following steps:
[0041] S281: Determine whether the current channel number is legal, if so, proceed to the next step, otherwise return 0;
[0042] S282: Determine whether the received data pointer cp is empty, if so, return 0, otherwise proceed to the next step;
[0043] S283: Determine whether the receiving pointer recvptr is equal to the data acquisition pointer getptr, if not, proceed to the next step, otherwise return 0;
[0044] S284: assign the data in the address pointed to by the data pointer getptr to the receiving data pointer cp;
[0045] S285: Determine whether the data pointer getptr exceeds the sum of the first address of the receiving array and the receiving length, and if so, reset the data pointer getptr to the first address of the receiving array;
[0046] S286: Return to 1.
[0047] Wherein, step S29 includes the following steps:
[0048] S291: Determine whether the parameter port number is legal, if so, proceed to the next step, otherwise return 0;
[0049] S292: Get the pointer getptr back by n positions of the parameter;
[0050] S293: Determine whether the current acquisition pointer is smaller than the first address of the receiving array. If so, move the acquisition pointer by MAX_REV_NUM positions. Otherwise, exit the process without processing.
[0051] Among them, in step S3, if a self-test end instruction is received, the sending of the self-test status flag is stopped; if a binding write command is received, the protocol is returned, the number of items to be bound is recorded, and the binding data is waited for; if a binding end command is received, the received binding data is saved in a buffer array; if a data read instruction is received, the instruction is returned and the simulated binding data received in the buffer is sent out through the serial port; if a binding confirmation protocol message is received, the simulated binding module no longer receives binding data.
[0052] Wherein, step S3 includes the following sub-steps:
[0053] S31: Enter the main loop;
[0054] S32: Determine whether the serial port receiving error flag is 1, if it is 1, reset the serial port, otherwise proceed to the next step;
[0055] S33: Determine whether the flag init_work of the self-test status is zero, if yes, proceed to the next step, otherwise jump to step S35;
[0056] S34: determine whether the self-test flag selfResult is 1, if so, send the self-test success flag value through the serial port, otherwise send the self-test failure flag value;
[0057] S35: Determine whether the current serial port sending length is 0, if so, set the sending data to zero, and reset the sending pointer position to the first address of the sending array; otherwise, proceed to the next step;
[0058] S36: Get the data at the sending array position where the sending pointer is located and save it in temp;
[0059] S37: Send data through the serial port sending interface;
[0060] S38: Enter the receiving process, the specific steps are as follows:
[0061] S381: cyclically call the single data reading interface getSciChar to determine whether the return value is not zero, if so, proceed to the next step, otherwise exit the process and proceed to step S39;
[0062] S382: Get the first address of the current receive buffer array and store it in bp;
[0063] S383: Store the data ch obtained from the serial port receiving register into the array position of bp distance receiving length;
[0064] S384: Determine the value of the current received length and increase the received length by 1;
[0065] S385: If the current received length is 1, determine whether the current data is a binding confirmation, if yes, reply with a binding confirmation message, and clear the received data length to 0; otherwise, determine whether the current data is a legal message header, if not, clear the received data length; end the current determination process and jump to S381;
[0066] S386: If the current receiving length is 2, determine whether it is a read or write instruction, if not, set the receiving data length to 0, and roll back the receiving array pointer by 1 position, and jump to step S381;
[0067] S387: If the current received length is 3, determine whether the high byte of the storage address is correct. If not, set the received data length to 0, and roll back the receiving array pointer by 2 positions, and jump to step S381;
[0068] S388: If the current receiving length is 4, determine whether the low byte of the storage address is correct. If not, set the receiving data length to 0, and roll back the receiving array pointer by 3 positions, and jump to step S381;
[0069] S389: If the current receiving length is 5, set the current protocol packet data length Msglen to the product of the current data ch and 256, and jump to step a;
[0070] S3810: If the current receiving length is 6, add the protocol packet data length Msglen to the value of the current data ch, and determine whether the current protocol packet data length Msglen is greater than the maximum data length MAX_MSG_LEN. If so, set the receiving data length to 0 and roll back the receiving array pointer by 5 positions. Otherwise, set the protocol frame data length msglen to the protocol frame length MSG_LEN and jump to step S381;
[0071] S3811: If the current received length is another value, perform the following process;
[0072] S80: Determine whether the received length is equal to the protocol frame data length msglen, if yes, proceed to the next step, otherwise jump to step S89;
[0073] S81: Determine whether the frame tail of the current receiving buffer is legal, if so, proceed to the next step, otherwise jump to step S88;
[0074] S82: Set the send self-check status flag to 1;
[0075] S83: Determine whether the second byte of the receive buffer is a write operation, if yes, proceed to the next step, otherwise jump to step S87;
[0076] S84: Determine whether the protocol frame data length msglen is the protocol frame length MSG_LEN, if yes, proceed to the next step, otherwise jump to step S86;
[0077] S85: Set the send length sendLen to MSG_LEN, set the protocol frame data length msgLen to increase the current protocol packet data length MsgLen, and jump to step S89;
[0078] S86: Set the receiving length to 0;
[0079] S87: Set the send length sendLen to the value of MSG_LEN and the protocol packet data length MsgLen, and set the receive length to 0;
[0080] S88: Set the receiving length to 0;
[0081] S89: exit the judgment process and jump to step S80;
[0082] S39: Return to step S31.
[0083] (III) Beneficial effects
[0084] The simulated data binding method of the DSP board in the embedded system provided by the above technical solution can realize the simulated data binding function of the board in the embedded system. The method has been verified by the algorithm and experimentally tested. The results show that the scheme simulates the binding process, parses the received message, and dynamically adjusts according to different protocol rules. It can flexibly repeat the simulated binding process, saving the time cost and equipment cost of joint debugging. DETAILED DESCRIPTION
[0085] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with embodiments.
[0086] In order to solve the problem of data simulation binding function of DSP board in embedded system, a method based on serial port is adopted. The method of data simulation binding of DSP board in embedded system of this embodiment comprises the following steps:
[0087] S1: Initialize hardware resources
[0088] Initialize system resources, including the settings of clocks, timers, and interrupts.
[0089] S2: Initialize the serial port module
[0090] First, set the baud rate, stop bit, and parity bit parameters of the SCI register, and then perform a serial port self-test.
[0091] S3: Send self-check status and wait for instructions from upper-layer applications
[0092] When the serial port device self-test is completed, it simulates the self-test state of the sending binding device, waits for receiving upper-layer instructions during sending, and executes the data binding process according to the upper-layer application instructions.
[0093] In step S1, when initializing system resources, the operations performed include: setting the system clock; setting the GPIO switch quantity of the board, including the input and output pin settings of the SCI module; initializing the main frequency of the board and starting the timer; setting the interrupt vector table and interrupt entry function; setting the Flash burning address.
[0094] In step S2, initializing the serial port module includes the following steps:
[0095] S21: Set the current serial port device's baud rate, stop bit, self-loop, check bit, data bit and other properties according to the channel number;
[0096] S22: Enable the sending and receiving channels;
[0097] S23: Set the receive interrupt receive enable;
[0098] S24: Enable the reset function and fifo function of the serial port;
[0099] S25: Perform a self-test process of the serial port sending and receiving, and judge whether the serial port channel is normal according to the consistency of data sending and receiving. If it is normal, set the self-test flag selfResult to 1;
[0100] S26: Set the sending interface function; the specific steps are as follows:
[0101] S261: Determine whether the current serial port channel number is legal, if so, proceed to the next step, otherwise exit the sending process;
[0102] S262: loop to determine whether the serial port device of the current channel is not ready to send, if yes, proceed to the next step, otherwise jump to step e;
[0103] S263: Set the waiting time count count minus 1;
[0104] S264: Determine whether the waiting time count is zero, if so, exit the loop waiting process and proceed to the next step, otherwise jump to b;
[0105] S265: Determine again whether the waiting time count is zero, if so, return the sending incomplete flag, otherwise proceed to the next step;
[0106] S266: Write the sent data into the sending array of the serial port;
[0107] S267: Return the sending success flag;
[0108] S27: Set the interrupt receiving interface. The specific steps are as follows:
[0109] S271: Determine whether the serial port receiving error flag of the current channel is not 1, if so, proceed to the next step, otherwise jump to step e;
[0110] S272: Read the current byte data from the receiving register of the serial port, store the received data into the receiving array, and move the receiving pointer;
[0111] S273: Determine whether the receiving pointer exceeds the sum of the receiving array length and the first address, if yes, proceed to the next step, if not, jump to step f;
[0112] S274: reassign the first address of the receiving array to the receiving pointer;
[0113] S275: set the error flag to 1;
[0114] S276: Clear the receive interrupt flag;
[0115] S28: Set the getSciChar interface to read a single data from the receiving register. The specific steps are as follows:
[0116] S281: Determine whether the current channel number is legal, if so, proceed to the next step, otherwise return 0;
[0117] S282: Determine whether the pointer cp of the received data is empty, if so, return 0, otherwise proceed to the next step;
[0118] S283: Determine whether the receiving pointer recvptr is equal to the data acquisition pointer getptr, if not, proceed to the next step, otherwise return 0;
[0119] S284: assign the data in the address pointed to by the data pointer getptr to the receiving data pointer cp;
[0120] S285: Determine whether the data pointer getptr exceeds the sum of the first address of the receiving array and the receiving length, and if so, reset the data pointer getptr to the first address of the receiving array;
[0121] S286: return 1;
[0122] S29: Set the pointer to fall back and obtain the received message array data. The specific steps are as follows:
[0123] S291: Determine whether the parameter port number is legal, if so, proceed to the next step, otherwise return 0;
[0124] S292: Get the pointer getptr back by n positions of the parameter;
[0125] S293: Determine whether the current acquisition pointer is less than the first address of the receiving array. If so, move the acquisition pointer by MAX_REV_NUM positions. Otherwise, exit the process without processing.
[0126] In step S3, if a self-test end instruction is received, the self-test status flag is stopped from being sent. If a binding write command is received, the protocol is returned, the number of items to be bound is recorded, and the binding data is waited for. If a binding end command is received, the received binding data is saved in the buffer array. If a data read instruction is received, the instruction is returned and the simulated binding data received in the buffer is sent out through the serial port. If a binding confirmation protocol message is received, the simulated binding module no longer receives the binding data. Before this, the binding process can be repeated.
[0127] Step S3 includes the following sub-steps:
[0128] S31: Enter the main loop;
[0129] S32: Determine whether the serial port receiving error flag is 1, if it is 1, reset the serial port, otherwise proceed to the next step;
[0130] S33: Determine whether the flag init_work of the self-test status is zero, if yes, proceed to the next step, otherwise jump to step S35;
[0131] S34: determine whether the self-test flag selfResult is 1, if so, send the self-test success flag value through the serial port, otherwise send the self-test failure flag value;
[0132] S35: Determine whether the current serial port sending length is 0, if so, set the sending data to zero, and reset the sending pointer position to the first address of the sending array; otherwise, proceed to the next step;
[0133] S36: Get the data at the sending array position where the sending pointer is located and save it in temp;
[0134] S37: Send data through the serial port sending interface;
[0135] S38: Enter the receiving process, the specific steps are as follows:
[0136] S381: cyclically call the single data reading interface getSciChar to determine whether the return value is not zero, if so, proceed to the next step, otherwise exit the process and proceed to step S39;
[0137] S382: Get the first address of the current receive buffer array and store it in bp;
[0138] S383: Store the data ch obtained from the serial port receiving register into the array position of bp distance receiving length;
[0139] S384: Determine the value of the current received length and increase the received length by 1;
[0140] S385: If the current received length is 1, determine whether the current data is a binding confirmation, if yes, reply with a binding confirmation message, and clear the received data length to 0; otherwise, determine whether the current data is a legal message header, if not, clear the received data length; end the current determination process and jump to S381;
[0141] S386: If the current receiving length is 2, determine whether it is a read or write instruction, if not, set the receiving data length to 0, and roll back the receiving array pointer by 1 position, and jump to step S381;
[0142] S387: If the current received length is 3, determine whether the high byte of the storage address is correct. If not, set the received data length to 0, and roll back the receiving array pointer by 2 positions, and jump to step S381;
[0143] S388: If the current receiving length is 4, determine whether the low byte of the storage address is correct. If not, set the receiving data length to 0, and roll back the receiving array pointer by 3 positions, and jump to step S381;
[0144] S389: If the current receiving length is 5, set the current protocol packet data length Msglen to the product of the current data ch and 256, and jump to step a;
[0145] S3810: If the current receiving length is 6, add the protocol packet data length Msglen to the value of the current data ch, and determine whether the current protocol packet data length Msglen is greater than the maximum data length MAX_MSG_LEN. If so, set the receiving data length to 0 and roll back the receiving array pointer by 5 positions. Otherwise, set the protocol frame data length msglen to the protocol frame length MSG_LEN and jump to step S381;
[0146] S3811: If the current received length is another value, perform the following process;
[0147] S80: Determine whether the received length is equal to the protocol frame data length msglen, if yes, proceed to the next step, otherwise jump to step S89;
[0148] S81: Determine whether the frame tail of the current receiving buffer is legal, if so, proceed to the next step, otherwise jump to step S88;
[0149] S82: Set the send self-check status flag to 1;
[0150] S83: Determine whether the second byte of the receive buffer is a write operation, if yes, proceed to the next step, otherwise jump to step S87;
[0151] S84: Determine whether the protocol frame data length msglen is the protocol frame length MSG_LEN, if yes, proceed to the next step, otherwise jump to step S86;
[0152] S85: Set the send length sendLen to MSG_LEN, set the protocol frame data length msgLen to increase the current protocol packet data length MsgLen, and jump to step S89;
[0153] S86: Set the receiving length to 0;
[0154] S87: Set the send length sendLen to the value of MSG_LEN and the protocol packet data length MsgLen, and set the receive length to 0;
[0155] S88: Set the receiving length to 0;
[0156] S89: exit the judgment process and jump to step S80;
[0157] S39: Return to step S31.
[0158] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for binding analog data of a DSP board in an embedded system, characterized in that: The following steps are involved: S1: Initialize hardware resources Initialize system resources, including clock, timer, and interrupt settings; S2: Initialize the serial port module First, set the baud rate, stop bit, and check bit parameters of the SCI register, and then perform a serial port self-test; S3: Send self-check status and wait for instructions from upper-layer applications When the serial port device self-test is completed, the self-test state of the sending binding device is simulated, and during the sending period, it waits for receiving upper-layer application instructions and executes the data binding process according to the upper-layer application instructions.
2. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 1, characterized in that: In step S1, when initializing system resources, the operations performed include: setting the system clock; setting the GPIO switch quantity of the board, including the input and output pin settings of the SCI module; initializing the main frequency of the board and starting the timer; setting the interrupt vector table and interrupt entry function; setting the Flash burning address.
3. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 2, characterized in that: In step S2, initializing the serial port module includes the following steps: S21: Set the current serial port device baud rate, stop bit, self-loop, check bit, and data bit attributes according to the channel number; S22: Enable the sending and receiving channels; S23: Set the receive interrupt receive enable; S24: Enable the reset function and fifo function of the serial port; S25: Perform a self-test process of the serial port sending and receiving, and judge whether the serial port channel is normal according to the consistency of data sending and receiving. If it is normal, set the self-test flag selfResult to 1; S26: Set the sending interface function; S27: Set the interrupt receiving interface; S28: Set the single data interface getSciChar to read from the receiving register; S29: Set the pointer for falling back to get the received message array data.
4. The method for binding simulation data of a DSP board in an embedded system as claimed in claim 3, characterized in that: Step S26 includes the following steps: S261: Determine whether the current serial port channel number is legal, if so, proceed to the next step, otherwise exit the sending process; S262: loop to determine whether the serial port device of the current channel is ready to send, if yes, proceed to the next step, otherwise jump to step S265; S263: Set the waiting time count count minus 1; S264: Determine whether the waiting time count is zero, if so, exit the loop waiting process and proceed to the next step, otherwise jump to S262; S265: Determine again whether the waiting time count is zero, if so, return the sending incomplete flag, otherwise proceed to the next step; S266: Write the sent data into the sending array of the serial port; S267: Returns a sending success flag.
5. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 4, characterized in that: Step S27 includes the following steps: S271: Determine whether the serial port receiving error flag of the current channel is not 1, if so, proceed to the next step, otherwise jump to step S275; S272: Read the current byte data from the receiving register of the serial port, store the received data into the receiving array, and move the receiving pointer; S273: Determine whether the receiving pointer exceeds the sum of the receiving array length and the first address, if yes, proceed to the next step, if not, jump to step S276; S274: reassign the first address of the receiving array to the receiving pointer; S275: set the error flag to 1; S276: Clear the receive interrupt flag.
6. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 5, characterized in that: Step S28 includes the following steps: S281: Determine whether the current channel number is legal, if so, proceed to the next step, otherwise return 0; S282: Determine whether the received data pointer cp is empty, if so, return 0, otherwise proceed to the next step; S283: Determine whether the receiving pointer recvptr is equal to the data acquisition pointer getptr, if not, proceed to the next step, otherwise return 0; S284: assign the data in the address pointed to by the data pointer getptr to the receiving data pointer cp; S285: Determine whether the data pointer getptr exceeds the sum of the first address of the receiving array and the receiving length, and if so, reset the data pointer getptr to the first address of the receiving array; S286: Return to 1.
7. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 6, characterized in that: Step S29 includes the following steps: S291: Determine whether the parameter port number is legal, if so, proceed to the next step, otherwise return 0; S292: Get the pointer getptr back by n positions of the parameter; S293: Determine whether the current acquisition pointer is smaller than the first address of the receiving array. If so, move the acquisition pointer by MAX_REV_NUM positions. Otherwise, exit the process without processing.
8. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 7, characterized in that: In step S3, if a self-test end instruction is received, the sending of the self-test status flag is stopped; if a binding write command is received, the protocol is returned, the number of items to be bound is recorded, and the binding data is waited for; if a binding end command is received, the received binding data is saved in a buffer array; if a data read instruction is received, the instruction is returned and the simulated binding data received in the buffer is sent out through the serial port; if a binding confirmation protocol message is received, the simulated binding module no longer receives binding data.
9. The method for binding simulated data of a DSP board in an embedded system as claimed in claim 8, characterized in that: Step S3 includes the following sub-steps: S31: Enter the main loop; S32: Determine whether the serial port receiving error flag is 1, if it is 1, reset the serial port, otherwise proceed to the next step; S33: Determine whether the flag init_work of the self-test status is zero, if yes, proceed to the next step, otherwise jump to step S35; S34: determine whether the self-test flag selfResult is 1, if so, send the self-test success flag value through the serial port, otherwise send the self-test failure flag value; S35: Determine whether the current serial port sending length is 0, if so, set the sending data to zero, and reset the sending pointer position to the first address of the sending array; otherwise, proceed to the next step; S36: Get the data at the sending array position where the sending pointer is located and save it in temp; S37: Send data through the serial port sending interface; S38: Enter the receiving process, the specific steps are as follows: S381: cyclically call the single data reading interface getSciChar to determine whether the return value is not zero, if so, proceed to the next step, otherwise exit the process and proceed to step S39; S382: Get the first address of the current receive buffer array and store it in bp; S383: Store the data ch obtained from the serial port receiving register into the array position of bp distance receiving length; S384: Determine the value of the current received length and increase the received length by 1; S385: If the current received length is 1, determine whether the current data is a binding confirmation, if yes, reply with a binding confirmation message, and clear the received data length to 0; otherwise, determine whether the current data is a legal message header, if not, clear the received data length; end the current determination process and jump to S381; S386: If the current receiving length is 2, determine whether it is a read or write instruction, if not, set the receiving data length to 0, and roll back the receiving array pointer by 1 position, and jump to step S381; S387: If the current received length is 3, determine whether the high byte of the storage address is correct. If not, set the received data length to 0, and roll back the receiving array pointer by 2 positions, and jump to step S381; S388: If the current receiving length is 4, determine whether the low byte of the storage address is correct. If not, set the receiving data length to 0, and roll back the receiving array pointer by 3 positions, and jump to step S381; S389: If the current receiving length is 5, set the current protocol packet data length Msglen to the product of the current data ch and 256, and jump to step a; S3810: If the current receiving length is 6, add the protocol packet data length Msglen to the value of the current data ch, and determine whether the current protocol packet data length Msglen is greater than the maximum data length MAX_MSG_LEN. If so, set the receiving data length to 0 and roll back the receiving array pointer by 5 positions. Otherwise, set the protocol frame data length msglen to the protocol frame length MSG_LEN and jump to step S381; S3811: If the current received length is another value, perform the following process; S80: Determine whether the received length is equal to the protocol frame data length msglen, if yes, proceed to the next step, otherwise jump to step S89; S81: Determine whether the frame tail of the current receiving buffer is legal, if so, proceed to the next step, otherwise jump to step S88; S82: Set the send self-check status flag to 1; S83: Determine whether the second byte of the receive buffer is a write operation, if yes, proceed to the next step, otherwise jump to step S87; S84: Determine whether the protocol frame data length msglen is the protocol frame length MSG_LEN, if yes, proceed to the next step, otherwise jump to step S86; S85: Set the send length sendLen to MSG_LEN, set the protocol frame data length msgLen to increase the current protocol packet data length MsgLen, and jump to step S89; S86: Set the receiving length to 0; S87: Set the send length sendLen to the value of MSG_LEN and the protocol packet data length MsgLen, and set the receive length to 0; S88: Set the receiving length to 0; S89: exit the judgment process and jump to step S80; S39: Return to step S31.
10. Application of a simulation data binding method of a DSP board in an embedded system according to any one of claims 1 to 9 in an embedded system.