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.

CCS/MSP430F5529: How to use Port 1/2 interrupts in MSp430F5529 LP with 1120-1190 Booster Pack SIGFOX Demo Project

Part Number: MSP430F5529
Other Parts Discussed in Thread: CC1120, MSP430F5438A, BOOSTXL-CC1120-90

Tool/software: Code Composer Studio

Hi,

I would like to use LPM3 with port1/2 interrupts in MSP430F5529 LP together with 1120-1190 Booster pack using Sigfox library demo. I want MCU to go to lpm3 and only wake up with button Launchpad P1.1 and P2.1 interrupts and send Sigfox frames using library functions.

I have imported the project I received from Sigfox for the LP  and tried the AT_command & button press polling demos, they are working properly. I can send sigfox frames.
But I would like to use interrupts in my project as I described above, when I switched the button press demo to use interrupts instead of polling (this switch is provided in code) there are some problems.  I asked this question to Sigfox support first and they directed me to ask TI.
Here is a summary of the problem:
1) To use interrupts in SIGFOX_DEMO_button_press, "#define BSP_KEY_NO_ISR" statement in bsp_key.c needs to be removed and bspKeyInit function in sigfox_demo.c/SIGFOX_DEMO_init_mcufunction needs to be called with 'BSP_KEY_MODE_ISR' argument. I did these changes, but the project did not compile since "io_pin_int.h" header file included in bsp_key.c  is missing from the project.
2) I found the CC1120 Easylink source code from the TI website which includes all bsp and io_pin_int files. I have added io_pin_int.h and io_pin_int.c files to the project. (please see screenshot below for the directory structure of the project)..This time project went pass the compile phase but failed in linking saying PORT1_VECTOR  and PORT2_VECTOR interrupt vectors are already defined in TI_SIGFOX_Lib_FCC.lib and redefined in io_pin_int.c:

<Linking>
error #10056: symbol "__TI_int47" redefined: first defined in "./bsp/io_pin_int.obj"; redefined in "../ti_sigfox_library/TI_SIGFOX_lib_FCC.lib<hal_digio2.obj>"
error #10056: symbol "__TI_int42" redefined: first defined in "./bsp/io_pin_int.obj"; redefined in "../ti_sigfox_library/TI_SIGFOX_lib_FCC.lib<hal_digio2.obj>"
error #10010: errors encountered during linking; "TI_SIGFOX_FCC_ccs_project.out" not built

Apparently PORT1 and PORT2 vectors are defined somewhere in the library. Since it is pre compiled I can't check or modify Sigfox library file. If I comment out PORT1 and PORT2 interrupt vectors from io_pin_int.c the project builds but custom interrupts registered don't work because there is no connection between the port interrupts in library and my custom interrupt functions registered in bsp_key.c.
I tried with both TI 4.4.8 and 16.9.0 LTS compilers but didn't make any difference.
I am wondering whether or not there is a way to register custom interrupt functions to the ISR defined in Sigfox library or any other solution.Is it possible to get some help and guidance in this problem?

Thanks a lot for help!!

  • Hi Ozan,

    As shown in hal_spi_rf_exp5529.h, PORT1_VECTOR is defined as BUTTON_VECTOR and PORT2_VECTOR as RF_PORT_VECTOR. BUTTON_VECTOR is used in LaunchPad_trx_main.c and RF_PORT_VECTOR is used in the cc11[xx]_drv.c file of your corresponding radio_drv/cc11[xx]_drv folder.

    Regards,
    Ryan
  • Hi Ryan,

    Thank you for your quick response.

    This is standard TI Sigfox Demo project for f5529LP+ 1120-1190 BoosterPack which Sigfox sent to me after I received my LP+Boosterpack. All the files included in the project are seen in the screenshot. There is no hal_spi_rf_exp5529.h or LaunchPAd_trx_main.c. They might be inside TI_SIGFOX_lib_FCC.lib which is pre compiled and not visible.

    You can see I am getting the linker error "error #10056: symbol "__TI_int42" redefined: first defined in "./bsp/io_pin_int.obj"; redefined in "../ti_sigfox_library/TI_SIGFOX_lib_FCC.lib<hal_digio2.obj>"" when I try to use interrupts. In default configuration the project works in  at command mode which doesn't make use of interrupts, so you can open a terminal connection using serial port and which works fine. Modes are configured via following variable in sigfox_demo.c:

    test_sequence_list test_sequence_choice = at_cmd;

    When you modify this line and change it to "button_press" it switches to button press demo and uses polling to check P1 and P2 on the launch pad to send sigfox messages which also works fine (also doesn't use button interrupts). Builds and runs. You also need to call bspKeyInit function from bsp_key.c using BSP_KEY_MODE_POLL argument which is the default configuration:

    //bspKeyInit(BSP_KEY_MODE_POLL);

    But I would like to make a demo of my application using low power modes and interrupts. So there is another switch in bsp_key.c for to use interrupts which is a directive called BSP_KEY_NO_ISR. By default this is defined so it does not use interrupts, when I comment that out it switches to use interrupts instead of polling (it is described in the brief of the code):

    #ifndef BSP_KEY_EXCLUDE
    
    
    /**************************************************************************//**
    * @addtogroup BSP
    * @{
    ******************************************************************************/
    
    //#define BSP_KEY_NO_ISR
    
    /******************************************************************************
    * INCLUDES
    */
    #include "bsp.h"
    #include "bsp_key.h"
    
    //#include "ti_sigfox_library\*"
    //#include "sigfox_api.h"
    #ifndef BSP_KEY_NO_ISR
    #include "io_pin_int.h"         // Access to GPIO pin specific ISRs
    #endif // BSP_KEY_NO_ISR
    
    #include "driverlib.h"
    //#include "hal_digio2.h"
    
    /******************************************************************************
    * DEFINES
    */

    //! @brief Key board support package for MSP430F5438A on TrxEB.
    //! Key presses can be handled using polling or interrupts, this
    //! can be switched run-time. The user may register custom ISRs
    //! using the bspKeyIntRegister() function.
    //!
    //! If a custom ISR is registered, it will be called prior to
    //! starting the watchdog timer.
    //!
    //! If \c BSP_KEY_NO_ISR is defined, key debounce will be
    //! implemented using active state debounce (ISR not possible).
    //! Functions this define is included to allow that the watchdog
    //! interrupt vector is not occupied by the key handler. When
    //! \c BSP_KEY_NO_ISR is defined, bspKeyPushed() and bspKeyGetDir()
    //! will poll the GPIO pins connected to the keys. Interrupt
    //! related functions will do nothing.

    You also need to call bspKeyInit with BSP_KEY_MODE_ISR argument:
    bspKeyInit(BSP_KEY_MODE_ISR);

    When I did those changes project did not compile because io_pin_int.h was missing from project, as you can see above it is included if BSP_KEY_NO_ISR is not defined. It looks like the interrupt option is given in code but this project was not tested properly for interrupts.

    So I found io_pin_int.h and io_pin_int.c in 1120 Easylink software examples and included them. Then the project compiled but got the linker error I posted above because same interrupts io_pin_int.c are defined somewhere else in TI_SIGFOX_lib_FCC.lib as well. I can't see what is in TI Sigfox library. I contacted Sigfox about that and they advised they only built sigfox modulation code for all the rest of application questions I should contact TI.

    So my problem is to register my custom ISR functions to button interrupts which can apparently be done via bspKeyIntRegister() function in bsp_key.c. But bsp_key.c uses ioPinIntRegister() function from io_pin_int.c which also defines PORT_1_VECTOR and PORT_2_VECTORs and ISR to call the custom ISR functions. Apparently these vectors are also defined somewhere in TI_SIGFOX_lib_FCC.lib so the project doesn't link. I have to use TI_SIGFOX_lib_FCC.lib for Sigfox, so couldn't find a way how I can use interrupts with this pre compiled library.

    As I described above my plan is to use P1.1 and P2.1 interrupts to wake cpu from LPM3, send sigfox frames using library and go back to lpm3. The project manages to send messages using button polling but not interrupts. There might be some documentation about that project that I couldn't find. So I would appreciate your help.

    Thanks

  • Just an update.

    I found the following post in the forum:

    Apparently they experienced the same problem in a slightly different version of the sigfox project I think as their error shows int47 defined in  hal_digio2.obj under components/common folder and mine says int47 defined in TI_SIGFOX_lib_FCC.lib<hal_digio2.obj> (I don't have components folder in the project):

    error #10056: symbol "__TI_int47" redefined: first defined in "./components/common/hal_digio2.obj"; redefined in "./apps/sigfox_demo.obj"
    So I followed the suggestion from the post to use halDigio2IntConnect() to register a custom interrupt:
    digio my_pin = { .port = 1, .pin = 1 };
    halDigio2IntConnect(my_pin, Port_1_1);
    ...
    
    void Port_1_1(void)
    {
      //Custom code
    }
    

    And removed the references to io_pin_int.h from bsp_key.c, manually enabled interrupts in sigfox_demo.c.

    Now the project has successfully built, I will flash this to the board and try the interrupts. I will post again once I have the outcome.

    Thanks

  • Hi Ozan,

    Apologies for the confusion, I was referring to the software example resources provided with the BOOSTXL-CC1120-90/TIDC-SIGFOX-CC1120-CC1190-BP. Glad to hear that you might have found a workaround, please do post the outcome after you've tested it.

    Regards,
    Ryan
  • Hi Ryan,

    As I described above I have now added common folder to the project which includes hal files I found in github (github.com/.../MSP430_SIGFOX ) , please see screenshot of project folder:

    And I used following code to register my Port_1_1 function to port 1 interrupt:

    digio my_pin = { .port = 1, .pin = 1 };
    int x1 = halDigio2IntConnect(my_pin, Port_1_1);
    halDigio2IntEnable(my_pin);
    halDigio2IntSetEdge(my_pin, HAL_DIGIO_INT_RISING_EDGE);

     Now the project successfully builds, does not raise an exception for interrupt vector in hal_digio2.obj as in the original post. I am putting the mcu to low power mode 3 and enabling global interrupts. Now my button interrupt works, awakes the cpu and returns successfully (I verified it by blinking leds).

    But the Sigfox modulation does not work. When I wrote to them Sigfox advised that their library uses interrupts and spi for modulation in cc1120 so no interrupt should occur during sigfox modulation and  SIGFOX_API_close() should be called before any interrupts. So now I am not calling  SIGFOX_API_open() until I return from my button interrupt to main function and then calling  SIGFOX_API_open() & sending message then closing it with  SIGFOX_API_close(). Code compiles , I can debug and go over all steps, no error is returned from library functions but still no message is sent (if I use the same function without enabling any interrupt and use button polling example then messages are sent). It looks like haldigio2.c I added to the project conflicts with some code inside invisible TI Sigfox library.

    To summarise it, I just want to use TI Sigfox library provided with this project with low power modes and interrupts which I haven't been able to do so far as I described starting from my first post (the original project provided works in at command mode and button polling mode. But when you enable interrupts in button it includes "io_pin_int.h" in bspkey.c  but that file is not included in the project. So that's why I had started looking for an alternative solution). I searched through all the forum but couldn't find anything else. Is it possible to have some advice and/or direction from you?

    Thanks in advance

    Ozan

  • Hi Orzan,

    Have you thought about disabling pin interrupts and returning the interrupt pins to their initial configuration before calling SIGFOX_API_open()? I will attempt to loop in the TIDC-SIGFOX-CC1120-CC1190-BP design engineer for their thoughts and comments.

    Regards,
    Ryan
  • Hi Ryan,

    Thanks for your response.
    Yes tried both disabling interrupts on two pins P1.1 and P2.1 using P1IE and P2IE registers before calling SIGFOX_API_open() and leaving them enabled. And cleared the flags in IFG register. Didn't make any difference.

    I also tried to use the sigfox open without going into the low power mode before port interrupt. Since I can't see the clock configuration set in
    SIGFOX_APP_mcu_spi_clock_init(), thought low power mode would affect the clocks. But it still didn't work. I think adding the hal_digio2.c manually to the project might be the problem.

    I will wait for your further response then. It looks like lots of Sigfox questions been posted to Sub 1Ghz forum, I can post the question there as well if needed.

    Thanks
  • Hi Ozan,

    You can try the Sub-1 GHz forum, with my limited knowledge of the BoosterPack and software resources I do not have any further suggestions.

    Regards,
    Ryan
  • Thanks for your help Ryan
    I will do that.

    Ozan

**Attention** This is a public forum