Hi I have a question:
I am running aduc7020 with 1 MHz with CD bit 5. I set the dL=4 according to that for 9600 baudrate. but it doesn't work. On datasheet it never mention about the CD = 5.
Can you throw some light on this.
You mention CD bit 5 and CD = 5 but I assume you mean CD = 5 in both cases and operation at 1.31MHz. At this clock speed you can not use the "normal" baudrate generation because the DL value would need to be a fraction. Instead you need to use the fractional diver as described in the Rev D data sheet on page 66.
I tried even that. in formula they gave i put CD = 5; DL = 4, baudrate = 9600 and core frequency 41.78MHz. value of m = 1 and n comes 128. I change the comdiv2 t0 0x8440 but it doesn't work. In datasheet it ask to refer to the table for given dl value and they don't have dl value for CD=5. if you calculate then dl comes 4.xx for cd =5, so used that value.
I tried it quickly and even with the normal divider set to 4 (calculates to 4.25) it works on my PC with a UART to USB converter on Windows 7 64-bit w/o any problem @ CD = 5 on a HyperTerminal.
The math will tell you the same. Using the 4 as DL in COMDIV0 the baud rate is calculated as 10200 Baud. This is 600 Baud apart the intended setting of 9600 Baud, or a error of 6.25%, which is well within the +/- 10% typically max. accepted baud rate error.
But as EckartH pointed out, you better use the fractional divider and set the following values to achieve 0% baud rate error => M = 1, N = 128, DL = 4, CD = 5
Or better set the MMRs as
COMDIV0 = 0x04;
COMDIV1 = 0x00;
COMDIV2 = 0x8880;
Retrieving data ...