cancel
Showing results for 
Search instead for 
Did you mean: 

Should USARTx->BRR have to re-calculate ?

Carter Lee
Associate III
Posted on September 11, 2017 at 16:33

Hi,

Now I'm trying to implement UART function as the below,

But the problem is keep showing in RS232 Tool.

I'm just referring fully reference posting such as

https://community.st.com/thread/19577?commentID=48791#comment

There's no miss match. But I don't know what is the problem and how to resolve this.

Could you please any advice to resolve this problem?

I guess one thing is there's noUSARTx->BRR declaration.

Is this possible way to happen the problem??

0690X000006044uQAA.jpg

USART_InitTypeDef USART_InitStructure;

int putcharx(int ch)

{

while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);

USART_SendData(USART1, (uint8_t)ch);

return ch;

}

int main(void)

{

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);

//UART////////////////////////////////////////////////////////////////////////

/*-------------------------- GPIO Configuration ----------------------------*/

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(GPIOA, &GPIO_InitStructure);

/* Connect USART pins to AF */

GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_USART1); // USART1_TX

GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_USART1); // USART1_RX

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(USART1, &USART_InitStructure);

USART_Cmd(USART1, ENABLE);

/////////////////////////////////////////////////////////////////////////////////

while (1)

{

USART_SendData(USART1, 0x49); // Send 'I' //TEST 2

}

In case TEST 1 and TEST2 have the same output result as the below image.

0690X000006041cQAA.jpg

What am I supposed to do to resolve this problem?

should I have to calculate about

USARTx->BRR

?

Note: this post was migrated and contained many threaded conversations, some content may be missing.
11 REPLIES 11
Posted on September 12, 2017 at 17:58

You'd have to initialize two different USART, but given the lack of available pins that is probably the best option available.

The STM32F429I-DISCO is feature rich, but the LCD+SDRAM eat a lot of available pins.

For the USART experiment I think that USART1 PA9/PA10 from the ST-LINK's VCP is a viable path to test/understand things.

If you removed solder-bridges, or zero-ohm jumpers, they can be readily replaced.

If using the VCP you can leave the bridges in place, but you should perhaps look at why you have no signal.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 12, 2017 at 18:25

Thanks , Your helping is very helpful., I can have a success UART polling.

I'm not sure whether I can use someday with VCP (Vitual Com Port).

Anyway. I didn't still get it about that schematic, in especially

PA10 toPA2 and PA9 to PA3, they are not connected between them. what I mean is that schematic seems something wrong.