The STM8 is an 8-bit microcontroller by STMicroelectronics.
Questions tagged [stm8]
76 questions
4
votes
2 answers
STM8 ASM safely execute WFE
I have c code runned from RAM in low power run mode (so interrupt are no handled). This mode enabled by code sequence:
jump to RAM
SIM
switch off internal flash, and power regulator, switch to low speed clock source (LSE)
do some work with WFE mode…

imbearr
- 999
- 7
- 22
3
votes
2 answers
Programing STM32 like STM8 (register-level GPIO)
I programmed STM8 GPIO like PD_ODR_ODR4 = 1;, but stm32f10x.h doesn't have this function. Is there any .h file that has definition for bits?
Sorry, but I don't know how to explain this problem better.
I tried multiple GPIO libraries.

jurgis1991
- 43
- 1
- 4
2
votes
0 answers
Unable to send data with I2C using STM8s in C [Solved]
I'm an engineering student and for my bachelor thesis I use a 16 channel IO expander which communicates with I2C with a STM8S microcontroller.
IDE: STVD (I set the correct ARF6 byte)
IO-ex: PCA8575 -> datasheet:…

Joerie
- 77
- 8
2
votes
2 answers
Why is the array size unknown?
I tried to program this code on an STM8 Controller:
#include "Imagedata.h"
void main(void)
{
unsigned char *pArray;
pArray=IMAGE_DATA;
while(pArray<=(IMAGE_DATA+(sizeof(IMAGE_DATA)/sizeof(pArray))))
{
…
user20560622
2
votes
1 answer
STM Assembly instruction set to reserve data location respectivly, like PIC Assembly "ORG","RES"
I am working on STM8S microcontroller, and I need to reserve absolute data locations for my variables via using assembly.
So, I try to "LD" instructions but I couldn't.
In PIC assembly I have a part of code like this:
ORG 0X40 ; origin…

mryldz
- 95
- 2
- 9
2
votes
1 answer
Understanding STM8 pipelining
I’m trying to understand STM8 pipelining to be able to predict how much cycles my code will need.
I have this example, where I toggle a GPIO pin for 4 cycles each.
Iff loop is aligned at 4byte-boundary + 3, the pin stays active for 5 cycles (i.e.…

rumpel
- 7,870
- 2
- 38
- 39
2
votes
1 answer
Placing variables in absolute memory location (IAR C/C++)
I am working on an STM8S microcontroller with the IAR Compiler.
How can I fix the start location for more then one variable using a pragma or another method?
When I try the below code, the compiler gives this error message:
Error[Lp025]: absolute…

mryldz
- 95
- 2
- 9
2
votes
2 answers
IAR Embedded Workbench. Where is __iar_program_start?
In the code for a STM8 application there is a line
extern void __iar_program_start(void);
now I've searched and this function is nowhere to be found.
What is this and where is located??

KansaiRobot
- 7,564
- 11
- 71
- 150
1
vote
1 answer
is there a HAL_SPI_transmit function in stm8?
I'm trying to write a stm32 code in stm8. The problem is I can't find a SPI_Transmit function only SPI_SendData. I need this function to transmit an array through SPI.
The stm32 SPI_transmit function looks like this:
HAL_StatusTypeDef…
user20560622
1
vote
1 answer
[C]unrecognized token "@address" on VScode
I'm using cosmic compiler for stm8 microcontroller.
It supports "@" pointers or modifiers.
such like
@
@far
@near
@tiny
@interrupt
@inline
//etc..
Cosmic compiler user guide
VScode cannot recognize those modifiers and shows red underline…

Jeff Sim
- 11
- 1
1
vote
1 answer
STM8 default EEPROM values COSMIC compiler
I'm developing a program using COSMIC 'C' compiler Ver 4.5.3 for STM8 CPU (STM8S003K3) and I want fill the MCU EEPROM with default values during mass production using ST-LINK/V2 device.
In the Manual I read that I have to use the #pragma directive…

Ferrari
- 75
- 1
- 11
1
vote
2 answers
STM8 as SPI slave can't send back data
I have build a prototype board with a STM8L, and I want it to be used and configured as a SPI slave. I am testing it with a raspberry pi as master.
I use the lib provided by ST called "STM8 Standard Peripherals Library" for this, but the…

Matio
- 33
- 5
1
vote
2 answers
How to Convert the last digit of a number to a char and display it on LCD?
I recently got a STM8 MCU and it has the built in function LCD_GLASS_DisplayString("STRING")
The problem with that function is, as you can see below, that I cannot directly display an integer on it:
void LCD_GLASS_DisplayString(uint8_t* ptr)
{
…

rajeev
- 27
- 1
- 6
1
vote
0 answers
How to link denser code in IAR in split sections?
I make the program for STM8L151G6 on IAR Embedded Workbench for STM8 (version 3.11.1)
I need to place the instruction JPF 0xf000 at 0x008426 address.
I do this. In C code:
__root static const uint8_t jpfat0x8426 [] @ "ENTRY_POINT" = {0xac, 0x00,…

Ivan167
- 11
- 2
1
vote
1 answer
Dump the firmware from an STM8 microcontroller
I have a 600W digital step up converter with broken STM8S103K3T6C and another that is currently working OK. Is there a way to copy (dump) firmware from the working one and upload it to the new chip. Since I have only one working, I have to be extra…

Alex
- 11
- 3