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.

CC26XX cannot set PIN_setInterrupt after PIN_add

I have trouble activating en ISR to a newly added PIN. I frist do a PIN_open with an empty pintable:

static const PIN_Config _pinTable[] =
{
  PIN_TERMINATE
};

I also already assign a ISR callback

Then I want to add pins via: 

PIN_registerIntCb(pinHandle, EH_isr)

Then I want to add a new pin to the handle:

PIN_add(pinHandle,config);
status = PIN_setInterrupt(pinHandle, PIN_IRQ_POSEDGE);

This however gives me a PIN_NO_ACCESS status.

What's wrong here?

  • Hello,

    You can see examples on how the PIN driver is used as an interrupt in this wiki entry: processors.wiki.ti.com/.../Cc2640_Adding_a_UART_or_SPI_driver_to_a_Sample_Project

    Pay attention to the MRDY processing.

    Beyond that, I suggest adding the PIN driver source files (and driverlib) to your project and step through the code.

    Best wishes
  • JXS said:
    Hello,

    You can see examples on how the PIN driver is used as an interrupt in this wiki entry: processors.wiki.ti.com/.../Cc2640_Adding_a_UART_or_SPI_driver_to_a_Sample_Project

    Pay attention to the MRDY processing.

    I can't see any reference to the PIN api, nor to interrupt processing in that wiki entry... What's the relevance to my problem? Same goes for MRDY messages..

    JXS said:

    Beyond that, I suggest adding the PIN driver source files (and driverlib) to your project and step through the code.

    I obviously did that already.. That still does not tell me why I cannot access the PIN

  • So, apparently, you cannot use the flag PIN_IRQ_POSEDGE in either the table in PIN_open, nor PIN_add. PIN_open even completely crashes...

    The solution is to use the IRQ flags only with PIN_setInterrupt.

  • Christiaan,

    PIN_open loops through the PIN_Config array given as argument and will set an internal variable bOk depending on the result (checking that pin exists and not already registered with a handle).

    With your current argument (array contains only PIN_TERMINATE ) the bOk variable is never initialized and being a auto variable the contents of bOK is undefined (but it seems with your compiler bOk is zero). This use case is not supported by the PIN driver and I suspect you get NULL returned from PIN_open instead of getting the return pointer to the PIN_State you gave as argument.

    From what I can see it should be possible to define the interrupt as well both in PIN_add and PIN_open, they all call PIN_setConfig internally to configure the IO port.

    Regards
    Svend