Skip to main content
pranamesh
Associate II
May 25, 2008
Question

STM32104RBT6 baud rate problem

  • May 25, 2008
  • 3 replies
  • 771 views
Posted on May 25, 2008 at 14:23

STM32104RBT6 baud rate problem

    This topic has been closed for replies.

    3 replies

    pranamesh
    pranameshAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:35

    [I am new to this, so please help without ambiguity]

    I am using the Olimex board STM32-103STK with an STM32104RBT6 mcu. the problem is that for a simple application of UART1 (code attached), I am unable to set the baud rate correctly. For example, if I set the baud to 10400 bps, then the actual baud on the wire is 6944 baud (checked using an LA), which is very strange. I modified an existing USART example (and the olimex bliking LED example). All other files are same as the library from ST site.

    The line ''myDelay(8000);'' in my code, is another problem as without this, my bytes on the wire ''keeps changing slightly'', however this is not the primary problem.

    I am using CodeSourcery GCC (4.2.3) with Eclipse to build my firmware.

    What is wrong :o with my code?

    [ This message was edited by: pranamesh on 23-05-2008 21:57 ]

    ivanov-i
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:35

    Pranamesh, the number, which you put in the baudrate register is in fact the divider of the clock frequency:

    72000000 / 10400 = 6923 - close to the number, which you measured.

    If you need a baudrate of 10400 put 6923 in the register.

    viktor3
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:35

    HSI clock source is not accurate for baudrate generation. Use an external crystal instead.