step one:
To set it on the board, on the board to
P4 terminals RXD and PA9 ( the STM32 's TXD ), TXD and PA10 (STM32 's RXD)
connected by a jumper , so we put
CH340G
and
MCU
serial port
1
connector
on Up.
In order to allow lower after downloading can press the reset execution of the program , we suggest that you
BOOT1 and BOOT0 are set to 0
. The setting is completed as
shown in Figure
4.2.1
:
Here is a brief explanation of the principle of the one-click download circuit. We know that
the standard method of
STM32
serial port download is two steps:
1
, the
B0 connected V3.3 (holding B1 connected the GND
) .
2.
Click the reset button .
Through these two steps, we can download the code through the serial port. After the download is completed, if there is no setting to
start running
from 0X08000000 , the code will not run immediately. At this time, you also need to connect
B0
back to
GND
, and then press again
The code you just downloaded will start to run after the second reset. So the whole process, you have to beat
2
times jumpers, have to press
2
times a
reset, more complicated. Our one-key download circuit uses the
DTR
and
RTS
signals of the
serial port to control the reset and B0 of the
STM32
respectively , and cooperates with the upper computer software ( flymcu , the latest version of mcuisp ) to set: DTR low reset, RTS high into the level of BootLoader , so that, B0 and STM32 reset, fully automatically controlled by the download software to implement a key to download.
Step two:
Then we
insert the USB cable at
USB_232
and connect it to the computer. If the driver of CH340G has not been installed before (if the driver has been installed, you should be able to see the USB serial port in the device manager . If not, uninstall the previous one. drive, restart the computer after uninstalling and then reinstalling the drivers we provide), you need to install CH340G driven, find the CD-ROM → software information → under software folder CH340 drive, install the drive, as shown in 4.2.2 are Show:
After the driver is installed successfully, unplug the
USB
cable, and then plug it back into the computer. At this time, the computer will automatically install the driver for it. After installation is complete, the computer can be found inside the device manager
USB
serial port (if not found, to restart the electrical
brain), as shown in
4.2.3
below:
As
you can see in Figure
4.2.3
, our
USB
serial port is recognized as
COM3
. It should be noted here: different computers may be different, yours may be
COM4
,
COM5,
etc., but
USB-SERIAL CH340
, this must be the same of.
If the
USB
serial port is not found
, it may be that you have installed it incorrectly or the system is not compatible.
Step three:
Installed
USB
after serial driver, serial port we can begin to download the code, here we are serial download software selection is
flymcu
, the software is
mcuisp
upgrade version (
flymcu
added to
STM32F4
supported) by
ALIENTEK
provide partial sponsorship ,
mcuisp
authors developed, the software can be
www.mcuisp.com
free download, CD manual is also
included with this software version
V0.188
. The software startup interface is
shown in Figure
4.2.4
:
Step 4:
Then we choose to download
Hex
file to the front of our new project as an example, because we've established at the time of the project, has been set up to generate
Hex
file, the compiler has been generated when the
Hex
file, we just need to find
the
The Hex
file can be downloaded.
Step Five:
Open the OBJ folder with
flymcu
software
, find the corresponding hex file Template.hex , open it and make the corresponding settings, as shown in Figure 4.2.5 :
The settings in the circle in Figure
4.2.5
are our recommended settings. Execute after programming. This option is very useful when there is no one-key download function. When this option is selected, the code can be automatically run after the program is downloaded. Otherwise, also need to press
the reset button, you can start running code just downloaded.
Step Six:
Reload the file before programming, this option is also more useful. When this option is selected,
flymcu
will
reload the
hex file before each programming , which is more useful for code debugging.
Special reminder:
Do not choose to use
RamIsp
,
otherwise, it may not be able to download normally.
Finally, we choose the
low level reset of
DTR and
the
high level of
RTS
into
BootLoader
. When this option is selected,
flymcu will
control the onboard one-key download function circuit through
DTR
and
RTS
signals to realize the one-key download function. If you choose not to
choose, you can not achieve a key to download. This is a necessary option (under
the condition that
BOOT0 is
connected to
GND
).
Loading the
hex
after the file we want to download the code also need to select the serial port, here
flymcu
intelligent serial search function
can. Every time you open the
flymcu
software, the software will automatically search for the available serial ports on the current computer, and then select one as the default
serial port (usually the serial port you selected the last time you closed it). You can also search for the serial port click on the menu bar, to implement
now automatically search for currently available serial port. The serial port baud rate can be
set through
bps
. For
STM32F103
, it can be set
to the highest:
460800
, and if it is
F4
, the highest recommended setting is:
76800
That's it. Then, find
CH340
virtual serial
port, as shown in
4.2.6
below:
Step Seven:
Prior to the
USB
port of the installation can be seen, the development board
USB
port is identified as
COM3
(if your computer is being recognized as another serial port, you can select the appropriate serial port), so we chose
COM3
, set the baud rate
460800
.
Once set up, we can press
to start programming (
P
)
button, a button to download the code
STM32
on the download
after successfully FIG
4.2.7
below:
In Figure
4.2.7
, we circle
the control process of
flymcu
to the one-key download circuit, which is actually to control
the changes of
DTR
and
RTS levels, control
BOOT0
and
RESET
, so as to realize automatic download. In addition, because
STM32F1
of each download
requires full chip erase, and
STM32F1
the full chip erase is very slow (
STM32F1
faster), erase the entire film here,
have
to wait several seconds
before they can execute complete , Please be patient. However,
ST-LINK
downloading this problem does not exist, the
order, we recommend that,
conditional, it is best to use
ST-LINK
download faster
.
Step eight:
In addition, after the download is successful, there will be
a prompt of "write
xxxxKB in
total
, time-consuming
xxxx
milliseconds", and
start to run
from 0X80000000, we open the serial debugging assistant (
XCOM V2.0
, on the CD
→
6
, software information
→
software
→
Serial port
In the test assistant) select
COM3
(you have to choose according to your actual situation), set the baud rate:
115200
, and you will find
the information sent back
from the ALIENTEK MiniSTM32 development board, as shown in Figure
4.2.8
:
The received data is the same as we expected, proving that there is no problem with the program. So far, it shows that we have successfully downloaded the code and verified the correctness of our code from the hardware.