ESP8266 Developer Zone The Official ESP8266 Forum 2016-03-31T03:23:54+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1946 2016-03-31T03:23:54+08:00 2016-03-31T03:23:54+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1946&p=6277#p6277 <![CDATA[Re: Hardware timer crashes, nonos SDK 1.5.2]]>
I deleted the "ICACHE_FLASH_ATTR", but this wasn't enough. But after replacing "hw_timer.c" from SDK with the file you provided it works perfectly!

Statistics: Posted by Goldpin — Thu Mar 31, 2016 3:23 am


]]>
2016-03-30T09:59:45+08:00 2016-03-30T09:59:45+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1946&p=6256#p6256 <![CDATA[Re: Hardware timer crashes, nonos SDK 1.5.2]]>
Please delete the "ICACHE_FLASH_ATTR " before your hardware timer callback. The interrupt handler should not be stored in flash.

static void stepper_timer_cb(void)
{
...
}


Please have a try with the attachment, if your problem is still unsolved, please feel free to let us know.
hw_timer_for_ESP8266_NONOS_SDK_V1.5.2.zip

Statistics: Posted by ESP_Faye — Wed Mar 30, 2016 9:59 am


]]>
2016-03-28T03:14:46+08:00 2016-03-28T03:14:46+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1946&p=6235#p6235 <![CDATA[[Solved] Hardware timer crashes, nonos SDK 1.5.2]]>
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:

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:

hw_timer_init(FRC1_SOURCE,0);
hw_timer_set_func(stepper_timer_cb);
hw_timer_arm(2500);


Here is the callback function:

Code:

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.

Statistics: Posted by Goldpin — Mon Mar 28, 2016 3:14 am


]]>