Hi,
we are using the "old" IoT sensor with SDK5, ported to Murata ZY (DA14580).
The SDK uses the BMI160 for interrupts during operation (FIFO watermark for sensor readout) and during sleep (motion wakeup), e.g.
#ifndef BLE_APP_SENSOR_FUSION void config_da1458x_pin_intr_1_enable(void) { wrbl_env.wrbl_intr_1_cb = wkup_intr_1_cb; wkupct_register_callback(wrbl_env.wrbl_intr_1_cb); #ifdef USE_MAG_DRDY_INTR wkupct_enable_irq(0x0040, 0x0040, 1, 0); //active high #else wkupct_enable_irq(WKUPCT_PIN_SELECT(INT1_PORT, INT1_PIN), WKUPCT_PIN_SELECT(INT1_PORT, INT1_PIN), 1, 0); //active low #endif }
We want to use another GPIO as interrupt to execute a specific command, it should work during operation but also during sleep modes (hence we can not use the GPIO_EnabeIRQ).
My understanding is:
1) Multiple GPIOs can be configured as wakeup source.
2) For wkupct_enable_irq it is not possible to register different callback functions for different interrupt sources.
3) If wkupct_register_callback() is called multiple times throughout the code, the last registered callback will be used.
Correct?
Question:
4) Is there a register that I can read after waking up, telling me which pin was the interrupt source? Fromhttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...I understand this is not possible?
5) But what about using NVIC_GetPendingIRQ? Aren't different interrupts assigned different IRQn?
--> I found out that they all use the same IRQn:
// datasheet.h WKUP_QUADEC_IRQn = 9, /* Combines the Wake up Capture Timer interrupt, the GPIO interrupt and the QuadDecoder interrupt */
BR Johannes
Hi gme_johannes,
Regarding your first, question, yes you can configure multiple GPIO as a wake-up source. Please check the code snippet below:
Regarding your second question, could you please clarify it? You are correct, in wkupct_register_callback() you are able to register only one callback function. So, if I am able to understand correctly, that you would like to accomplish is to trigger different callback functions from different wake-up interrupts? For example, if you get the interrupt from GPIO_1, the callback_1 should executed and if you get the interrupt from GPIO_2, the callback_2 should executed.
Thanks, PM_Dialog
Yes, that is correct.
Fromhttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...I understand I can check the GPIO state after the interrupt was triggered.
Will this be fast enough in any case? Will the GPIO state always be retained long enought, if the first thing I do in the callback function is to check its state?
Hi gme_johannes,
In the past forum thread that you have referred, MT_Dialog correctly had mentioned that there is no register that will indicate the port/pin that the interrupt occurred, So you will have to read the status of the pin right after the device has been awaken and according to the pin status you will have to decide which callback function will be triggered.
Thanks, PM_Dialog
Thank you, I will attempt to solve my problem this way.
Hi gme_johannes,
Thanks for accepting my answer. Please let me know if you have any other issues.
Thanks, PM_Dialog