This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Running a LM4F232H5QD on 80Mhz on PIOSC

Hello,

I have some problems configuring the Sys Clock of my LM4F232H5QD.

I want to let it run on 80Mhz on the PIOSC but it only will work on the external oscillator.

I'll tried to set it with:

SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_INT);

and when I readout the frequency with SysCtlClockget() I get 80.000.000.

but when I use a PWM function to all timings are incorrect and when I use the external oscillator with:

SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

it runs correct.

I'm now building my prototype software with the LM4F232 evalboard but I want to get lose of the external krystal when I implement it in our product.

I hope someone has a solution for me,

Best,

Edser Broers

  • Six months or so past - similar issue arose/posted.  Errata for this part limits use of "fractional" MCU clock divider - IIRC.  Give a read - answer should become clear...

  • Assuming you are referring to erratum 4.2, this affects only the use of the ROM_SysCtlClockSet() function. The ROM version contains a bug that prevents the fractional dividers from working. The workaround, however, is simple - just call the flash-based SysCtlClockSet() function which contains the fix (assuming the version of StellarisWare in use is 8049 or later).

    A more important erratum here is 2.3 "Device nay not operate correctly at certain frequencies". One of the problem frequency ranges is between 70MHz and 80Mhz. When using revision A1 of the LM4F232 parts, make sure you keep SysClk out of the 35-45MHz and 70-80MHz ranges or bad things can happen.  This problem is fixed in the most current silicon revision (A3) but all the existing ek-lm4f232 boards still use revision A1 which has this bug.

  • I took another look at this and there's something else you should check. The PWM load and compare registers are only 16 bits wide so, if you are using frequencies in the 100s of Hz or so and your PWM clock divider is 1, you can easily get overflow which causes the generated output signals to be wrong. If that was the problem, I would expect to see the same results regardless of whether you derive the system clock from the external crystal or the internal oscillator, though. Note that the PWM functions do not check that they are not clipping the values you provide. I guess we should add ASSERTs to make sure no period values supplied are above 0xFFFF.

    There's one other erratum that may affect you. Some LM4F232 parts made it into the field without the internal oscillator trim set. As a result, the oscillator frequency can be rather outside spec and, depending upon how badly messed up your PWM timings are, that could be the reason. There are details in the errata for the part that tell you how to determine whether you have one of the untrimmed parts.