Although I have many projects with RCM3600 and RCM3700 modules, there was only one that occasionally sent out data at an incorrect baudrate after power on. Usually a quick power off-on would resolve this.
When this happened the baudrate on all ports was wrong, and the wrong baudrate was not always the same. I found out the when this happened the value of the global variable ‘freq_divider’ and ‘bios_divider19200’ were different. These values are calculated by the bios (see StdBios.c) on start-up, and they use the 32 kHz clock as a reference. Apparently sometimes the 32kHz clock has not completely started when this calculation is made and the resulting values are incorrect. Since it only happens on one of my boards (but on all units that use this board) I assume this start-up time of the 32kHz clock depends somewhat on the board layout or connected peripherals.
Anyway, the solution turned out to be simple. I first checked the value of freq_divider when everything works fine (and it always does in the debugger) It was 36 in my case. Then I added this piece of code as the first function in main():
if(freq_divider!=36)
{
forceSoftReset();
}
Works great. I just wonder if there is way to solve the actual problem: why does the Bios not wait for the 32kHz clock to stabilize before calculating such system-critical values ?