-->
Page 1 of 1

OTA hw_timer conflict

PostPosted: Fri Aug 18, 2017 5:46 am
by mugginsjm
Hi
I'm sure this has been discussed before but I can't find a solution.
I've built a light dimmer and the code uses hw-timer and includes the lines:
hw_timer_init(NMI_SOURCE, 0);
hw_timer_set_func(dimTimerISR);

ESPhttpUpdate.update() will only work if I comment out the second line.
I appreciate that this has something to do with disabling interrupts but having tried noInterrupts() I don't know how to proceed.
thanks
John

Re: OTA hw_timer conflict

PostPosted: Sun Oct 22, 2017 4:54 pm
by Jamie Clark
Hi,

I had the same problem. Found the solution elsewhere on this board.

Use the below function to disable the hardware timers.

void ICACHE_FLASH_ATTR hw_timer_disable(void)
{
ETS_FRC1_INTR_DISABLE();
TM1_EDGE_INT_DISABLE();
RTC_REG_WRITE(FRC1_CTRL_ADDRESS, 0);
}

And add the following code to your setup loop

ArduinoOTA.onStart([]() {
hw_timer_disable();
});

Here's the post where I found it:
viewtopic.php?p=34411