doubts on ARM TUTORIAL : uart
in calculation of U0DLM and U0DLL the formula u gave
BAUDRATE = PCLK /( (16*(256*U0DLM+U0DLL)) (1+ (DivAddVal/MulVal)) )
assuming PCLK = 60Mhz assuming no fine tuning required...
for a baud rate of 115200 lets find out the values of DLL and DLM remember it will be easier if ou consider DLL and DLM a single 16 bit register instead of 2 8 bit register .. with the higher byte going to DLM
=> (256*U0DLM+U0DLL) = 60,000,000/(16*115200) = 32.552 =>0x0020 hex
=> DLM = 0x00
DLL = 0x20
where does DivAddVal and MulVal goes?
or DivAddVal is taken as 0?
now regarding PLL...
also lets say if i have 12Mhz crystal on board..
so multiplier should be 5 for 60Mhz max frequency
and divider let say 2 so FCC0 is 240Mhz which is in between specified limit..
so my PLL defines should look like this..
#define FOSC 12000000 /*on board crystall frequency */ #define PLL_M 5 #define MSEL (PLL_M-1) #define PSEL0 5 #define PSEL1 6 #define PLLE 0 #define PLLC 1 #define PLOCK 10 #define PLL_FEED1 0xAA #define PLL_FEED2 0x55
Now what if i have 60Mhz onboard frequency.. i am not sure if thats possible to have..
so multiplier is 1 and divider is 2..
so
#define MSEL (PLL_M-1) /* MSEL = 0 will this be a problem? or is ok? */
where does DivAddVal and MulVal goes
yeah u guessed right DivAddVal =0 (default)
@ ajay doubt 2
Now what if i have 60Mhz onboard frequency..
microcontroller’s onboard oscillator circuit supports external crystals in the range of 1 MHz
to 30 MHz only. If the on-chip PLL system or the boot-loader is used, the input clock
frequency is limited to an exclusive range of 10 MHz to 25 MHz.
so 60 MHz out of question...
yeah, was a wrong kind of question to ask about frequency..
so my calculations are correct according to 12Mhz crystal?
M = CCLK / FOSC. M must be in
the range of 1 to 32
so yes your calculations are correct...
http://www.standardics.nxp.com/support/documents/microcontrollers/pdf/an10331.pdf
lpc214x user manual and the LPCbooksrn nothing on philips site better than that
I have UART0 working fine, but using the same code for UART1 I get garbage 60% of the time.
Also wondering about DivAddVal and MulVal, it doesn't say anything about them in the lpc2106 UM , and there not In the lp2000.h file that I have, as a consequence Ive had to use a baud of 2400, basically the highest even number I could derive from my setup, i.e. 16MHz crystal.
Thanks,
V
Edit: It appears I spoke too soon regarding UART0 working, for some reason I can only send a string/char from my MCU to PC after I have received a char.
Sometimes I will get garbage for that "first" string but generally I get nothing, once something is received once, then everything operates fine.
[ Edited Wed Mar 31 2010, 06:27 am ]