cancel
Showing results for 
Search instead for 
Did you mean: 

i am using stm32f373, i want to use USART2 to communicate through modscan kindly help me in With the configration of usart2.

manjunath
Associate

void SA_USART_config(void)

{

USART_InitTypeDef USART_InitStructure; 

// USART_DeInit(USART2);

/*************RCC_configuration*******************/

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);

RCC->CFGR3 |= RCC_CFGR3_USART2SW_0;  

USART_InitStructure.USART_BaudRate  = USART_BAUD_RATE;        //115200

USART_InitStructure.USART_WordLength = USART_WordLength_8b ;

USART_InitStructure.USART_StopBits  = USART_StopBits_1 ;

USART_InitStructure.USART_Parity   = USART_Parity_No;

USART_InitStructure.USART_Mode    = USART_CR1_TE |USART_CR1_RE;

USART_InitStructure.USART_HardwareFlowControl =USART_HardwareFlowControl_None;

USART_Init( USART2, &USART_InitStructure);

USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); 

NVIC->ISER[1] = 0x00000040; 

USART_Cmd(USART2, ENABLE);

}

0 REPLIES 0