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.

TimerClockSourceSet appears to cause imprecise data bus fault

(Using the Tiva connected launchpad dev kit)

Hey - I'm a newbie to this series of parts and CCS but have used Arm for years.  I have a very simple application that has had trouble 'getting started' (requiring lots of gyrations with system reset, core resets etc) to get running.  Most of the time the trouble was:

a.)  Connect USB debugger to board (board powers up.)

b.)  launch debugger from ccs.

c.)  Click run (runs from main breakpoint that is automatically inserted.)

d.)  Program lands in FaultISR.

Looking into the NVIC status register I have the imprecise data bus error set (NVIC_FAULT_STAT=0x00000400, NVIC_HFAULT_STAT=0x40000000).

Stack points to the ROM code 0x1092 (line of code following the call to ROM_TimerClockSourceSet(TIMER0_BASE,TIMER_CLOCK_SYSTEM); as show in in this snip:

168           ROM_TimerClockSourceSet(TIMER0_BASE,TIMER_CLOCK_SYSTEM);    // set clock source to CPU clock
00001086:   4827     LDR             R0, $C$CON17
00001088:   6800     LDR             R0, [R0]
0000108a:   6F42     LDR             R2, [R0, #0x74]
0000108c:   4826     LDR             R0, $C$CON18
0000108e:   2100     MOV             R1, #0x0
00001090:   4790     BLX             R2
173           ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);            // enable timer
00001092:   4826     LDR             R0, $C$CON19

If I comment out the TimerClockSourceSet call, the application runs perfectly every time the debugger is launched and MORE IMPORTANTLY, runs 'standalone' by just applying power to the board.

What gives with this function?  I'd really like to use it to make sure my timer is configured to use the right clock, but it seems a little busted.  Thanks!

Doug

A larger code snip looks like this:

---------------------------------------------------------

int main(void) {

    char pStringElapsedTime[10];
    char pStringVelocity[10];
    char pDisplayLine1[21];
    char pDisplayLine2[21];
    uint32_t elapsedCount;
    float elapsedTime, velocity;

    // Set the clocking to run directly from the crystal at 120MHz.
    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                             SYSCTL_OSC_MAIN |
                                             SYSCTL_USE_PLL |
                                             SYSCTL_CFG_VCO_480), 120000000);

    // Initialize the UART and write status.
    ConfigureUART();
    Configure_Display_UART();
    InitializeTimer();

    // Enable processor interrupts.
    ROM_IntMasterEnable();

.

.

.

------------------------------------------------------

void InitializeTimer(void) {
    ////////////////////////////////////////////////////////////////////////////////////////////////
    // NOTE:  ENABLING THE FOLLOWING LINE CAUSES RANDOM IMPRECISE DATA FAULTS - no reason known...
    ROM_TimerClockSourceSet(TIMER0_BASE,TIMER_CLOCK_SYSTEM);    // set clock source to CPU clock
    // Should be perfectly legal (and should be done to make sure the clock is net set to the PIOSC)...
    ////////////////////////////////////////////////////////////////////////////////////////////////


    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);            // enable timer
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);            // enable gpio port D - not sure we need to do this...

    // Configure PD0 as the CCP0 pin for timer 0.
    ROM_GPIOPinTypeTimer(GPIO_PORTD_BASE, GPIO_PIN_0);            //port D pin 0 becomes the CCP input for timer A
    ROM_GPIOPinConfigure(GPIO_PD0_T0CCP0);                            // tell port D0 to be CCP for timer A

  • Hi,

       I suspect that this is because you called TimerClockSourceSet() before enabling the clock for TIMER0.

       Try this below instead:

       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);            // enable timer
       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);            // enable gpio port D - not sure we need to do this...

       ROM_TimerClockSourceSet(TIMER0_BASE,TIMER_CLOCK_SYSTEM);    // set clock source to CPU clock

    - kel