BL4S200 CPU frequency problems


I am using a BL4S200 board, when I use the SYS.lib function get_cpu_frequency(), I obtain that the clock is running at 14400 Hz, but in the option menu, I have a 29Mhz configuration with de clock doubled on.

If I use the useMainOsc() or the clockDoublerOff() function I get a 0 from get_cpu_frequency(), but the code still runs at the same speed.

How do I get the real clock speed? How do I setup the board to the maximum speed?

Thank you!

The get_cpu_frequency() function relies on the bios_timer_count value which is set at start up by the bios. It does adjust the value based on the current clock divisor settings and the current clock doubler state and should give a reasonably accurate value. It sounds like the bios_timer_count value is being clobbered as it shouldn’t be effected by the useMainOsc() function.
Can you examine the bios_timer_count value to see what it is set to before and after calling useMainOSC and clockDoublerOff()?

By default, the board should be running at full speed…

Thank you for your early reply.

I have resolved the problems. The value was wrong because I was printing as an int, not a long variable as I should, so, I was not seeing all the information.

I still don’t know why the clockDoblerOff() function did not work, but when I downloaded again the Dynamic C and uploaded the correct program, the issue disappeared.

The board works great and is running at full speed.

Thank you again!