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

error 4 No Memory for operation with gpiote

am trying to synchronize two nrf52840 thank's to state gpio with gpiote function but it return an error code 4 (No Memory for operation) whith this line -> NRF_LOG_INFO("no succes err_code=%d",retval);<- i don't know how to resolve it because i try with app_gpiote_init() but it's the same error

static app_gpiote_user_id_t m_example_user_id;
static void example_gpiote_event_handler(uint32_t event_pins_low_to_high, uint32_t event_pin_high_to_low);
bool nrf_drv_gpiote_in_is_set (nrf_drv_gpiote_pin_t pin);

static void gpiote(void){

bool val = nrf_drv_gpiote_init();


uint16_t state = nrf_gpio_pin_read(3);
nrf_drv_gpiote_pin_t pin =3;
nrf_drv_gpiote_in_event_addr_get(pin);
nrf_drv_gpiote_in_event_enable(3,true ); 
APP_GPIOTE_INIT(GPIOTE_USER_NODE_SIZE );


uint32_t tab[APP_GPIOTE_BUF_SIZE(GPIOTE_USER_NODE_SIZE)] = {0};
app_gpiote_init ( GPIOTE_USER_NODE_SIZE,&tab[0]);

//Size of app_gpiote.gpiote_user_t 
NRF_LOG_INFO("%d",GPIOTE_USER_NODE_SIZE);


//test initialisation 
if(val == false){
NRF_LOG_INFO("initialisation = false");
} 
else{
NRF_LOG_INFO("initialisation = true");
}

// recuperation de l'etat sans envoye de données 
if(nrf_drv_gpiote_in_is_set(3)==true){
NRF_LOG_INFO("Etat_sans_données= haut,%b",nrf_drv_gpiote_in_is_set(3));
}

if(nrf_drv_gpiote_in_is_set(3)==false){
NRF_LOG_INFO("Etat_sans_données = bas",nrf_drv_gpiote_in_is_set(3));
}

uint32_t low_to_high_bitmask = 0x0000000F; // Bitmask to be notified of transition from low to high for GPIO 0-3
uint32_t high_to_low_bitmask = 0x0000000E; // Bitmask to be notified of transition from high to low for GPIO 0-2
uint32_t retval ;

retval= app_gpiote_user_register(&m_example_user_id, &low_to_high_bitmask ,&high_to_low_bitmask,(app_gpiote_event_handler_t)example_gpiote_event_handler);


if(retval != NRF_SUCCESS){
NRF_LOG_INFO("no succes err_code=%d",retval);
}

else{
NRF_LOG_INFO("succes");
}




}

void example_gpiote_event_handler(uint32_t event_pins_low_to_high, uint32_t event_pin_high_to_low){
if(event_pins_low_to_high & 0x0000000F){

NRF_LOG_INFO("succes");

}
if(event_pin_high_to_low & 0x0000000F){

NRF_LOG_INFO("succes");

}
}

Related