Buad rate problems

I use the following code to open port D on a rabbit 3200. It is the only serial port I am opening. Sometimes the port gets opened at the correct baud rate and I can communicate with the rabbit. Other times all I see is garbage characters coming out of the serial port. Any ideas? Also if I know what the rabbit is outputing is there a way to take the garbage I am seeing and calculate the actual baud rate? eg should get E and I am getting @ so baud is off by X?



Why are you using serDopen(9600L) and not serDopen(9600)?

Also if you want to measure the baud rate there are two ways.
First if you have a scope, set your serialport to continiously transmit 0x81.
You can then set your scope to trigger on the rising edge, and the time to your next pulse is your character period. 1/period = Baudrate.

Secondly if you don’t have a scope, a much more inexact way is to set your rabbit to turn on a led, transmit 96000 characters, and turn the led off again. If the period is 10s then your baud rate is close to 9600.

Seems like this problem is solved if I hard code the value of freq_divider to 72. I have seen some references to this problem in the forums and some quite old. But I have to seen any fixes to this other than to force the rabbit to do a soft reset after every power-on-reset so it has time for the clock to settle down and have the right clock frequency to calculate freq_divider?