About STM8S001J learning process record

Publisher:koimqerolulkLatest update time:2021-09-14 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

(If you need IAR installation package, STM8S001J firmware package and information, please contact me. I will not upload files.)


Installation of the first compilation environment

I chose IAR software, this software needs to be cracked, so it needs a registration machine to activate. The process is Baidu IAR crack installation, the first one is Baidu Knows. The steps are relatively simple and easy to understand. The only problem I encountered is that when the registration machine is activated, the type is not selected correctly, so the activation of the ActivationInfo file fails, and there is no response file.


The reason for this problem is that the default is ARM, and there is STM8 in the options later. We need to select this before it can be activated successfully.


The establishment of the second project

Project creation: 1. To create a workspace, select the menu File->New Workspace

insert image description here

2. To create a project, select the Project menu, select Create New Project

insert image description here

3. After the creation is completed, we need to change the parameters of the project. Right-click the parameter name, a menu will appear, and select the first Options...

insert image description here

4. Click Options… The following interface appears. The red box contains the various options we need to choose.

(1) Click the first option, general options

insert image description here

Select the model of the microcontroller used in the Target Device

5. The second step is to click the third C/C++ Compiler in the vertical row on the left.

insert image description here

We click the green arrow in the Preprocessor option of C/C++ Compiler to add the path of our header file, otherwise it will not compile. The point to note is that after clicking the blue arrow Click to add, add the directory and change it to PROJDIR PROJ_DIRPROJ 

D

 IR format. This is easy to make mistakes!

6. Click Output Converter on the left. I set it up like this to generate a HEX file.

insert image description here

7. Click Debugger on the left, select ST-LINK, and choose to use ST-LINK for debugging

8. Add project files

insert image description here

Use of STM8S001J MCU


1. Selection of firmware library

I chose version 2.3.1. Some versions do not support this chip and cannot find this type of chip.


2. STM8S001J can only be programmed once and cannot be programmed repeatedly, and the microcontroller is locked

Question: When I want the microcontroller to communicate with the PC through the serial port, after setting the serial port initialization and serial communication baud rate, and burning the code to the microcontroller, I can enter the DEBUG. When I single-step to the library function of the serial port initialization, it will run away. After a few seconds, the system automatically exits the DEBUG.


Solution: I thought the MCU was broken at first, but it didn't work even after I replaced it. The solution is that the default pin of the option bytes is 8-pin as UART1_TX. Once the serial port is initialized, the SWIM on 8-pin will be initialized as UART1_TX, which can't be used as a debug line during DEBUG, so an error is reported.

So we need to change the 01 of ST-LINK's option bytes to a high voltage, use pin 5 as UART1_TX, and then delay for five seconds at the beginning of the code. If the setting is not successful, you can re-burn it. If there is no delay, the 8-pin SWIM will be initialized as soon as the power is turned on, and we will not be able to burn the code, and the MCU will be locked.

Reference address:About STM8S001J learning process record

Previous article:STM8 lights up the first LED
Next article:STM8L firmware burning encryption process

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号