This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

app_sched_event_put from GPIOTE_IRQHandler

Hi, i'm trying to read an i2c sensor on interrupt. Doing it directly in the interrupt is apparantly bad, so io tried using app_sched_event_put, but that just crashes inside propriatary code.

How do i run stuff from interrupts then?

#0  0x000006b0 in ?? ()
#1  <signal handler called>
#2  0x0001aa8a in sd_nvic_critical_region_enter     (p_is_nested_critical_region=p_is_nested_critical_region@entry=0x20003f87 "")
at ../../components/softdevice/s110/headers/nrf_soc.h:500
#3  0x0001ab20 in app_sched_event_put (p_event_data=p_event_data@entry=0x0, event_data_size=event_data_size@entry=0, 
handler=handler@entry=0x18399 <sensor_event_handler>) at ../../components/libraries/scheduler/app_scheduler.c:102
#4  0x0001851e in GPIOTE_IRQHandler () at main.c:139
#5  <signal handler called>
#6  0x0000d16c in ?? ()
#7  0x0000119a in ?? ()


 void GPIOTE_IRQHandler(void) {
     if (NRF_GPIOTE->EVENTS_PORT) {
          NRF_GPIOTE->EVENTS_PORT = 0;
           app_sched_event_put(NULL, 0, sensor_event_handler);
          }
      }
 } 
Parents
  • Do you set the interrupt priority to either APP_PRIORITY_HIGH or APP_PRIORITY_LOW?

  • Hi Ole,

    Do you have any solutions on it?

    I also caught this issue when I try the scheduler put in the interrupt function of lpcomp, whose LPCOMP_CONFIG_IRQ_PRIORITY level is 6.  And the platform is 15.2, which defines CRITICAL_REGION_ENTER as:

    #ifdef SOFTDEVICE_PRESENT
    #define CRITICAL_REGION_ENTER() \
    { \
    uint8_t __CR_NESTED = 0; \
    app_util_critical_region_enter(&__CR_NESTED);
    #else
    #define CRITICAL_REGION_ENTER() app_util_critical_region_enter(NULL)
    #endif

    void app_util_critical_region_enter(uint8_t *p_nested)
    {
    #if __CORTEX_M == (0x04U)
    ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get())
    #endif

    #if defined(SOFTDEVICE_PRESENT)
    /* return value can be safely ignored */
    (void) sd_nvic_critical_region_enter(p_nested);
    #else
    app_util_disable_irq();
    #endif
    }

Reply
  • Hi Ole,

    Do you have any solutions on it?

    I also caught this issue when I try the scheduler put in the interrupt function of lpcomp, whose LPCOMP_CONFIG_IRQ_PRIORITY level is 6.  And the platform is 15.2, which defines CRITICAL_REGION_ENTER as:

    #ifdef SOFTDEVICE_PRESENT
    #define CRITICAL_REGION_ENTER() \
    { \
    uint8_t __CR_NESTED = 0; \
    app_util_critical_region_enter(&__CR_NESTED);
    #else
    #define CRITICAL_REGION_ENTER() app_util_critical_region_enter(NULL)
    #endif

    void app_util_critical_region_enter(uint8_t *p_nested)
    {
    #if __CORTEX_M == (0x04U)
    ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get())
    #endif

    #if defined(SOFTDEVICE_PRESENT)
    /* return value can be safely ignored */
    (void) sd_nvic_critical_region_enter(p_nested);
    #else
    app_util_disable_irq();
    #endif
    }

Children
No Data
Related