Sorry, you need to enable JavaScript to visit this website.

Configure UART Baud rate

Unsolved
5 posts / 0 new
mialmg's picture
mialmg
Junior(0)
Configure UART Baud rate

Hi,

I'm using the UART1 to transfer data from a PC program to PS in ZedBoard. It works fine at 115200 baud/s, but I cant get it to work at higher baud rates.
I have changed the settings in XPS (under general settings) and when I use the same baud rate during debugging there are just rubbish coming from the ZedBoard.

Does anyone know how to configure the baud rate for higher speeds? (baud rate > 115200)

// Mikael

fletch's picture
fletch
Moderator(15)
According to Cypress, all

According to Cypress, all CY7C64225 USB-UART bridge devices supported a max baud of 115200 until Jan 2013 when they started supporting 230400.  Most ZedBoards that have shipped likely fall in to this pre-2013 category and have the upper limitation of 115200.
 
If you need a high baud rate, one option is to enable a UART on the PS Pmod and purchase either a traditional RS232 Pmod or a USB-UART Pmod with a different USB-UART bridge chip.
www.digilentinc.com/pmods
 
Bryan

mialmg's picture
mialmg
Junior(0)
Thanks for your answer! :)

Thanks for your answer! :)
Sadly my ZedBoard is older than January. I think I will go on using the Cypress chip, although it's slow. I use it only for file transfer in the beginning of my program so it wont effect that much for now.

L30nardoSV's picture
L30nardoSV
Junior(0)
How do I configure baud rate for a new Zedboard

I got my Zedboard after May 2014. Do you know how to configure the baudrate to 230400? I modified the settings in Vivado but when I debug my program in SDK it forces the baudrate to 115200 ... Many thanks in advance!

zedhed's picture
zedhed
Moderator(22)
RE: Configure UART Baud rate

Hi L30nardoSV,

I took a look at this and it seems like a call to the BSP API XUartPs_SetBaudRate() would do the trick. However, if you try to set the baud rate to 230400 using that function, your application will throw an assertion trap because that baud rate falls outside the range for which the SDK API has been tested (110 to 115200). If you look inside of the XUartPs_SetBaudRate() code, you can see that the BSP code takes the requested baud rate and does some checking to see what is the best baud divider value to achieve the requested baud rate.

According to the comments in the BSP code, the MIN and MAX baud rates (110 to 115200) are implemented only because that is the range that has been tested. The Zynq hardware is capable of other baud rates but you may need to do some further work on your end to achieve the divider that also gives a reasonable error rate for 230400 baud.

I tried this approach in my SDK application and it appears to be working but keep in mind that my ZedBoard is sitting on my desk at room temperature so your results may vary depending upon your application:

1) It is not good practice to modify your BSP because your work can be overwritten when SDK regenerates the BSP by calling libgen so copy the entire XUartPs_SetBaudRate() function up to your application and rename it to something else. I named it simply SetBaudRate() in my application in a platform.c file.

Now you should be able to modify this function as you see fit for your own application.

2) I defined my own MAX_BAUD_ERROR_RATE as 3 and changed all of the XUARTPS_MAX_BAUD_ERROR_RATE references to match.

3) I removed the Xil_AssertNonvoid() checks for XUARTPS_MAX_RATE and XUARTPS_MIN_RATE.

4) Made a call to my new SetBaudRate() AFTER the PS UART is initialized with XUartPs_CfgInitialize().

5) Built my application.

6) Set my Tera Term to 230400 baud.

7) Run my application and I can see the clean terminal output within Tera Term.

I am sure that you might think of some ways to make this more elegant but this approach should at least get you to the point of demonstrating that the higher baud rate is achievable.

Regards,

-Kevin