Other Parts Discussed in Thread: UNIFLASH, CC1310
Tool/software: Code Composer Studio
Hey guys,
we use sensor/collector 15.4Stack example and we'd like to automatically factory reset the collector. Basically I want to apply a rising edge on DIO12 causing a HWI to exectue. In the ISR I want to trigger an event and processing the event I want 3 things/functions to happen/execute:
- Inform the user by printing something via System_printf
- Csf_clearAllNVItems();
- SysCtrlSystemReset();
At the beginning I just wanted to see if the HWI works and execute all three functions within the ISR. This is what goes wrong.
- The DIO12 is floating and the HWI is triggered when I put a jumper cable on the pin, which is floating, too, since the other side of the jumper cable is not connected to anything.. I guess I have wrong PIN settings.
- When I connect the 3V pin of the launchpad with DIO12 I sometimes get an interrupt but not always (I guess the same issue as number 1)
- I can see, that the application is resetted, because the red LED stops blinking, but the collector never comes back to life (LED stays off and no restart-prints via uart)
- The messages are only printed if I comment out the other two functions, I guess the reset prevents the system from printing
This is how I configure the PIN and interrupt
/* Pin interrupt */ static PIN_Config intrPinTable[] = { Board_HWI_Factory_Reset | PIN_INPUT_EN | PIN_NOPULL | PIN_HYSTERESIS, PIN_TERMINATE };
const PIN_Config BoardGpioInitTable[] = { CC1310_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ CC1310_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ CC1310_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC1310_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */ CC1310_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */ CC1310_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ CC1310_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ CC1310_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ //________________MY CHANGE START_____________________ CC1310_LAUNCHXL_DIO12 | PIN_INPUT_EN | PIN_NOPULL | PIN_HYSTERESIS, //________________MY CHANGE END_______________________ PIN_TERMINATE };
// Configure GPIO interrupt Board_intr_initialize(); PIN_registerIntCb(intr_handle, &intr_HwiFxn); PIN_setConfig(intr_handle, PIN_BM_IRQ, Board_HWI_Factory_Reset | PIN_IRQ_POSEDGE);
void Board_intr_initialize(void) { /*** Pin interrupt ***/ // Configure GPIO interrupt intr_handle = PIN_open(&intr_state, intrPinTable); } void intr_HwiFxn(PIN_Handle hPin, PIN_Id pinId) { System_printf("HWI detected. Initiating factory reset sequence.\r\n"); //Csf_clearAllNVItems(); System_printf("NV deleted!ByeBye!\r\n"); //Task_sleep(100000); // = 1s //SysCtrlSystemReset(); }
This is basically all what I've done, of course I have also assigned IOID_12 to "Board_HWI_Factory_Reset".
.
I think issue 1 and 2 can be solved by correctly configuration of the PIN 12 and issue 4 by using Collector Events. Any comment on that?
Any idea what functions I might have to add to get the application running after setting SysCtrlSystemReset(); or this is the exact equivalent to pressing the "reset" button?
kind regards
Slev1n