USART setup question

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

When I use 9bits (8bits and parity) data like below, USART doesnt work properly with WICED SDK 2.2.1.

uart_config = {

   .baud_rate    = 115200,

   .data_width   = DATA_WIDTH_9BIT,

   .parity       = EVEN_PARITY,

   .stop_bits    = STOP_BITS_1,

   .flow_control = FLOW_CONTROL_CTS_RTS,

};

In stm32fXxx_platform.c, DMA is configured as following around line.1099.

if ( config->data_width == DATA_WIDTH_9BIT )

{

   dma_init_structure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;

   dma_init_structure.DMA_MemoryDataSize     = DMA_MemoryDataSize_HalfWord;

}

else

{

   dma_init_structure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;

   dma_init_structure.DMA_MemoryDataSize     = DMA_MemoryDataSize_Byte;

}

It should be fixed as below I think.

if ( config->data_width == DATA_WIDTH_9BIT ) && ( config->parity == NO_PARITY )

...

Could you check this and give me your feedback?

0 Likes
2 Replies
Anonymous
Not applicable
Your configuration is confusing.

You mention using 8 bits of data and 1 parity bit, yet your uart_config specifies a data_width of 9 bits.

Does it work when you set data_width to be DATA_WIDTH_8BIT?
0 Likes

Any follow up here?  I'd like to close this out.

0 Likes