OpenCores
Issue List
Baudrate problems related to selected operating frequency #2
Open rfajardo opened this issue almost 14 years ago
rfajardo commented almost 14 years ago

A specific problem with the frequency 12.5 MHz has been noticed, for which the SoC delivers weird characters on the terminal output.

This has been detected as an error caused by a truncation operation.

The system baudrate is configured by a register in the uart module from the SoC. The formula is:

value = sys_clk/(16*desired_baud_rate)

For 25MHz system clock this is 13.56. Truncating to 13, it leads to a real baudrate of 120,192.3 bps. For 12.5MHz system clock this is 6.78. Truncating to 6, it leads to a real baudrate of 130.208,3 bps.

This skew to the real baudrate of 115200 is responsible for the weird characteres. If you round it up to 7 you get a real baudrate of 111,607.14 which happens to work.

That truncation is executed by the file sw/support/uart.c line 45. If you remove the calculation and directly type in the rounded value, 7 here, it will work flawlessly.

I know this happens to be a somewhat obvious. But since the system is hiding the baudrate configuration from the user, by calculating it directly from system clock and desired baudrate inputs, it is important to make clear that these things might show up, and that this is the way to get rid of these errors.

Greetings, Raul


Assignee
No one
Labels
Reminder