cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103VC UART5 problem

nps
Associate II
Posted on April 12, 2015 at 05:04

Hi,

I am trying to use UART5 on the STM32F103, 100 pin device. As per documents Tx and Rx pins are PC12 and PD2 respectively. I enabled clocks, initialized the port and when I try send a character (code below)

     USART_SendData(UART5, ch);

     while(USART_GetFlagStatus(UART5, USART_FLAG_TC) == RESET);

control remains in while loop. This normally happens when clocks are not enabled. However I have enabled the clocks. I had earlier used UART4 on a 64 pin device without any problems. What could be wrong? Thanks for your time.

4 REPLIES 4
Posted on April 12, 2015 at 14:22

It's really a pity that you don't provide a more complete code context for your code.

Are you enabling the right clocks, GPIO, AFIO, remapping, etc? I have no idea.

Also it would be better to front test TXE to confirm that the register is in fact empty, rather than waiting for the last bit to leave via back testing TC.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
nps
Associate II
Posted on April 12, 2015 at 19:43

Hi clive1

Thanks for the reply. Looks like 128K memory devices do not have UARTs as compared to 256K devices (same series). This is something I learnt the hard way. STM32F103VC (256K) is not same as STM32F103VB (128K, same footprint) (this does not have UARTs). ST documentation needs some improvement.

Posted on April 12, 2015 at 22:51

ST documentation needs some improvement.

I'm with you there, the part page is far too generic when it comes to features present/not present. There's an ambiguous ''5'' USART call out, and there are probably less timers too.

If I've Googled the part down to the two letter suffix, less the package type, it should be real specific about the RAM, FLASH, TIM, USART, etc on *THAT* part, not the whole family of related parts.

One way to check is to look at which bit(s) stick in the APBxENR registers, stuck at zero, peripheral not available.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
nps
Associate II
Posted on April 14, 2015 at 04:01

Thank you clive1. Looking at the register for available peripherals is an important info you have shared. Also searching for specific device extension number datasheet seems to be the best thing to do.