/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / stm32f107 usart

Username:     
Password:     
             

Forum

# 1   2012-01-23 16:55:23 stm32f107 usart

mike250
New member
Registered: 2012-01-23
Posts: 1

stm32f107 usart

Hi,

I am trying to get the usart to work on the olimex stm32-p107 board. I setup the GPIO ports and USART, but cannot seem to send, or receive any data. Has anyone has this problem? or any ideas?

Here is my code:
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE );
/* Enable USART3 clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);

/* Configure USART Tx as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);

/* Configure USART Rx as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);

/* Remap USART, as USART3 is used as alternate pins */
//GPIO_PinRemapConfig(GPIO_FullRemap_USART3, ENABLE);

/* Configure USART 9600 8N1 */
USART_DeInit(USART3);
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_Tx;// | USART_Mode_Rx;
USART_InitStructure.USART_Clock = USART_Clock_Enable;
USART_InitStructure.USART_CPOL = USART_CPOL_Low;
USART_InitStructure.USART_CPHA = USART_CPHA_1Edge;
USART_InitStructure.USART_LastBit = USART_LastBit_Enable;
USART_Init(USART3, &USART_InitStructure);

/* Enable USART3 */
   USART_Cmd(USART3, ENABLE);

/* Send some test data */
while (USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);
   USART_SendData(USART3, (u8) 'T');
while (USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);
USART_SendData(USART3, (u8) 'e');
while (USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);
USART_SendData(USART3, (u8) 's');
while (USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);
USART_SendData(USART3, (u8) 't');

Any help is appreciated.

Offline

 

# 2   2012-07-25 02:13:41 stm32f107 usart

srithar187
New member
Registered: 2012-07-25
Posts: 1

Re: stm32f107 usart

hello ,, i want simple UART coding for stm 32fXX ,, how to confi,. which register, and interned using tell step by step ,,   print the char UART ,, can any one help ,, thank y

Offline

 

# 3   2012-07-25 06:24:43 stm32f107 usart

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Offline

 

Board footer