Hi everybody,
I am new to SYS/BIOS, and I am having some trouble running a basic LED program properly. Basically, I started with the CCSv4 C28 swi example and added the following line in the swi function:
GpioDataRegs.GPBTOGGLE.bit.GPIO32=1;
I am using the ezdsp28335 card, so this line toggles the built-in led. Of course, I included in main() some lines of code in order to set the GPIOMUX and GPIODIR registers with appropriate values.
According to the configuration and the description of the program the swi executes every 0.5 seconds:
/* Timer period is 1/2 second (500,000 uSeconds) */
timerParams.period = 500000;
timerParams.periodType = Timer.PeriodType_MICROSECS;
so I should see the led turning on and off every second. However, the led seems to be blinking faster. Using a stopwatch (a physical one), I realized that it is blinking every 0.666 seconds instead of every 1 second.
During debug, I saw that PLLCR.DIV is set to 10 and PLLSTS.DIVSEL is set to 2, which means that the system is actually running at 150Mhz!!! (30*10/2=150). Moreover, the value of the PRD register of Timer0 is 50e6, which makes me conclude that bios thinks that it is running at 100Mhz, and this explains perfectly the actual timing of the led.
I tried to review some configurations and realized that the bios module has a parameter called cpuFreq, which is set to 100e6. I changed this to 150e6, but it didn't help at all. I also realized that the platform specification (I am using ti.platforms.control28335, because ti.platforms.ezdsp28335 has never worked for me) has a Clock Speed parameter, which is also set to 100Mhz. I found that the proper way to change this is to create a new platform. I tried to create one but it doesn't work, the programs enters BIOS_start() and it crashes when using my platform, even if I only import ti.platforms.control28335 without modifying anything.
At this point I am pretty confused about how the information of the CPU Frequency is obtained or used in the configuration step. Is it all about changing the Clock Speed in the platform? What if I want to get 150Mhz in another board which has a built-in 50Mhz clock? How do I tell BIOS that the clock in the board is 50Mhz and it has to be multiplied by 3 in order to get the right speed?
Any help would be appreciated. Thanks in advance.