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.

CC2640R2F: Sensor Controller event handler code failing

Part Number: CC2640R2F

Hello,

I am using sensor controller on my cc2640r2f to perform SPI data communication with another MCU. I am having intermintent issue (can happen between 10 minutes and 24 hours) where the event handler code fails to execute indefinately. 

The event handler code is triggered by an interrupt of the positive edge of a DIO pin. We are using SPI full duplex mode for communication, so the order of our event handler code is:

1) Write to other MCU that a read action is to be performed.

2) Wait on other MCU to pull DIO pin low

3) Read data from other MCU

The real strange part is that we can still execute the Execution code from the cc2640r2f using the scif commands. Which means we can send data to the other MCU (see data in other MCU's memory) but cannot get a response from it. We have tried toggling the DIO interrupt pin to see if it is the case of a missed interrupt, but the event handler code still did not execute. 

Is it possible that the event handler on the sensor controller crashes, yet the execution code can still run?

  • Hi Tyler,
    We will look into this and get back.
  • Hello FI,
    Any news on this issue? Is there someone I can email or call to try and resolve this problem we are experiencing?
  • We are still having issues with the Sensor Controller Event Handler locking up.

    We isolated one issue that caused the sensor to crash every time. This was due to having a while loop that waited an indefinite amount of time for the other MCU to respond. Changing this to a static delay, and having the other MCU toggle the interrupt line if the SPI transfer was missed fixed this problem. However, after leaving the device on for 16 to 24 hours, the controller crashes due to unknown reasons.

    Below is my event handler code. Any help would be appreciated. Thanks

    U16 value;
    U16 fullDuplexCommand=0;
    U16 n=0;
    U16 tempBuf=0;
    U16 checkSum=0;

    gpioGetInputValue(AUXIO_I_SREADY;value);
    evhSetupGpioTrigger(0,AUXIO_I_SREADY , 1, EVH_GPIO_TRIG_ON_EDGE);
    if(output.dataAvail==0){
    if (value==1){

    if (input.ringBuf==1){

    spiBegin(SPI_POL0_PHA0, AUXIO_SPI_CSN_CS);
    fwDelayUs(10,FW_DELAY_RANGE_100_MS);
    spiTxRx16bit(SPI_POL0_PHA0, Spi_Command_Write; fullDuplexCommand);//initiates read using full duplex; recieves status byte from MCU
    // fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    // spiTx8bit(SPI_POL0_PHA0, DummyVariable);//dummy destination
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    spiTx16bit(SPI_POL0_PHA0, DummyVariable);//dummy length
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    spiTx8bit(SPI_POL0_PHA0,Command_Read);//Write/Read
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    spiTx16bit(SPI_POL0_PHA0, DummyVariable);//dummy checkSum
    // fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    spiEnd(SPI_POL0_PHA0, AUXIO_SPI_CSN_CS);


    //THIS IS WHERE THE VARIABLE LENGTH DELAY WAS
    fwDelayUs(100000,FW_DELAY_RANGE_100_MS);



    spiBegin(SPI_POL0_PHA0, AUXIO_SPI_CSN_CS);
    spiTxRx8bit(SPI_POL0_PHA0, Spi_Command_Read; fullDuplexCommand);
    fullDuplexCommand=(fullDuplexCommand&0x000A);
    if(fullDuplexCommand!=0x0002){

    } else{
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    while (n<175){//since it is static the vnc2 should wait sufficient time before queuing up any more data
    spiRx8bit(SPI_POL0_PHA0; tempBuf);
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);

    spiTxRx8bit(SPI_POL0_PHA0, Spi_Command_Read; fullDuplexCommand);
    fullDuplexCommand=(fullDuplexCommand&0x000A);
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    spiTxRx8bit(SPI_POL0_PHA0, Spi_Command_Read; output.MISOUSB[n]);
    if (fullDuplexCommand==0x0002){
    output.MISOUSB[n]=(output.MISOUSB[n]<<8)|tempBuf;
    } else{
    output.MISOUSB[n]=tempBuf;
    }

    if(n>2) {
    checkSum+=(output.MISOUSB[n]>>8)+(output.MISOUSB[n]&0x00FF);
    }
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);
    spiTxRx8bit(SPI_POL0_PHA0, Spi_Command_Read; fullDuplexCommand);
    fwDelayUs(1,FW_DELAY_RANGE_100_MS);

    fullDuplexCommand=(fullDuplexCommand&0x000A);
    n=n+1;
    }

    output.MISOUSB[n]=0x0000;
    output.dataAvail=1;

    fwGenAlertInterrupt();
    }
    spiEnd(SPI_POL0_PHA0, AUXIO_SPI_CSN_CS);

    }
    }

    }