This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to set UART with high baud rate?

Other Parts Discussed in Thread: MAX3232E

Hi,

I am using am335x EVM with SDK 5.06 on Linux 12.04. Right now, I chose 'profile 3' and I can successfully set one UART (ttyO2) to talk at 921600 no problem. However, I need set the baud rate at a higher rate = 3686400. Compile error says 'B3886400' is 'undeclared'. 

Can am335x UART be configured at a baud rate higher than 921600? If it can, how do I set it?

Please help.

 

Thanks.

  • Hi Kevin,
     
    The highest supported baud rate is 3686400 indeed (AM335X Technical Reference Manual, Table 19-6). However you have quoted a compile error of  'B3886400'. Are you sure there isn't a typo somewhere?
  • Hi Biser,

    Thanks for your quick response!

    And you are right, I did type the error message wrong. The compile error does say 'B3686400' undeclared.

    It is good to know that rate 3686400 is supported. Please pass me some instructions on how to set the rate to 3686400. 

    Right now, I am only able to set baud rate up to 921600 via 'tio.c_cflag' or 'cfsetispeed' and 'cfsetospeed'. 

    Thanks.

    Kevin

  • Hi Kevin,
     
    I can't say about software changes necessary (I'm working on hardware issues only). However our software guys have confirmed that 3686400Mbps isn't defined in software. From hardware point of view I can tell you that on the AM335X EVM the signal from UART2 passes through a CPLD (which is used for profile configuration), and after that through an RS-232 transceiver. I'm not sure if the CPLD will pass successfully this high baud rate, but I can say definitely that the RS-232 transceiver MAX3232E that's used on the board works up to 1Mbps. So I don't think there is any use to try 3686400bps on the EVM. In my opinion this baud rate can work only on direct chip-to-chip communication over very short distances.
  • Hi Biser,

      I am the hardware engineer working with Kevin on this project and he asked me to follow up.

      Thanks for the heads up on the MAX3232E limitations.  As it turns out, I have removed that part from the EVM (U19 on the daughtboard) and hacked in our own RS422 circuitry which runs on other products at much higher speeds.  I do not think the CPLD is a limitation since once the board is up it holds its configuration constantly.

      Can you (or your software guys) guide us as to how to define different/faster baud rates in the software?  Even if we do not do it on the EVM, when we get our own board in we will be starting with the software built on the EVM and so we will need to operate at faster baud rates.

    Much appreciated,

    Kurtis

  • Hi all,

    The tty structure contains a field, tty->alt_speed, which you can use to set a custom baud rate when the app requests 38,4kbps.

    I found that this field exists to support the ASYNC_SPD_{HI,VHI,SHI,WARP} flags. You can use this field for your needs as long as the ASYNC_SPD_{HI,VHI,SHI,WARP} flags are not set, so that  you don't overwrite the tty->alt_speed value.

    I couldn't find a way to set tty->alt_speed from user space, but I suppose you can hardcode it in the driver and then request standart baud rate of 38,4kbps via a termios call.

    Best regards,
    Miroslav