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.
Hi,
I am working on SCI UART Comm...
I fully didn't understand the Baud rate setting... Please help me to understand it.
Here:
#define CPU_FREQ 150E6
#define LSPCLK_FREQ CPU_FREQ/4
#define SCI_FREQ 100E3
#define SCI_PRD (LSPCLK_FREQ/(SCI_FREQ*8))-1
SciaRegs.SCIHBAUD = 0x0000;
SciaRegs.SCILBAUD = SCI_PRD;
So Now what is the Baud rate?
If I calculate SCI_PRD value = 45.87500
How did it set to Baud rate?
Many Thanks,
Hello Seelam,
The baud rate is calculated as follows,
Ideal Baud = LSPCLK/(BRR+1)*8
So in order to find what BRR is (value to write to baud rate register), we can rearrange the equation to be,
BRR = (LSPCLK/(Ideal Baud*8))-1
Which from the defines above, BRR is SCI_PRD.
You are right, SCI_PRD is 45.87. The value that will be written to the baud rate register is 45, so if we do the calculation again,
Baud Rate = 60M / ((45+1)*8) = ~101902
Doing a BRR value of 46 actually gets you closer to 100k,
Baud Rate = 60M / ((46+1)*8) = ~99734
Best Regards,
Marlyn