Use SWIM to implement ST-LINK-like functions and download files to STM8

Publisher:轻松自在Latest update time:2020-04-04 Source: eefocusKeywords:SWIM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Technology dependencies: SWIM communication, FLASH operation, serial port, DMA.


The main idea is to implement the command line tool through the serial port, and then burn the slave through the host's swim. The serial port data is sent through DMA.


SWIM communication has been introduced before, you can check it out if you need it. This article mainly introduces the idea of ​​SWIM when programming STM8.


1. Burn directly through WOTF.

This method is indeed feasible, but after actual testing, it was found that the failure rate of WOTF during the programming process caused the programming speed to be extremely slow. It is not recommended.


2. Let the slave burn the flash by itself

We know that when burning flash, there is block burning. And the block burning program is running in RAM. We can use this feature to download the written flash block burning program (specify the address of the data to be burned and the address to be burned) to the specified address of the slave RAM through SWIM. Then control the slave through the host to complete the self-burning.

In this process, we need to transfer the data transmitted from the serial port to the specified address in the slave's RAM, and transfer the address to the specified address in the slave's RAM. We complete the "self-burning" by controlling the slave's CPU to run the code burned into the RAM in advance.


Note:

The code we need to burn cannot be written in one block, so after burning a block, we need to pause the slave (by controlling the slave CPU), reset the slave during the next burning, and then execute the code to burn FLASH.

Keywords:SWIM Reference address:Use SWIM to implement ST-LINK-like functions and download files to STM8

Previous article:IAR has SWIM error [30004]
Next article:Jlink cannot perform OptionByte operation on STM05x (CM0)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号