cancel
Showing results for 
Search instead for 
Did you mean: 

STM8AF5286 UART3/LINUART not sending data

PPate.1
Associate II

My following code is not working for sending data over LINUART port of STM8AF5286. I am using STVD and STM8_Standard_Project_Template.

GPIO_Init(GPIOD, GPIO_PIN_5, GPIO_MODE_OUT_PP_HIGH_FAST);

UART3_DeInit();

UART3_Init(9600,UART3_WORDLENGTH_8D,UART3_STOPBITS_1,UART3_PARITY_NO,UART3_MODE_TX_ENABLE);

UART3_Cmd(ENABLE);

UART3_SendData8(0xAA);

Can you please guide me as why data (0xAA) is not coming out on PD5 pin of microcontroller?

2 REPLIES 2

Make sure GPIOD and UART3 clocks are enabled prior to configuration

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PPate.1
Associate II

Yes...clocks are enabled for all peripherals.

CLK->PCKENR1 = 0xFF;

CLK->PCKENR2 = 0xFF;

I tested GPIO Port D pin5 to go high and low as i write high or low through the code .

One more input - As i am using STM8AF5286 and in STM8 standard library i do not see any #define for STM8AF528x controllers and hence i have uncommented STM8AF52Ax in stm8s.h file. Please refer below section from this file.

/* Uncomment the line below according to the target STM8S or STM8A device used in your

  application. */

 /* #define STM8S208 */   /*!< STM8S High density devices with CAN */

 /* #define STM8S207 */   /*!< STM8S High density devices without CAN */

 /* #define STM8S007 */   /*!< STM8S Value Line High density devices */

 #define STM8AF52Ax   /*!< STM8A High density devices with CAN */

 /* #define STM8AF62Ax */  /*!< STM8A High density devices without CAN */

 /* #define STM8S105 */   /*!< STM8S Medium density devices */

 /* #define STM8S005 */   /*!< STM8S Value Line Medium density devices */

 /* #define STM8AF626x */  /*!< STM8A Medium density devices */

 /* #define STM8AF622x */  /*!< STM8A Low density devices */

 /* #define STM8S103 */   /*!< STM8S Low density devices */

 /* #define STM8S003 */   /*!< STM8S Value Line Low density devices */

 /* #define STM8S903 */   /*!< STM8S Low density devices */

 /* #define STM8S001 */   /*!< STM8S Value Line Low denisty devices */