1. The concept of option bytes (refer to stm8s Chinese data sheet):
The option bytes include the configuration of the chip hardware features and the protection information of the memory. These bytes are stored in a dedicated
block in the memory. In addition to the ROP (read-out protection) byte, each option byte must be saved twice, one in the usual format (OPTx) and
one in the complementary format (NOPTx) for backup. The option bytes can be modified in ICP mode (via SWIM) by accessing the EEPROM address in the table below.
The option bytes can also be modified by the application in IAP mode, but the ROP option can only be
modified in ICP mode (via SWIM).
2. The concept of ISP IAP ICP (to be learned):
ISP: In System Programing, In System Programming Program is fully downloaded
IAP: In applicating Programing, in application programming, my understanding is to use the application to modify some fixed data in the chip (data not related to application programming)
ICP: In Circuit Programing
3.Remapping of alternate functions of stm8s chip:
The stm8s chip has many spare functions, which can only be realized by using the remapping function.
Remapping is actually configuring a certain bit of a flash address to make a pin have one of the alternate functions or the default function.
And once the function is changed, it must be rewritten if you want to restore the original function.
For example, the PD4 port of stm8s has TIM2_CH1 function and BEEP function. By default, it is TIM2_CH1 function.
When we want to use the BEEP function, we must write the option word to remap this pin to the BEEP function.
register:
Multiple alternative functions of stm8s:
4. Library function to implement remapping
//For stm8s, the option word address is 0x4803
#define Beep_OptionAdd 0x4803
void Set_Beep_OptionByte(void)
{
uint16_t Beep_Option_status;/*Record the status of activating the optional function Beep/TIM2_CH1*/
Beep_Option_status=FLASH_ReadOptionByte(Beep_OptionAdd);
/*The highest bit of Beep_Option_status is 1 to activate Beep, otherwise it is not activated, which is TIM2_CH1*/
if((Beep_Option_status&0x8000))
{
FLASH_ProgramOptionByte(Beep_OptionAdd, (uint8_t)(Beep_Option_status&0x7fff));
/*Set Beep_OptionAdd 0x4803 to 0, deactivate and activate Beep, and restore the TIM2_CH1 channel*/
}
}
Previous article:STM8 serial port prints debugging information
Next article:[STM8] Encryption program through STM8 chip unique ID
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- Chip Manufacturing 4-Semiconductor Cleaning
- STM32 uart configuration
- TI Three-Phase Motor Drive BoosterPack Evaluation Module
- What does this runtime warning mean and how to deal with it?
- ESP32 configures WIFI via Bluetooth
- LT5400AIMS8E-4#PBF If you need help with replacement, or provide this material directly, thank you!
- Calculations on the LM317 charging circuit
- Analysis of the design of real-time embedded digital processing system based on c2000
- [Today at 10:00] Focus on the core technology of speech recognition: Microchip Timberwolf audio processor online seminar
- Digital Circuit and Logic Design Study Guide