Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 11 months ago.
USART trhough ST-Link/V2
Can someone share example and/or point to useful resources to learn USART communication through ST-Link/v2 for ST Nucleo L152RE? I'm trying to learn stm32 basics using only C and Standard Peripheral Library. The sample available on mbed for download works but is not particularity illuminating on the actual things happening behind the scenes.
Thank you!
Here is the most basic thing I have from tutorials for other boards.
include stm32l1xx_usart.h with this snippet
#include "stm32l1xx_usart.h" void USART2_Configuration(void) { USART_InitTypeDef USART_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); USART_InitStructure.USART_BaudRate = 9600; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_Init(USART2, &USART_InitStructure); USART_Cmd(USART2, ENABLE); } int main(void) { int time; USART2_Configuration(); while (1) { USART_SendData(USART2, 2); for(time = 0; time < 100000; time++); } }