Other Parts Discussed in Thread: CC2650
Tool/software: Code Composer Studio
I have couple of questions regarding CC2650 and TI RTOS:
1. I need to use a pin as input and output simultaneously in an open drain mode (externally pulled high) to do a one-wire interface. But I am having hard time getting an interrupt when pin is pulled low. Is it possible to get a negative edge interrupt when a pin is configured with input enabled, output enabled, no pullup and open drain?
"Board_ONE_WIRE | PIN_INPUT_EN | PIN_GPIO_OUTPUT_EN | PIN_NOPULL | PIN_OPENDRAIN,"
2. For a Timer is it possible to configure to trigger timer start on falling edge of a pin, set a compare register value to stop timer and generate an interrupt on matching compare value? Base on CC2650 reference manual it don't seem to be possible.
/********************************************************************* * @fn edgeTriggerCallback * * @brief * * @param none * * @return none */ void edgeTriggerCallback(PIN_Handle handle, PIN_Id pinId) { //do something.... } /********************************************************************* * @fn OneWire_processEvent * * @brief * * @param none * * @return none */ static void OneWire_taskFxn(UArg a0, UArg a1) { PIN_State hStateHui; PIN_Handle hPin; // Initialize application OneWire_init(); // Define pins used by Human user interface and initial configuration const PIN_Config aPinListHui[] = { Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, Board_ONE_WIRE | PIN_INPUT_EN | PIN_GPIO_OUTPUT_EN | PIN_NOPULL | PIN_OPENDRAIN, PIN_TERMINATE }; // Get handle to this collection of pins hPin = PIN_open(&hStateHui, aPinListHui); if (!hPin) { // Handle allocation error } // Edge trigger config PIN_registerIntCb(hPin, edgeTriggerCallback); PIN_setInterrupt(hPin, PIN_ID(Board_ONE_WIRE)| PIN_IRQ_NEGEDGE); // Application main loop for (;;) { // Get the ticks since startup uint32_t tickStart = Clock_getTicks(); PIN_setOutputValue(&hStateHui, Board_RLED, PIN_getOutputValue(Board_RLED) ^ 0x0001); // Sleep for 250 ms Task_sleep(250000/10); //printf("OneWire_taskFxn\r\n"); } }