CN109240719A - A kind of Program download based on STM32 - Google Patents
A kind of Program download based on STM32 Download PDFInfo
- Publication number
- CN109240719A CN109240719A CN201710533530.6A CN201710533530A CN109240719A CN 109240719 A CN109240719 A CN 109240719A CN 201710533530 A CN201710533530 A CN 201710533530A CN 109240719 A CN109240719 A CN 109240719A
- Authority
- CN
- China
- Prior art keywords
- chip
- stm32
- program
- chip microcontroller
- serial ports
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a kind of Program download based on STM32, including STM32 single-chip microcontroller, SPI interface, CP2102 serial port chip, USB interface, voltage regulator circuit, key and indicator light, the operations such as the FLASH read-write to NRF24LU/E family chip are realized.The USB interface is connected to CP2102 chip, and the serial ports pin of CP2102 chip is connected to STM32 serial ports end, and the SPI interface of STM32 is connected on the NRF24LU/E chip of program to be downloaded, while being separately connected PROG, CSN, RST pin.Program download step is as follows: the USB interface of downloader is connected to computer, it is sent and is instructed to STM32 single-chip microcontroller using upper computer software, and suitable program the download option is selected according to feedback information, the program file of HEX and BIN format is opened by host computer, and be sent to STM32 single-chip microcontroller;STM32 single-chip microcontroller converts byte type array for program according to file type, the operation such as is written and read finally by FLASH of the SPI interface to NRF24LU/E family chip.This Program download is at low cost, and speed of download is fast, supports two kinds of program file formats, and high reliablity is easy to operate.
Description
Technical field
The invention belongs to computer fields, and in particular to a kind of Program download based on STM32.
Background technique
The program burn writing of many chips is realized by SPI interface, the reason is that SPI interface transmission speed is fast, data pass
It is defeated reliable.Particularly, NRF24LU and NRF24LE family chip is highly suitable for as a kind of wireless communication solution
The wireless transmission of usb data, the FLASH of such chip are exactly based on SPI interface and carry out programming.But it is directed to such core in the market
The Program download of piece price usually with higher, so that the design cost of such radio communication system is got higher.Due to program
Itself firmware of downloader limits, and matched host computer procedure is difficult to ensure while to the program of two kinds of formats of HEX and BIN text
The support of part, the using flexible so as to cause some existing Program downloads are lower.
Summary of the invention
For the deficiency of the Program download of existing NRF24LU/E family chip, the present invention provides one kind to be based on
The Program download of STM32, using following technical scheme:
Program download based on STM32, hardware circuit include STM32 single-chip microcontroller, hardware SPI interface, CP2102 serial ports
Chip, USB interface, voltage regulator circuit, key and indicator light.
Wherein, USB interface is connected to CP2102 chip, and the serial ports pin of CP2102 chip is connected to the serial ports end of STM32,
The SPI interface of STM32 is connected on the NRF24LU/E chip of program to be downloaded, while being connected to that PROG pin, CSN are enabled to be drawn
Foot, RST reset pin.
In above-mentioned Program download, STM32 single-chip microcontroller receives the program file of HEX or BIN format, root by serial ports
Byte type array is converted by program file according to file type.
Further, STM32 single-chip microcontroller is sent to by the byte type array comprising program data by hardware SPI interface
NRF24LU/E family chip realizes that the FLASH of such chip is erasable and reads.
In the present invention, STM32 single-chip microcontroller realizes the data exchange with PC computer terminal by CP2102 serial port chip,
Receive the state of program file and feedback process downloading.
In the present invention, the host computer procedure of PC computer terminal is the serial ports software that C# writes, and configures serial ports, receives and dispatches serial ports
Data, and open HEX or BIN file.
The beneficial effects of the present invention are: the present invention receives program file, benefit using STM32 single-chip microcontroller as core, using serial ports
External FLASH chip is read and write with SPI interface;It is easy to operate, support file type it is more, at low cost, integrated level is high, practicability is high.
Detailed description of the invention
Composition block diagram Fig. 1 of the invention
Hardware circuit PCB figure Fig. 2 of the invention
Software flow pattern Fig. 3 of the invention
Specific embodiment
As shown in Figure 1, STM32 singlechip controller is core of the invention, including hardware SPI interface, serial ports, timing electricity
Road etc., peripheral circuit is by CP2102 serial port module, voltage regulator circuit, key and indicator lamp groups at main completion program file
Data receiver, and, realization program download function erasable to the FLASH of external chip is completed by SPI interface;In addition, STM32
The real-time status that single-chip microcontroller can download program is fed back to computer terminal.The present invention selects STM32F103RCT6 chip, due to it
With 48k internal storage space, meet the 16k/32k requirement of external chip FLASH, whole hardware circuit such as Fig. 2 institute of system
Show.
The initialization program of STM32 single-chip microcontroller: the work clock of single-chip microcontroller is configured to 72M;SysTick is configured in 10us
It is disconnected primary;Serial ports is opened serial data and is interrupted receive capabilities using PA9 and two pins of PA10, baud rate selection 38400;
For SPI interface using PB13, PB14, PB15 respectively as SCK, MISO, MOSI pin, clock idle state is set as low level,
Data transmission is arranged first hopping edge;It configures PA8, PB12, PB11 and exports control pin respectively as PROG, CSN, RST;
TIM2 timer is configured, to record the time of external chip program burn writing.It completes above-mentioned with postponing, into major cycle, receives
The instruction of host computer.
STM32 single-chip microcontroller receives program file and is converted into the byte type array that can be used for programming: as shown in figure 3, monolithic
After machine receives the string data that computer is sent, serial ports can be triggered and receive interrupt function, the byte received can be protected in function
It is stored in buffering array.Main circulating program can read buffer data, and judge its file type according to first byte, for HEX
The character string of format decodes its software using HEXUTILS tool, and stores;For BIN format string, single-chip microcontroller is direct
It is stored in byte type array, byte type array needed for finally obtaining the FLASH programming of external chip.
Program downloading to external chip: being the function that sends and receivees of the byte data of SPI interface first, the present invention adopts
With speed is fast, hardware SPI communication function of high reliablity, the SPI data communication function as bottom;By calling SPI communication
Function selects information page, sends and reads chip instruction and the address ID, and the ID of chip, verifying single-chip microcontroller and core to be programmed can be read
The communication connection of piece;When executing the chips such as erasing, burning FLASH operation, PROG pin need to set height, CSN pin enables, RST
Pin is drawn high;When downloading program to external chip, the data of entire chip are wiped first, and then program, every page of packet are downloaded in paging
Containing 250 byte datas, in every page programming, first by the first address of SPI write-in programming, then successively sent out by the size of page
Send the data in byte type array.After completing program downloading, the FLASH data of recycling SPI interface reading external chip, and with
Data in byte type array compare one by one, guarantee that all bytes are correct.Experiment test, this Program download is to outside
NRF24LU chip downloads 1424 byte data time-consuming 377ms.
Status information feedback: when reading the status register of external chip, this downloader can in real time be read and write program
Host computer and display of the state feedback to computer terminal;The array of external chip data and single-chip microcontroller after program downloading is compared
Compared with, if program downloading it is wrong, can also feed back host computer and show;To guarantee the reliability and human-computer interaction of Program download
Ability.
Matched host computer: the computer terminal host computer write using C#, major function are to read HEX or BIN format
Program file, and it is converted into character string, STM32 single-chip microcontroller is sent to by serial ports, realizes the communications of program file.
A kind of Program download based on STM32 provided by the present invention is described in detail above, for ability
The those skilled in the art in domain, the scheme of technology, has change in specific embodiments and applications according to the present invention
Place, in conclusion the contents of this specification are not to be construed as limiting the invention.
Claims (5)
1. a kind of Program download based on STM32, which is characterized in that including STM32 single-chip microcontroller, hardware SPI interface, CP2102
Serial port chip, USB interface, voltage regulator circuit, key and indicator light.Main completion is erasable to the FLASH of NRF24LU/E family chip
And the read functions of verifying function and chip information.The USB interface of the downloader is connected to CP2102 chip, CP2102
The serial ports pin of chip is connected to the serial ports end of STM32, and the SPI interface of STM32 is connected to the NRF24LU/E core of program to be downloaded
On piece, while being connected to PROG pin, CSN enabled pin, RST reset pin.
2. a kind of Program download based on STM32 according to claim 1, which is characterized in that STM32 single-chip microcontroller passes through
Serial ports receives HEX the or BIN formatted file that computer transmits, and for BIN format string, single-chip microcontroller is directly by storage of array to word
In nodal pattern array;For the character string of HEX format, single-chip microcontroller is decoded it using HEXUTILS tool, obtains FLASH volume
The byte type array of Cheng Suoxu.
3. a kind of Program download based on STM32 according to claim 1, which is characterized in that STM32 single-chip microcontroller passes through
Common I/O port controls the PROG pin of NRF24LU chip, CSN enables pin;By the hardware SPI interface of STM32, realize single
The high speed data transfer of piece machine and FLASH chip to be programmed, so that chip is write in byte type array data obtained above
In the specified address area of FLASH.
4. a kind of Program download based on STM32 according to claim 1, which is characterized in that the string of STM32 single-chip microcontroller
Mouth is connected on CP2102 chip, which is that USB turns serial port chip, and USB interface is directly connected on computers, realize computer
With the data communication of STM32 single-chip microcontroller.
5. a kind of Program download based on STM32 according to claim 1, which is characterized in that upper computer software is benefit
The serial data transfer program write with C#, which can be arranged and connect serial ports, and read HEX and BIN file, and pass through
Program file is sent to STM32 single-chip microcontroller with character string forms by serial ports.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710533530.6A CN109240719A (en) | 2017-07-03 | 2017-07-03 | A kind of Program download based on STM32 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710533530.6A CN109240719A (en) | 2017-07-03 | 2017-07-03 | A kind of Program download based on STM32 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109240719A true CN109240719A (en) | 2019-01-18 |
Family
ID=65083279
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710533530.6A Pending CN109240719A (en) | 2017-07-03 | 2017-07-03 | A kind of Program download based on STM32 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109240719A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110321146A (en) * | 2019-07-02 | 2019-10-11 | 杭州雄迈集成电路技术有限公司 | A method of the more new chip FT test program of the Pattern based on serial port protocol |
CN111338658A (en) * | 2020-02-27 | 2020-06-26 | 上海电力大学 | Method and system for downloading PIC single-chip microcomputer program based on stm32CPU |
CN111857742A (en) * | 2020-06-05 | 2020-10-30 | 珠海市运泰利自动化设备有限公司 | Method for burning STM32 single chip microcomputer in serial port under apple computer OS X system |
CN112052046A (en) * | 2020-07-24 | 2020-12-08 | 乐歌人体工学科技股份有限公司 | Method for modifying motor control parameters of lifting device |
CN114168500A (en) * | 2021-12-01 | 2022-03-11 | 武汉港迪技术股份有限公司 | System-free single chip microcomputer multi-interface extension method |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514018A (en) * | 2013-10-08 | 2014-01-15 | 上海电力学院 | Method for remotely downloading programs based on STM32F4 controller |
CN205302264U (en) * | 2015-12-23 | 2016-06-08 | 歌尔声学股份有限公司 | Program downloader |
-
2017
- 2017-07-03 CN CN201710533530.6A patent/CN109240719A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514018A (en) * | 2013-10-08 | 2014-01-15 | 上海电力学院 | Method for remotely downloading programs based on STM32F4 controller |
CN205302264U (en) * | 2015-12-23 | 2016-06-08 | 歌尔声学股份有限公司 | Program downloader |
Non-Patent Citations (1)
Title |
---|
邢凯 等: "基于STM32的STC单片机脱机下载器的设计与实现", 《广西民族大学学报(自然科学版)》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110321146A (en) * | 2019-07-02 | 2019-10-11 | 杭州雄迈集成电路技术有限公司 | A method of the more new chip FT test program of the Pattern based on serial port protocol |
CN111338658A (en) * | 2020-02-27 | 2020-06-26 | 上海电力大学 | Method and system for downloading PIC single-chip microcomputer program based on stm32CPU |
CN111338658B (en) * | 2020-02-27 | 2023-10-10 | 上海电力大学 | Method and system for downloading PIC (personal computer) singlechip program based on stm32CPU (Central processing Unit) |
CN111857742A (en) * | 2020-06-05 | 2020-10-30 | 珠海市运泰利自动化设备有限公司 | Method for burning STM32 single chip microcomputer in serial port under apple computer OS X system |
CN112052046A (en) * | 2020-07-24 | 2020-12-08 | 乐歌人体工学科技股份有限公司 | Method for modifying motor control parameters of lifting device |
CN114168500A (en) * | 2021-12-01 | 2022-03-11 | 武汉港迪技术股份有限公司 | System-free single chip microcomputer multi-interface extension method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109240719A (en) | A kind of Program download based on STM32 | |
US8296467B2 (en) | Single-chip flash device with boot code transfer capability | |
US20050114587A1 (en) | ExpressCard with On-Card Flash Memory with Shared Flash-Control Bus but Separate Ready Lines | |
US7103684B2 (en) | Single-chip USB controller reading power-on boot code from integrated flash memory for user storage | |
US7483329B2 (en) | Flash card and controller with integrated voltage converter for attachment to a bus that can operate at either of two power-supply voltages | |
US20080256352A1 (en) | Methods and systems of booting of an intelligent non-volatile memory microcontroller from various sources | |
CN201828921U (en) | Integrated dual-frequency card reader | |
US20070168614A1 (en) | Secure-Digital (SD) Flash Card with Auto-Adaptive Protocol and Capacity | |
CN109542478A (en) | A kind of system and method updating FPGA program in SPI Flash | |
CN101454746A (en) | Method for communication with a multi-function memory card | |
CN110413298A (en) | The method that single-chip microcontroller serially upgrades and debugs is carried out based on Labwindows platform | |
TW201145037A (en) | USB-attached-SCSI flash-memory system with additional command, status, and control pipes to a smart-storage switch | |
CN102623069A (en) | Random excitation flash model verification method | |
EP1403814B1 (en) | Electronic apparatus, information processing apparatus, adapter apparatus, and information exchange system | |
CN107526614B (en) | Communication method of FPGA development board | |
CN109725941A (en) | A kind of programmable initial method and system for display driver chip | |
CN102446137B (en) | Method for writing data, Memory Controller and memorizer memory devices | |
CN209086915U (en) | C8051F SCM program burning device | |
CN102915273A (en) | Data writing method, memory controller and memory storage device | |
CN204155612U (en) | The burned device of flash memory and burned system | |
CN101887710B (en) | Display having EDID (Extended Display Identification Data) automatic burning function at first boot | |
CN103577344A (en) | Data writing method, memory controller and memory storage device | |
CN102193860A (en) | Microcontroller online debugging circuit and method as well as microcontroller | |
CN103902298B (en) | Method to set up and the device of status information write with a brush dipped in Chinese ink by a kind of instruction set firmware | |
CN100511196C (en) | Data processing chip and memory device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190118 |