UART Bit Time Calculation

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am

UART Bit Time Calculation

Post by rp181 »

I am using the UART module which uses:

Code: Select all

#define UART_BIT_TIME ((XS1_TIMER_HZ) / (UART_BIT_RATE))
However, I changed the reference frequency to 500MHz in my XN file, and this does not work (changing back the reference frequency makes it work). How do I change this so it works with a 500 MHz reference frequency? I tried the obvious x5 and /5, but I feel as if I am missing something obvious.

EDIT: So a timer usually increments every 10 ns. With a reference frequency of 500MHz, is it 2 ns?


MaxFlashrom
Experienced Member
Posts: 82
Joined: Fri Nov 05, 2010 2:59 pm

Post by MaxFlashrom »

You do mean the system reference frequency rather than the system clock frequency? On C5 parts changing the system clock frequency does not affect the reference frequency, which still runs at 100MHz. One can raise the reference frequency and this will make buffered ports clocked with it shift out data faster. It will also make timers count faster. This is, however, not very useful as the processor instructions still take 10ns(8ns on 500MHz parts) and so you will not be able to act on any events faster than this. E.g. timerafter etc.
Raising the reference frequency to 500MHz is pushing it. Your mileage may vary...I found that writing the clock dividers directly enabled this; changing the XN config file did not.

Max.