This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ASC0

Hi

How can I determine the value of BG(ASCx_BG) and FDV? If I intend to follow the specifications:

Input clock: fasc=40MHz
FDE=1
BRS=0
Baudrate=115.2kbps

Die Jong

Parents
  • Here is my code...

      ///  -----------------------------------------------------------------------
      ///  Configuration of the ASC0 Baudrate Generator:
      ///  -----------------------------------------------------------------------
      ///  - fractional divider as prescaler for baud rate timer is used
    
      ASC0_FDV       =  0x00EC;      // load ASC0 fractional divider register
    
      ///  - required baud rate = 115.200 kbaud
      ///  - real baud rate     = 115.234 kbaud
      ///  - deviation          = 0.030 %
    
      ASC0_BG        =  0x0004;      // load ASC0 baud rate time reload register
    
      ///  -----------------------------------------------------------------------
      ///  Configuration of the ASC0 Operation Mode:
      ///  -----------------------------------------------------------------------
      ///  - 8-bit data asychronous operation with one stop bit
      ///  - receiver is enabled
      ///  - fractional divider is enabled
    
      ASC0_CON       =  0x0811;      // load ASC0 control register
    

    So

    If I use the forumla:

    Baud rate = (FDV/512)*(fsys/(16*(BG+1)))

    Now I apply the value of ASC0_FDV=0x00EC (236) in the FDV, 115.2kbps in baud rate and 40MHz in fsys resepctively. BG would be about 9.

    Then why is the ASC1_BG is 0x0004??

    Have I made any error in my calculation or miss out any paramount equation?

    Die Jong

Reply
  • Here is my code...

      ///  -----------------------------------------------------------------------
      ///  Configuration of the ASC0 Baudrate Generator:
      ///  -----------------------------------------------------------------------
      ///  - fractional divider as prescaler for baud rate timer is used
    
      ASC0_FDV       =  0x00EC;      // load ASC0 fractional divider register
    
      ///  - required baud rate = 115.200 kbaud
      ///  - real baud rate     = 115.234 kbaud
      ///  - deviation          = 0.030 %
    
      ASC0_BG        =  0x0004;      // load ASC0 baud rate time reload register
    
      ///  -----------------------------------------------------------------------
      ///  Configuration of the ASC0 Operation Mode:
      ///  -----------------------------------------------------------------------
      ///  - 8-bit data asychronous operation with one stop bit
      ///  - receiver is enabled
      ///  - fractional divider is enabled
    
      ASC0_CON       =  0x0811;      // load ASC0 control register
    

    So

    If I use the forumla:

    Baud rate = (FDV/512)*(fsys/(16*(BG+1)))

    Now I apply the value of ASC0_FDV=0x00EC (236) in the FDV, 115.2kbps in baud rate and 40MHz in fsys resepctively. BG would be about 9.

    Then why is the ASC1_BG is 0x0004??

    Have I made any error in my calculation or miss out any paramount equation?

    Die Jong

Children