STM8 simulation running swim comm timeout

Publisher:哈哈哈33Latest update time:2016-07-27 Source: eefocusKeywords:STM8 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
There are many reasons for the program to run away. Let me talk about the situation where there is no problem with the program but the program runs away inexplicably.

Why do we say the program is fine? First of all, it compiles successfully, and secondly, we have configured the registers correctly, but it still runs wrong.

Especially compared to the STM8S103F3 and other microcontrollers with only a pitiful 8K storage space, it is really painful. Okay, no more nonsense, based on my experience:

Use IAR platform, COSMIC is very bad, I advise you not to use it.

1. The debug mode optimization is set to none. If the program still crashes after compiling and running under this condition, it may be due to the Option byte setting problem. For example, if you use the PWM function of TIM2_CH1, but your Option byte is not set, the program will crash when running (this is the first time I have encountered such a weird MCU).

2. If the program is really large, you need to set the optimization to middle, so be careful. IAR's optimization has some minor issues. Although middle can be compiled, it may crash when downloaded. Be especially careful. The solution is to optimize the code and try to get a usable version with optimization set to none, and then slowly add other code, otherwise you will end up with a very ugly death!

Keywords:STM8 Reference address:STM8 simulation running swim comm timeout

Previous article:STM8 SPI routine communication error
Next article:STM8 chip application precautions

Recommended ReadingLatest update time:2024-11-17 01:39

About the difference between i2c and spi protocols for debugging stm32 and stm8 (51 microcontroller)
When debugging the STM32's i2c and io ports to simulate the spi protocol, I found that timing is critical. STM32 can implement i2c or spi protocols at 72M, but it does not mean that the same code will run successfully on a 51 microcontroller, because the 51 microcontroller has a maximum speed of 8M, so there will be ma
[Microcontroller]
STM8 DS18B20 temperature sensor subroutine
software design /********************************************************************* Purpose: Create a DS18B20 operation library Target system: Based on STM8 microcontroller  Application software: Cosmic CxSTM8  *********************************************************************/ void _delay_us(u8 us) { while(-
[Microcontroller]
STM8 register operation GPIO
Hardware platform: stm8s103  Compilation environment: IAR for stm8 #include iostm8s103f3.h #include intrinsics.h int main(void) {     // Initialize port D.     PD_ODR_ODR4 = 0; //PD4 outputs low level     PD_DDR_DDR4 = 1; //Set D port, bit 4 output     PD_CR1_C14 = 1; //Pin is set to pull-up output     PD_CR2_C2
[Microcontroller]
STM8 BUS OFF fast and slow recovery strategy
Preface: An error on the CAN bus will cause the CAN controller to enter the BUS OFF state. For details, please refer to the CAN specification. The CAN controller provides automatic recovery and manual recovery functions. 1. Automatic recovery Automatic recovery is relatively simple, turn on the automatic recov
[Microcontroller]
VFD electronic clock production
hardware: 1. Royer oscillator circuit outputs one 4V AC and one 25V AC   4V directly drives the filament, and the other path provides negative voltage to pt6311 through bridge rectification. 2. The main control uses stm8s003f3    The cost is low, and these stm8s are given by the shopkeeper of xbao, which are also very
[Microcontroller]
VFD electronic clock production
STM8 HSI clock correction register
STM8 HSI clock correction register (CLK_HSITRIMR) Address offset value: 0x0C Reset value: undefined Position 7:4 Reserved. Always 0. Bit 3:0 HSITRIM : HSI trim value written by software to fine-tune the HSI calibration value Note: On high-density products, only bits 2:0 are available. On medium-density or small-de
[Microcontroller]
STM8 HSI clock correction register
STM8 8-bit MCU development environment construction
1 Install STVD and STVP   After the installation is complete, the following icon appears.  According to the prompts during the installation process, you need to shut down and restart at this time. After the restart is complete, you can open the project with ST Visual Develop.   Click the Compile
[Microcontroller]
STM8 8-bit MCU development environment construction
About the failure of using IAR software stlink to download stm8 program
I used to use IAR normally, but this time I used stlink to download, and stlink could not download for unknown reasons. I turned off the power and restarted it. Sometimes it worked, but sometimes it really did not work. The prompt message was as shown in the figure below. Failed to initialize communcation with hardw
[Microcontroller]
About the failure of using IAR software stlink to download stm8 program
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号