cancel
Showing results for 
Search instead for 
Did you mean: 

USART Communication with PC (stm8al3l68)

AJT
Associate III

Hello,

I'm trying to implement serial communication between a stm8al3l68 an a serial terminal installed on my PC.

The problem is that there is no virtual port on my STM8 as on STM32.

How can I communicate with the PC if there is no virtual Port. What kind of hardware should i buy ?

--> HCCABL0015 USB to RS232 TTL Serial Interface Cable like explained there : http://www.colecovision.eu/stm8/STM8S-DISCOVERY%20Serial.shtml

And when I'll have this hardware, i just have to init USART with :

STM_EVAL_COMInit(COM1, (uint32_t)115200, USART_WordLength_8b, USART_StopBits_1,
                   USART_Parity_No, (USART_Mode_TypeDef)(USART_Mode_Tx | USART_Mode_Rx));
USART_Cmd(EVAL_COM1, ENABLE);

and send data with

void USART_SendData8(USART_TypeDef* USARTx, uint8_t Data)

Another question, how can I know if I have to include stm8l1526_eval.h or stm8l1528_eval.h header files ?

I'm really lost with STM8 MCU, need some help ! Thank you all !

Best Regards,

AJT

3 REPLIES 3
Cristian Gyorgy
Senior III

"How can I communicate with the PC if there is no virtual Port" - The STM8 has a real hardware USART port, much like an STM32. If you want to use it to communicate with a PC, you will need on the PC side another USART port, with same voltage levels (3.3V). If you don't have it, you will need a converter in between.

In case you use an ST development board, it might already have all you need, through a USB interface.

My advice: don't try to do all in 30 min with 20 mouse clicks! Take the time to understand what you work with, and surely this time will be rewarded.

AJT
Associate III

Hello Cristian, thanks for you answer !

First of all i'm going to check is something is sent via STM8AF_USART_TX with an oscilloscope.

Then i'll try to use this (because i found one) : https://www.st.com/en/development-tools/stlink-v3set.html

Sounds like i can create a virtual com port with that but I don't really know to what should I connect STM8AF_USART_TX and STM8AF_USART_RX. Well, to my mind i must connect STM8AF_USART_TX to stlink-v3 RX and STM8AF_USART_RX to stlink-v3 TX.

Here are some screenshots to explain why i should do that :

Screenshot of stlink-v3 datasheet that talks about VCP

0693W000000WN5XQAW.pngScreen shot of STM8AL3L68 datasheet

 0693W000000WN6aQAG.png

and finally a screen of the hardware board MB1440 that is included in stlink-v3 0693W000000WN66QAG.png

Tell me if I'm wrong !

Best Regards,

AJT

AJT
Associate III

Ok i found the solution, the problem came from SB4 and SB5 that there were not Fitted

 0693W000000WlLyQAK.png