I'm using hw_timer.c from nonos SDK 1.5.2 to set a hardware timer without autoload. The callback function fires with specified delays, but i'm getting frequent crashes (every approx 5 sec). Crashes stops when I'm not using hardware timer.
Here is the crash:
Code: Select all
state: 5 -> 2 (2c0)
rm 0
reconnect
state: 2 -> 0 (0)
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt
connected with TP-LINK 3, channel 4
dhcp client start...
ip:192.168.1.104,mask:255.255.255.0,gw:192.168.1.1
pm open,type:2 0
Fatal exception 0(IllegalInstructionCause):
epc1=0x40244cf8, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
ets Jan 8 2013,rst cause:1, boot mode:(3,0)
load 0x40100000, len 29608, room 16
tail 8
chksum 0xf6
load 0x3ffe8000, len 884, room 0
tail 4
chksum 0x08
load 0x3ffe8380, len 784, room 4
tail 12
chksum 0xf3
csum 0xf3
r��l��ĞeStepper motor init succesful
espconn_accept [0] !!!
mode : sta(18:fe:34:9b:96:fb)
add if0
f r-1, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
Here is the initialization code:
Code: Select all
hw_timer_init(FRC1_SOURCE,0);
hw_timer_set_func(stepper_timer_cb);
hw_timer_arm(2500);
Here is the callback function:
Code: Select all
static void ICACHE_FLASH_ATTR stepper_timer_cb(void)
{
if(!GPIO_INPUT_GET(step_pin)) gpio_output_set((1<<step_pin),0,0,0);
else gpio_output_set(0,(1<<step_pin),0,0);
hw_timer_arm(2500);
}
I also noticed that when the timer is not armed, the callback function still fires, approx every 0.5s. Looks like something else is triggering the interrupt.
Any help would be appreciated.