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.

Interrupt number for SW2 and SW3 in the CC3200 LAUNCHXL

Other Parts Discussed in Thread: CC3200, SYSBIOS, CC3200-LAUNCHXL

Hello,

I am using the demo board cc3200 launchXL (launchpad)

there are 3 leds (labelled D5, D6, and D7) and 2 buttons (labelled SW2, SW3) on the board.

I have all the software updated and installed as of today (CCS 6.1, cc3200 sdk)


I want to make a project in CCS that:

1) uses TI-RTOS

2) when I press SW2, toogles one LED, in the context of a Hwi

When I setup my Hwi instance , I must give a "interrupt number". I can't find on the manual this number associated with SW2 or SW3.

Any help is appreciated

greetings

  • Hi Shaman,

    Please take a look at the button interface source 'button_if.c' (cc3200-sdk\example\common). Here the interrupts are registered with the RTOS by using the wrapper 'osi_InterruptRegister'.

    For SW3, the interrupt number 17 (INT_GPIOA1, GPIO port S1) is used. And for SW2, the interrupt number 18 (INT_GPIOA2, GPIO port S2) is used.

    Regards,
    Raghavendra
  • ok, now I have 70 warnings like:

    #48-D incompatible redefinition of macro "Hwi_clearInterrupt" (declared at line 645 of "C:/ti/tirtos_simplelink_2_12_01_33/products/bios_6_41_04_54/packages/ti/sysbios/hal/Hwi.h") .ccsproject /SimpleProject line 1282, external location: C:\ti\tirtos_simplelink_2_12_01_33\products\bios_6_41_04_54\packages\ti\sysbios\family\arm\m3\Hwi.h

    for every Hwi API basically.

    what should I do?
    Why is not enough to enable Hwi module and statically instantiate a Hwi function via the cfg file?
    Am I missing something?
  • Hi Shaman,

    What code base are you updating here? Is this from the CC3200 SDK? If yes, then please explain about the changes that you have made.

    Regards,
    Raghavendra
  • I have this:
    CCS 6.1.0.00104
    TI compiler 5.2.3
    RTSC 2.12.1.33 with XDC tools versione 3.31.0.24_core

    I create a new CCS project, choose template > TI-RTOS example > Driver example > CC3200-LAUNCHXL > example projects > minimal footprint

    from the created files, I rename empty.cfg in app.cfg, empty.c in main.c
    then I used PinMux to create the mux_config.h and .c files that enables the PIN for 3 LED and 2 SWITCH buttons.
    and I replaced those made by the template.

    then I edited CC3200_LP.h by uncommenting the enum values for CC3200_LP_LED_D5 and D6 in the typedef "CC3200_LP_GPIOName", because they are disbled by the generated files.
    Also in board.h I put the
    #define Board_LED1 CC3200_LP_LED6
    #define Board_LED2 CC3200_LP_LED5


    then I created 3 task instance in the cfg file.
    I created 3 functions in the main.c that are called each by each task.

    the code for the task is simply this:

    Void task_led0(UArg arg0, UArg arg1)
    {
    while (1) {
    Task_sleep((UInt)arg0); // arg0 = 1000 in the cfg file
    GPIO_toggle(Board_LED0);
    }
    }

    Void task_led1(UArg arg0, UArg arg1)
    {
    while (1) {
    Task_sleep((UInt)arg0); // arg0 = 2000 in the cfg file
    GPIO_toggle(Board_LED1);
    }
    }

    Void task_led2(UArg arg0, UArg arg1)
    {
    while (1) {
    Task_sleep((UInt)arg0); // arg0 = 4000 in the cfg file.
    GPIO_toggle(Board_LED2);
    }
    }


    IT WORKS.

    BUT

    now I want to create Hwi, and toggle LED by button switch, in Hwi context

    I want a function:


    Void hwi_led0(UArg arg0)
    {
    GPIO_toggle(Board_LED0);
    }

    to be executed in Hwi CONTEXT

    so I enabled Hwi MODULE in cfg file
    instance -> add -> hwi0
    that calls hwi_led0 function, interrupt number 17 (for the button) (the number you gave me previously).

    It compiles with warnings, 70 warnings, complaining that there are redefinition of defines (see previous message)
  • I found that there are 2 defines, for every Hwi API

    this:

    #define     Hwi_create      ti_sysbios_hal_Hwi_create


    is in the ...\Hal\Hwi.h

    but there is another define, generated by the XDC tools (or RTSC I don't know.... the tool that processes the cfg file):

    #define    Hwi_create       ti_sysbios_family_arm_m3_Hwi_create

    that appear in ...\Family\Arm\M3\Hwi.h

  • I found that the generated file : "app_pem4.c" has:

    #include <ti/sysbios/family/arm/m3/Hwi.h>

    and also , a few lines underneath:

    #include <ti/sysbios/hal/Hwi.h>

    that is causing 70 warning.

    how can I fix it?
  • Moving this thread to TI-RTOS forum, as it is specific to the build errors in the TI-RTOS example.

    Regards,
    Raghavendra
  • Use Resource Explorer to browse to and import the TI-RTOS GPIO Interrupt example project:

    This project appears to do precisely what you want.


    Alan

  • That example doesnt' use Hwi, it uses callbacks

    In fact if you look into the cfg file, there is nothing on the Hwi instance.

    Also in code, no lines of Hwi_create
  • The GPIO driver internally manages the Hwi instance.

    If you prefer not to use the GPIO driver, use these intNum mappings (found in cc3200-sdk/inc/hw_ints.h):

    #define INT_GPIOA0 16 // GPIO Port S0
    #define INT_GPIOA1 17 // GPIO Port S1
    #define INT_GPIOA2 18 // GPIO Port S2
    #define INT_GPIOA3 19 // GPIO Port S3

    Keep in mind each of these interrupts is a PORT level interrupt.

    Your interrupt handler will have to decode which pin on the port the interrupt is coming from and clear it accordingly.

    Alan