cancel
Showing results for 
Search instead for 
Did you mean: 

Uart3 in stm32f103c8 not working

ABhat.7
Associate III

hi,i am trying uart with dma in stm32f103c8 with uart3 after n try i found that uart3 in stm32f103c8 is not working then in polling I observed that the TX pin is not getting high and low so I toggle that pin it toggles as a digital pin so I think there is some problem in uart3 can someone provide solutions that how can i use it

12 REPLIES 12
Ons KOOLI
Senior III

Hi @ABhat.7​ ,

Please refer to the UART_TwoBoards_ComPolling example of the STM32CubeF1 FW.

Best Regards,

Ons.

> toggle that pin it toggles as a digital pin

Then that pin is set as Out, i.e. you have not set properly the pin as AF.

JW

Show code..

Do the pins need remapping? Thought U3 defaults were PB10/11​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ABhat.7
Associate III

Hi,

thanks for the reply it was my code error that i found out but now I am using DMA with uart3 for receiving fixed bytes of data as I am query for the data some data is coming and some go missing as soon as I comment  NVIC_EnableIRQ(USART3_IRQn) that some more data is coming any support is useful

secondly, i want to know I can we have a DMA and interrupt on the same usart i.e I want a DMA on the recieve and a transmission complete interrupt i am using standard peripheral library for stm32f103c8

As I recall the plumbing, the DMA is signalled on RXNE and TXE, and can service those prior to any interrupts be recognized.

I think you can catch UART TC, but DMA TC will occur earlier, and you can chain buffers to achieve continuous output.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi,

I didnot understand very well pls give an example where i use dma for recieving and interrupt for transmissions data on the same usart ​

Hi @Ons KOOLI​ 

Thanks for reply but i just want to know can we use dma on rx and interrupt on tx of same uart please any example share with me​

ABhat.7
Associate III

HI,

I want to ask can a timer interfere with uart my uart is working fine it recieve complete data but as soon as i enable the timer it start to lose some byte of data so i implement DMA as it has the highest interrupt priority than tim interrupt but still the situation is same i can the interrupt priority but nothing is work also keep the isr short my timer is 4msec as of now please suggest what can be done in this case

There is only one physical flip-flop - the one that you read as RXNE - to indicate the received byte to either the interrupt and to the DMA, and it is cleared by reading the data register, again either by processor, or DMA.

So, if you enable both the UART interrupt and DMA, chances are, that DMA succeeds to pick the data before the UART interrupt starts to run and check the RXNE bit, so it finds that bit already cleared. In short, you can't have both.

But if you want DMA on Rx and interrupt on Tx, well, that should be perfectly OK.

JW