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.

Can't get Timer32 module to work on MSP432P401R with CCS 6.1.1 beta 2 on Mac



I do have the CCS beta 2 (Version: 6.1.1.00027) installed on mac os x 10.9.5 to program a MSP432P01R launchpad. I am struggling to get the timer32 module to work.

I tried the example-project from the driverlib-section in the ti resource explorer ("timer32_periodic_mode_led_toggle") --> timer32_isr was never called (or the debugger failed to catch the breakpoint).

I also tried the following minimalistic program to initialize and start the timer:

//*****************************************************************************
//
// MSP432 main.c template - Empty main
//
//****************************************************************************

#include "msp.h"
#include "driverlib.h"

void main(void)
{
	
    WDTCTL = WDTPW | WDTHOLD;           // Stop watchdog timer
	
    //user driverlib to setup timer32
	MAP_Timer32_initModule(TIMER32_0_MODULE,  TIMER32_PRESCALER_256,  TIMER32_32BIT,
            TIMER32_PERIODIC_MODE);
	MAP_Timer32_setCount(TIMER32_0_MODULE, 187);
	MAP_Timer32_enableInterrupt(TIMER32_0_MODULE);

	//Use driverlib to globally enable interrupts
    MAP_Interrupt_enableSleepOnIsrExit();       // Enable sleep on exit from ISR
    MAP_Interrupt_enableMaster();

	//Use driverlib to start the timer
	MAP_Timer32_startTimer(TIMER32_0_MODULE,  false);
}

Again, the defaultISR is not called. What am I doing wrong?

Any help appreciated.

  • Moritz said:
    I tried the example-project from the driverlib-section in the ti resource explorer ("timer32_periodic_mode_led_toggle") --> timer32_isr was never called (or the debugger failed to catch the breakpoint).

    I see the same behavior with that example. It is not specific to MacOS as I see the same thing on Windows 7, so it appears to be an issue either with the example code or the timer32. I will move this thread to the MSP forums for the experts there to provide more insight.

  • Hi,

     For some reason we are not starting the timer. Please add the " MAP_Timer32_startTimer" to your code.

        /* Configuring Timer32 to 128000 (1s) of MCLK in periodic mode */
        MAP_Timer32_initModule(TIMER32_0_MODULE, TIMER32_PRESCALER_1, TIMER32_32BIT,
                TIMER32_PERIODIC_MODE);
    
        /* Starting the timer */
        MAP_Timer32_startTimer(TIMER32_0_MODULE, true);  <-- Missing
    
        /* Enabling interrupts */
        MAP_Interrupt_enableInterrupt(INT_PORT1);
        MAP_Interrupt_enableInterrupt(INT_T32_INT1);
        MAP_Interrupt_enableMaster();

    Regards,

     David

  • I added the call to MAP_Timer32_startTimer to the example code. Unfortunately I that didn't resolve my issue: Neither the gpio_isr nor the timer32_isr are ever called.

    Also, in my example-code (included in my original post) a call to MAP_Timer32_startTimer was already present. 

    By the way: I notice that the call to MAP_Interrupt_enableInterrupt(INT_T32_INT1) in the timer32_periodic_mode_led_toggle example uses the INT_T32_INT macro whereas the driverlib documentation and API Programmer's Guide suggests to use either TIMER32_0_INTERRUPT or TIMER32_1_INTERRUPT. According to the macro definitions that should not make a difference, but it definitely does not help to understand to example.

  • Another question to the proposed solution: shouldn't the second paramter to the startTimer function be "false" to operate the timer in periodic mode (for periodic LED toggle)?
  • Hi Moritz,

    I made a mistake, I thought this was different example code.  You have to press S1 to start the timer32, the LED1 will stay on for 1 second and then the timer32_isr will get called. Could you please try my project timer32_periodic_mode_led_toggle.zip , and let me know if you see the same behavior.

     BTW, which version of MSPWare are you using??

      Best regards,

       David

  • Hello David,

    Thanks for your reply and sorry for the long silence. Priorities...

    In order to test your timer32_periodic_mode_led_toggle i have downloaded the zip via the link and imported it into my CCS installation. It didn't compile at first trial.

    The include-file "msp432p4xx_driverlib.lib" was not found. I am not a CCS expert (yet), but it looks like the include path is a relict from a/ your Windows installation of CCS.

    I deleted the driverlib.lib include, downloaded MSP432_Driver_Library  2_20_00_08 and added it to the include-paths of the project. Unfortunately it still does not compile:

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

     undefined                            first referenced                      

      symbol                                  in file                           

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

     CS_initClockSignal                   ./timer32_periodic_mode_led_toggle.obj

     CS_setReferenceOscillatorFrequency   ./timer32_periodic_mode_led_toggle.obj

    [this goes on for some more calls to the driverlib]

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

    For my previous attempts I downloaded the example-project from the TI Resource Explorer (i.e. "the cloud"). I will try again with the example from the MSP432_Driver_Library  2_20_00_08.

  • Ok, the example from the MSP432_Driver_Library 2_20_00_08 works as you described: Each time switch 1 is pressed, the red LED is switched on for 1s.

    Now I need to figure out want is wrong in my code that works in the example.
  • Hi Moritz,

    I'm going to close the thread due to inactivity, but please post back if you have more information to re-open the thread.

    Thanks,

    David

**Attention** This is a public forum