Home/Support/Support Forum/BL4S200 CPU frequency problems
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

BL4S200 CPU frequency problems

0 votes

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!
asked Jul 11, 2017 in Embedded Devices by lvinolas New to the Community (2 points)

Please log in or register to answer this question.

2 Answers

0 votes
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...
answered Jul 13, 2017 by petermcs Veteran of the Digi Community (1,132 points)
0 votes
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!
answered Jul 18, 2017 by lvinolas New to the Community (2 points)