xTimerResetFromISR Exception
Posted: Fri Mar 03, 2017 11:00 pm
I am trying to reset a timer from within an ISR. The HW_IsrHandler is called when a button is pressed on pin 14, but resetting the timer generates a StoreProhibited exception at xTimerResetFromISR.
Any idea what could be causing this?
Thanks for your input!
Code: Select all
#include <stdio.h>
#include <sys/time.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "driver/timer.h"
#include "freertos/timers.h"
TimerHandle_t timer=NULL;
void HW_IsrHandler(void* arg)
{
gpio_num_t pin = (gpio_num_t) arg;
if(gpio_get_level(pin)==0) {
xTimerResetFromISR(timer, 1000 / portTICK_RATE_MS);
}
}
void timerCallback(TimerHandle_t id) {
}
void app_main()
{
uint8_t pin=14;
timer=xTimerCreate("timer Callback", 1000 / portTICK_RATE_MS, pdFALSE, (void *)0, timerCallback);
gpio_install_isr_service(0 );
gpio_config_t io_conf;
io_conf.pull_down_en = 0;
io_conf.pull_up_en = 1;
io_conf.intr_type = GPIO_INTR_ANYEDGE;
io_conf.pin_bit_mask = (1<<pin);
io_conf.mode = GPIO_MODE_INPUT;
gpio_config(&io_conf);
gpio_isr_handler_add(pin, HW_IsrHandler, (void*) &pin);
}
Thanks for your input!