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.

ADXL362 Interrupt handling issue in CC2650

Other Parts Discussed in Thread: CC2650, SYSBIOS

Hello All,

I am Integrating ADXL362 sensor with CC2650 to develop a sensor based application.

Hardware set-up :

CC2650EM+SmartRF06EB connected with ADXL362 evaluation board

Steps followed in software .

1. In main function, I have called PIN_Init function to have safe default settings for GPIO

2. Open the PINs and get the handle

ADXL362PinHandle = PIN_open(&ADXL362PinState, ADXL362PinTable);

3. Registering Interrupt callback

 PinStatusRet = PIN_registerIntCb(ADXL362PinHandle, adxl362Callback);

4. Configure PINs

 PinStatusRet = PIN_setConfig(ADXL362PinHandle, PINCC26XX_BM_WAKEUP, Board_ADXL_INT1 | PINCC26XX_WAKEUP_NEGEDGE);

5. Initialising SPI

 SPI_Params_init(&AdxlParams);

 AdxlHandle = SPI_open(CC2650_SPI1, &AdxlParams);

6. Initialising and configure ADXL362 sensor

Whenever I am setting ADXL362 FIFO watermark interrupt , Immediately getting into adxl362Callback function. After that My code hangs and subsequent  interrupts are not generated.

Guide me on this

Thanks in advance

  • Which version of TI-RTOS are you using?


    Alan

  • Does your pin interrupt handler properly service the interrupt such that the interrupt is no longer asserted?

    If not, you may simply be in an infinite loop of returning to the interrupt.

    Can you share your board.c file so I can tell if it is consistent with the TI-RTOS version you are building with?

    Alan
  • Hello Alan,
    Thanks for your response.

    1. I am using TI-RTOS version tirtos_simplelink_2_11_01_09

    2. Whenever I get interrupt from ADXL362 sensor, I am using xQueueSend function to post an Action to the RTOS.
    -- I assume RTOS come out of the ISR service and wait for the tasks.
    -- Do we need to clear the HW interrupts explicitly using function "PIN_clrPendInterrupt"?

    3. In Board.h file
    -- I am using SPI1 for the communication

    -- #define DEFINE_BOARD_PIN_STATE(pin, settings) (PIN_ID(pin)|(settings)) // Set up initial pin configuration

    -- Defined a macro to allocate IO pin to ADXL362 interrupt set up
    #define Board_ADXL_INT1 IOID_28

    In board.c file
    -- In BoardGpioInitTable , I have called the macro to set default configuration

    DEFINE_BOARD_PIN_STATE(Board_SPI1_CSN, PIN_INPUT_DIS),
    DEFINE_BOARD_PIN_STATE(Board_ADXL_INT1, PIN_INPUT_DIS),

    In my application

    const PIN_Config ADXL362PinTable[] = {
    Board_SPI1_CSN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* Chip Select pin high initially*/
    Board_ADXL_INT1 | PIN_INPUT_EN | PIN_PULLDOWN | PIN_HYSTERESIS, /* ADXL362 interrupt*/
    PIN_TERMINATE
    };

    I am using ADXL362PinTable in PIN_open,PIN_registerIntCb and PIN_setConfig functions.

    Current status:
    I have removed Interrupt pin connection from ADXL362 sensor and I am trying to simulate interrupt manually, My observation is If interrupt is not frequent( approx ,1 second once) then software behaves as expected , But if interrupt is more frequent then software in undefined state and complete system hangs.


    Thanks.
  • Hi,

    I am trying to interface ADXL362 with CC2650 via SPI. I could open the handle and tested the loopback mode which works fine. While checking with the logic analyzer i can see the data being transferred from the CC2650 but ADXL is not responding. It always remains at 00.

    Is there something stupid i am doing in code?



    #include <xdc/runtime/Error.h>

    #include <ti/sysbios/family/arm/cc26xx/Power.h>
    #include <ti/sysbios/BIOS.h>

    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/System.h>

    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>

    /* TI-RTOS Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/SPI.h>
    #include "ICall.h"
    #include "observer.h"
    #include "simpleBLEObserver.h"


    /* Header files required to enable instruction fetch cache */
    #include <inc/hw_memmap.h>
    #include <driverlib/vims.h>

    #ifndef USE_DEFAULT_USER_CFG

    #include "bleUserConfig.h"

    // BLE user defined configuration
    bleUserCfg_t user0Cfg = BLE_USER_CFG;

    #endif // USE_DEFAULT_USER_CFG

    SPI_Handle      spi;
    SPI_Params      spiParams;
    SPI_Transaction spiTransaction;
        
    /**
     * Exception handler
     */
    void exceptionHandler()
    {
        volatile char i = 1;
        while(i);
    }
     unsigned int    i;
        uint16_t        temperature;
        uint8_t         txBuffer[3]={0x0b,0x01,0x03};
        uint8_t         rxBuffer[20];
        
    #define TASK_STACK_SIZE 512
    #define TASK_PRI        1
    Char taskStack[TASK_STACK_SIZE];
    Task_Struct taskStruct;
     PIN_Handle Pin = NULL;
     bool ret;
    /*
     *  ======== main ========
     */
     PIN_State state ;
     
       void taskFxn(UArg a0,UArg a1)
    {
    //  for(int k=0;k<100;k++)
      while(1)
      {
        spiTransaction.count=3;
        spiTransaction.rxBuf=rxBuffer;
        spiTransaction.txBuf=txBuffer;
        spiTransaction.arg = NULL;
    //    Pin=PIN_open(&state, BoardGpioInitTable);
    //    PIN_setOutputEnable(Pin, Board_LCD_CSN, true);
    //    PIN_setOutputValue(Pin, Board_SPI0_CSN, 0);
           ret= SPI_transfer(spi, &spiTransaction);
           while(spiTransaction.status!=SPI_TRANSFER_COMPLETED);
      if(ret)
         {
            System_printf("SPI Bus read\n");
         }
         else
         {
            System_printf("SPI Bus fault\n");
            SPI_close(spi);
         }
    //  PIN_setOutputValue(Pin, Board_SPI0_CSN, 1);
    //    for(int k=0;k<1000000;k++);
    //  PIN_setOutputValue(Pin, Board_LCD_CSN, false);
      }
    }

    int main()
    {
     
      PIN_init(BoardGpioInitTable);

    #ifndef POWER_SAVING
        /* Set constraints for Standby, powerdown and idle mode */
        Power_setConstraint(Power_SB_DISALLOW);
        Power_setConstraint(Power_IDLE_PD_DISALLOW);
    #endif //POWER_SAVING

        /* Create SPI for usage */
        SPI_Params_init(&spiParams);
           
      spiParams.bitRate     =3000000;
      spiParams.frameFormat = SPI_POL0_PHA1 ;
      spiParams.mode        = SPI_MASTER;
    //  spiParams.dataSize=8;
     
        spi = SPI_open(Board_SPI0, &spiParams);
        if (spi == NULL) {
            System_abort("Error Initializing spi\n");
        }
        else {
            System_printf("spi Initialized!\n");
        }

     
        spiTransaction.count=3;
        spiTransaction.rxBuf=rxBuffer;
        spiTransaction.txBuf=txBuffer;
        spiTransaction.arg = NULL;

        Task_Params params;
        Task_Params_init(&params);
        params.priority = TASK_PRI;
        params.stackSize = TASK_STACK_SIZE;
        params.stack = &taskStack;

        Task_construct(&taskStruct, taskFxn, &params, NULL);

        /* enable interrupts and start SYS/BIOS */
        BIOS_start();

        return 0;
    }

    /**
     * Error handled to be hooked into TI-RTOS
     */
    Void smallErrorHook(Error_Block *eb)
    {
      for (;;);
    }

    /**
     * HAL assert handler required by OSAL memory module.
     */
    void halAssertHandler(void)
    {
      for (;;);
    }

  • annamol alex

    Please open a separate thread for your question.

    Alan
  • RATHINASAMY,

    In addition to the "PINCC26XX_WAKEUP_NEGEDGE" bit in your pin configuration, I think you need to include "PINCC26XX_IRQ_NEGEDGE".

    I suspect that without this bit, you'll only get an interrupt from the pin when the device is in a low power sleep mode.

    Alan
  • The WAKEUP bit mask is used in conjunction with Shutdown mode to wake a device up again from shutdown and does not need to be used for this.

    When setting the PINCC26XX_IRQ_NEGEDGE flag the PIN driver will both enable this flag for edge detection. The interrupt to the CPU itself is set up as well as configuring the device to wake up on any pin that has edge detection enabled happens during PIN_init.

    Regards,
    Svend