cancel
Showing results for 
Search instead for 
Did you mean: 

110 baud stm32f103

highimpedance
Associate III
Posted on December 25, 2015 at 12:33

Hello,

I am using STM32F103, library versionV3.1.2.

I have to use USE, USART2 and USART3.

I am trying to set 110 baud but usart2 and usart3 doesn't work correct. I see these 3 peripheral clocked by APB1.

When I set APB1 like:

/* HCLK = SYSCLK */

RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;

/* PCLK2 = HCLK */

RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE2_DIV1;

/* PCLK1 = HCLK/2 */

RCC->CFGR |=

(uint32_t)RCC_CFGR_PPRE1_DIV8; //default DIV1 I am able to use 300 baud, 110 baud is trouble.  When I set it like:  /* HCLK = SYSCLK */

RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;

/* PCLK2 = HCLK */

RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE2_DIV1;

/* PCLK1 = HCLK/2 */

RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE1_DIV16;//default DIV1

USB device doesn't recognized.  Is there any other way to solve this problem?  Thank you.  

#110-baud

3 REPLIES 3
Posted on December 25, 2015 at 16:10

Seems like a rather antiquated version of the F1 library, any particular reason for that?

And what speeds are the buses and processor running at, need to context here?

USB likely has some minimum clock requirements so it is serviced quickly. Perhaps you can do 110 baud in software, it's awfully slow.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
highimpedance
Associate III
Posted on December 28, 2015 at 10:59

Hi clive1,

I use this old version because of a sample project uses it. I didn't update to v4.0.0.

How can I set baud rate in software, Could you give me some example code parts or a way. Thanks.

Posted on December 28, 2015 at 16:03

I'm not looking to wade into a Soft USART implementation, perhaps you can try Google?

One of the problems with this low a baud rate is that the APB1 clock would need to be below 8 MHz, and as the USB is on the same bus this presents an issue because it requires a >= 8 MHz clock.

Why the low rates?

Can you use a different STM32 part that has the USB on the AHB buses?

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