CN103336752A - Microcontroller real-time data transmission device and method - Google Patents

Microcontroller real-time data transmission device and method Download PDF

Info

Publication number
CN103336752A
CN103336752A CN201310254554XA CN201310254554A CN103336752A CN 103336752 A CN103336752 A CN 103336752A CN 201310254554X A CN201310254554X A CN 201310254554XA CN 201310254554 A CN201310254554 A CN 201310254554A CN 103336752 A CN103336752 A CN 103336752A
Authority
CN
China
Prior art keywords
microcontroller
spi interface
target
program
ethernet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310254554XA
Other languages
Chinese (zh)
Inventor
孙雷
章伟康
马亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHANGHAI SOLAR BATTERY RESEARCH AND DEVELOPMENT CENTER
Original Assignee
SHANGHAI SOLAR BATTERY RESEARCH AND DEVELOPMENT CENTER
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHANGHAI SOLAR BATTERY RESEARCH AND DEVELOPMENT CENTER filed Critical SHANGHAI SOLAR BATTERY RESEARCH AND DEVELOPMENT CENTER
Priority to CN201310254554XA priority Critical patent/CN103336752A/en
Publication of CN103336752A publication Critical patent/CN103336752A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a microcontroller real-time data transmission device and a microcontroller real-time data transmission method. The device comprises three parts including a debugging target, a protocol converter and a debugging host, wherein the debugging target comprises a target microcontroller for operating debugged program and is provided with an SPI (serial peripheral interface), in addition, the SPI is provided with a DMA (direct memory access) channel, the protocol converter comprises a relay microcontroller, the relay microcontroller is provided with an SPI and an Ethernet communication module, and the debugging host is a computer and is provided with an Ethernet card. The method comprises the following steps that the real-time data of program variables required in a memory of the debugging target is sent to the protocol converter by the SPI through the DMA channel, the protocol converter carries out protocol conversion on the received data, in addition, the data is transmitted to the debugging host through UDP/IP (user datagram protocol/Internet protocol) via the Ethernet, and the data is displayed to users after being processed by the debugging host and is stored into files.

Description

A kind of microcontroller real time data conveyer and method
Technical field
The present invention relates to a kind of data link and method of the software development debugging for embedded system.
Background technology
Embedded system has a wide range of applications in social economy's every field at present, microcontroller is the core component of embedded system normally, common microcontroller has PIC series, MSP430 series, based on ARM(Advanced RISC Machines) microcontroller of framework, merged DSP(Digital Signal Processing) microcontroller etc.In the research and development of embedded system, the exploitation of software occupies more and more important position, and in software development, debugging is the ten minutes critical step.The debud mode commonly used to microcontroller has: instruction set simulator, resident monitoring software, JTAG emulator and in-circuit emulator.Instruction set simulator can allow the user finish the simple debugging of part on computers, but owing to instruction set simulator and real microcontroller hardware environment differ greatly, so the user also needs to finish further exploitation debugging under the real hardware environment.Resident monitoring software is one section program that operates on the target microcontroller, is undertaken alternately by the debugging software in PORT COM such as Ethernet interface, parallel port, serial port and the Integrated Development Environment, can finish general debugging task; Resident monitoring software is without any need for other hardware debug and emulator, but higher to target microcontroller requirements on hardware equipment, it takies a part of resource on the target microcontroller simultaneously, can not carry out complete simulation to the full speed running of program.The JTAG emulator communicates with the microcontroller kernel by the jtag boundary scanning mouth of microcontroller chip, need not storer and any port of target microcontroller; Integrated Development Environment cooperates JTAG emulator low price, and is easy to connect, is to adopt maximum a kind of debud modes at present.In-circuit emulator use artificial head replaces the microcontroller kernel on the goal systems fully, more deep debug function is provided, but this class design of Simulator complexity, the price comparison costliness, usually be used in the hardware development of microcontroller less use in the exploitation of software.
Debugging for high real-time (μ s level) built-in system software, one of them major issue is that the real time data of program variable when obtaining the program full speed running is with the analytic system running status, seek design defect, this just requires debug system not occupying system resources and real time data that can a large amount of program variables of complete documentation.Instruction set simulator can't be simulated true hardware environment; Resident monitoring software occupying system resources influences high real-time program operational efficiency; A large amount of real time datas that the JTAG emulator produces in the time of can't completely obtaining the operation of high real-time program, the expensive and complicated operation of in-circuit emulator is not suitable for the exploitation debugging of software.
Summary of the invention
Problem based on above-mentioned prior art existence, the objective of the invention is to propose a kind of microcontroller real time data conveyer and method, with the real-time running data of acquisition high real-time (μ s level) microcontroller program, thereby carry out the exploitation debugging of built-in system software.
A kind of microcontroller real time data conveyer of the present invention comprises debug target, protocol converter and debug host three parts composition.
Debug target comprises the microcontroller of a debugged program of operation, that is, and and the target microcontroller, the target microcontroller has the SPI interface, and the SPI interface has DMA(Direct Memory Access) passage.The DMA passage can be sent the program variable real time data in the internal memory by the SPI interface, do not take the operation resource of target microcontroller like this.
Protocol converter comprises a microcontroller, i.e. relaying microcontroller, and the relaying microcontroller has SPI interface and ethernet communication module.Ethernet communication can make the transmission of a large amount of real time datas unrestricted.
Debug host is a computing machine, and computing machine has Ethernet card.
Interconnect by the SPI interface between debug target and the protocol converter, be connected by ethernet communication module, Ethernet, Ethernet card according to this between protocol converter and the debug host.
A kind of microcontroller real time data transfer approach of the present invention is: the real time data of required program variable sends to protocol converter through the DMA passage by the SPI interface in the debug target internal memory, protocol converter carries out protocol conversion with the data that receive, and being sent to debug host by the UDP/IP agreement through Ethernet, being shown to the user after the debug host deal with data and preserving data is file.
Its step is as follows:
A. the SPI interface of debug target setting program configuration target microcontroller is made as host mode with this SPI interface, sets clock rate, clock polarity, clock phase, Frame length simultaneously; Subsequently, the DMA passage of the SPI interface of setting program configuration target microcontroller makes certain sector address in the internal memory, and the data frequency on demand that is the address of depositing the program variable that needs the acquisition real time data is sent to protocol converter through the DMA passage by the SPI interface; So also just realize sending of program variable real time data, and because this sends process and is finished by the DMA passage, therefore do not taken debugged program operation resource.Setting program moves before debugged program is carried out and finishes, and purpose is not move resource with debugged program contention.
B. the SPI interface of translator program configuration relaying microcontroller is made as slave mode with this SPI interface, sets clock rate, clock polarity, clock phase, the Frame length identical with the SPI interface of target microcontroller simultaneously; Subsequently, translator program configuration ethernet communication module makes it to meet the requirement of UDP/IP agreement; Constantly will carry out being sent to debug host by Ethernet by the UDP/IP agreement after the protocol conversion from the data that the SPI interface receives during the translator program operation.
C. debug host application configuration Ethernet card makes it to meet the requirement of UDP/IP agreement, and mainframe program provides user interface and data recording function simultaneously; Constantly receive data by the UDP/IP agreement from Ethernet during the mainframe program operation, data are converted to the form that needs, graphically be shown to the user and generate document data record.
The invention has the beneficial effects as follows, under the situation of the debugged program that jamming target microcontroller not moves, the program variable real time data is sent, and a large amount of real time datas that will send are sent to that computing machine shows and preserve, thereby are convenient to the software development debugging of high real-time (μ s level) embedded system.
Description of drawings
Fig. 1 is the structural representation of a kind of microcontroller real time data conveyer of the present invention, comprises debug target 1, target microcontroller 2, SPI interface 3, protocol converter 4, relaying microcontroller 5, ethernet communication module 6, Ethernet 7, debug host 8 and Ethernet card 9 among the figure.
Embodiment
Below in conjunction with drawings and Examples the specific embodiment of the present invention is described in further detail.
A kind of microcontroller real time data conveyer of present embodiment comprises debug target 1, protocol converter 4 and debug host 8 three parts composition.
Debug target comprises the microcontroller of a debugged program of operation, that is, and and target microcontroller 2, the target microcontroller has SPI interface 3, and the SPI interface has DMA(Direct Memory Access) passage.The DMA passage can be sent the program variable real time data in the internal memory by the SPI interface, do not take the operation resource of target microcontroller like this.
Protocol converter 4 comprises a microcontroller, and namely the relaying microcontroller 5, and the relaying microcontroller has SPI interface 3 and ethernet communication module 6, and ethernet communication can make the transmission of a large amount of real time datas unrestricted.
Debug host 8 is a computing machine, and computing machine has Ethernet card 9.
Interconnect by SPI interface 3 between debug target 1 and the protocol converter 4, be connected by ethernet communication module 6, Ethernet 7, Ethernet card 9 according to this between protocol converter 4 and the debug host 8.
Debug target 1 is the EM-STM3210E development board, and the target microcontroller 2 on the debug target 1 is STM32F103ZE type ARM microcontroller, and this target microcontroller 2 has SPI interface 3, and SPI interface 3 has the DMA passage.Protocol converter 4 is the EKK8962 development board, and the relaying microcontroller 5 on the protocol converter 4 is LM3S8962 type ARM microcontroller, and this relaying microcontroller 5 has SPI interface 3 and ethernet communication module 6, and the EKK8962 development board provides necessary peripheral circuit.Debug host 8 is the microcomputer of band Ethernet card 9.The SPI interface 3 of debug target 1 and 4 of protocol converters adopt five-wire systems is connected (CLK, CS, MISO, MOSI, GND), protocol converter 4 is connected with the Ethernet interface employing crossover network cables of 8 of debug host.
A kind of microcontroller real time data transfer approach of present embodiment, its step is as follows:
Moving debugged program on the debug target 1, the program variable that needs to obtain is 16 integer variables, and the program variable renewal frequency is 18kHz.Before debugged program code, add debug target 1 setting program, setting program at first disposes the SPI interface 3 of target microcontroller 2, this SPI interface 3 is made as host mode, sets clock rate BitRate=2.25MHz, clock polarity SPO=0, clock phase SPH=1, Frame length DataWidth=16 simultaneously.Subsequently, setting program is according to the DMA passage of the SPI interface 3 of the memory address configuration target microcontroller 2 of required program variable, make the DMA passage by greater than the frequency of 18kHz the currency of required program variable directly being read SPI interface 3 from internal memory, be sent to protocol converter 4 by SPI interface 3 afterwards.
Protocol converter 4 programs are based on the RTX real time operating system (RTX Real-Time Operating System) of Keil company, and utilize the TCP/IP network solution (TCP/IP Networking Suite supports TCP, udp protocol) of Keil company to realize the ethernet communication based on the UDP/IP agreement.Translator program at first disposes the SPI interface 3 of relaying microcontroller 5, and this SPI interface 3 is made as slave mode, sets clock rate BitRate=2.25MHz, clock polarity SPO=0, clock phase SPH=1, Frame length DataWidth=16 simultaneously.Subsequently, translator program is opened a UDP Socket, and it is 51654 that port numbers is set, and sending purpose IP address is 192.168.1.127.In translator program when operation, constantly receive 16 integer data from SPI interface 3, and whenever receiving 8 data, just these data to be consisted of length be 16 integer one-dimension array of 8, then this array is sent to debug host 8 by the Socket port by the UDP/IP agreement.
Debug host 8 programs are based on Windows operating system, realize ethernet communication based on the UDP/IP agreement by the Windows system.The IP address of debug host 8 is set to 192.168.1.127 in the Windows system.Mainframe program uses the LabVIEW development system to write, and mainframe program is opened a UDPSocket, and it is 51654 that port numbers is set, and monitoring the IP address is 192.168.1.127, and mainframe program provides user interface and data recording function simultaneously.It is 16 integer one-dimension array of 8 that mainframe program when operation constantly receives length by the Socket port by the UDP/IP agreement, whenever receive 128 arrays and just these arrays are connected to 16 integer one-dimension array by the sequencing that receives, then this array is preserved into document data record, graphically be shown to the user simultaneously.
Present embodiment reaches computing machine with the complete real time data of the program variable that is 18kHz of renewal frequency in the debugged program and shows and preserve, and do not disturb the operation of debugged program on target microcontroller 2, thereby be convenient to the user to the software development debugging of target microcontroller 2.

Claims (2)

1. a microcontroller real time data conveyer comprises debug target (1), protocol converter (4) and debug host (8) three parts composition; It is characterized in that:
Debug target comprises the microcontroller of a debugged program of operation, that is, target microcontroller (2), target microcontroller have SPI interface (3), and the SPI interface has the DMA passage;
Protocol converter comprises a microcontroller, i.e. relaying microcontroller (5), and the relaying microcontroller has SPI interface and ethernet communication module (6);
Debug host is a computing machine, and computing machine has Ethernet card (9);
Interconnect by the SPI interface between debug target and the protocol converter, be connected by ethernet communication module (6), Ethernet (7), Ethernet card (9) according to this between protocol converter and the debug host.
2. microcontroller real time data transfer approach is characterized in that step is as follows:
A. the SPI interface of debug target setting program configuration target microcontroller is made as host mode with this SPI interface, sets clock rate, clock polarity, clock phase, Frame length simultaneously; Subsequently, the DMA passage of the SPI interface of setting program configuration target microcontroller makes certain sector address in the internal memory, and the data frequency on demand that is the address of depositing the program variable that needs the acquisition real time data is sent to protocol converter through the DMA passage by the SPI interface; Setting program moves before debugged program is carried out and finishes, and purpose is not move resource with debugged program contention;
B. the SPI interface of translator program configuration relaying microcontroller is made as slave mode with this SPI interface, sets clock rate, clock polarity, clock phase, the Frame length identical with the SPI interface of target microcontroller simultaneously; Subsequently, translator program configuration ethernet communication module makes it to meet the requirement of UDP/IP agreement; Constantly will carry out being sent to debug host by Ethernet by the UDP/IP agreement after the protocol conversion from the data that the SPI interface receives during the translator program operation;
C. debug host application configuration Ethernet card makes it to meet the requirement of UDP/IP agreement, and mainframe program provides user interface and data recording function simultaneously; Constantly receive data by the UDP/IP agreement from Ethernet during the mainframe program operation, data are converted to the form that needs, graphically be shown to the user and generate document data record.
CN201310254554XA 2013-06-24 2013-06-24 Microcontroller real-time data transmission device and method Pending CN103336752A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310254554XA CN103336752A (en) 2013-06-24 2013-06-24 Microcontroller real-time data transmission device and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310254554XA CN103336752A (en) 2013-06-24 2013-06-24 Microcontroller real-time data transmission device and method

Publications (1)

Publication Number Publication Date
CN103336752A true CN103336752A (en) 2013-10-02

Family

ID=49244922

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310254554XA Pending CN103336752A (en) 2013-06-24 2013-06-24 Microcontroller real-time data transmission device and method

Country Status (1)

Country Link
CN (1) CN103336752A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106547694A (en) * 2016-10-25 2017-03-29 浙江大学 A kind of on-line debugging system based on ARM CortexM4 core processors
CN110568806A (en) * 2019-10-25 2019-12-13 上海电气集团股份有限公司 Servo driver and servo driving system
CN112698587A (en) * 2019-10-23 2021-04-23 杭州先途电子有限公司 Data processing system and method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020133646A1 (en) * 2001-03-16 2002-09-19 Hugo Cheung Method and device for providing high data rate for a serial peripheral interface
CN102118432A (en) * 2010-12-30 2011-07-06 北京林业大学 Wireless multimedia sensor node system oriented to field ecological monitoring
CN102930707A (en) * 2012-11-14 2013-02-13 成都阜特科技股份有限公司 Data collector

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020133646A1 (en) * 2001-03-16 2002-09-19 Hugo Cheung Method and device for providing high data rate for a serial peripheral interface
CN102118432A (en) * 2010-12-30 2011-07-06 北京林业大学 Wireless multimedia sensor node system oriented to field ecological monitoring
CN102930707A (en) * 2012-11-14 2013-02-13 成都阜特科技股份有限公司 Data collector

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106547694A (en) * 2016-10-25 2017-03-29 浙江大学 A kind of on-line debugging system based on ARM CortexM4 core processors
CN106547694B (en) * 2016-10-25 2018-12-11 浙江大学 A kind of on-line debugging system based on ARM CortexM4 core processor
CN112698587A (en) * 2019-10-23 2021-04-23 杭州先途电子有限公司 Data processing system and method
CN110568806A (en) * 2019-10-25 2019-12-13 上海电气集团股份有限公司 Servo driver and servo driving system
CN110568806B (en) * 2019-10-25 2022-05-06 上海电气集团股份有限公司 Servo driver and servo driving system

Similar Documents

Publication Publication Date Title
CN102508753B (en) IP (Internet protocol) core verification system
CN105302950B (en) A kind of programmable logic device crosslinking emulation test method of soft and hardware collaboration
US7058855B2 (en) Emulation interface system
US8281280B2 (en) Method and apparatus for versatile controllability and observability in prototype system
US10180850B1 (en) Emulating applications that use hardware acceleration
CN103117900B (en) Configurable industrial Ethernet data parsing system and parsing method
CN101174283A (en) Software and hardware cooperating simulation platform based on network
CN100557532C (en) A kind of quick control prototype system
CN109783954A (en) A kind of IES joint FPGA hardware emulation acceleration system
CN109299530A (en) A kind of emulation testing case generation method, system, storage medium and terminal
CN103336752A (en) Microcontroller real-time data transmission device and method
CN102929688B (en) The simulator of a kind of simulated touch screen realizes method and this simulator
CN106354598A (en) One-time programmable microcontroller debugging method based on flash memory
CN101281507A (en) USB interface type DSP real-time simulation development system
CN104572515B (en) Tracking module, method, system and on-chip system chip
CN103544086B (en) Two-dimensional tracking turntable electric-control system online data debug system and method
CN102270175A (en) Simulation test method of data acquisition software
CN107943625A (en) A kind of MCU test methods for simulating various communication interfaces
CN107526585B (en) Scala-based FPGA development platform and debugging and testing method thereof
CN203502952U (en) On-line debugging system of two-dimensional tracking rotary table electric control system data
CN102999373A (en) Stimulator for stimulating press-key apparatus and implement method of stimulator
US20230229583A1 (en) Microchip with on-chip debug and trace engine
CN108415839A (en) The development frame of multinuclear SoC chip and the development approach of multinuclear SoC chip
CN110018959B (en) Embedded application debugging method and system
Niaki et al. Heterogeneous system-level modeling for small and medium enterprises

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20131002