These are chat archives for SmingHub/Sming

Nov 2016
Nov 20 2016 09:18
Hi (after long time ;p),
how do I use HW Timer? Simply including <Libraries/HardwareTimer.h> and declaring variable as HardwareTimer instead if Timer does not work, compiler says "app/main.h:62:2: error: 'HardwareTimer' does not name a type"
of Timer*
Sming develop @ 2016-03-18
Nov 20 2016 10:59
@laurentppol check its for smingrtos, but i thin for hwtimer udage is same
Nov 20 2016 11:03
You simply declare "HardwareTimer hardwareTimer;" but this is what compiler complains about... (in my prog)
code ```#if defined(ets)
#include <Libraries/OneWire/OneWire.h>
#include <Libraries/LiquidCrystal/LiquidCrystal_I2C.h>
    #include <SmingCore/HardwareTimer.h>

OneWire             OneWire_bus(OW_PIN);
LiquidCrystal_I2C   lcd(I2C_LCD_ADDR, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

Timer               Timer_1;
    Timer           Timer_500ms;
    HardwareTimer   Timer_500ms;
``` app/main.h:63:2: error: 'HardwareTimer' does not name a type
HardwareTimer Timer_500ms;
Nov 20 2016 11:41
OK, looks foud... it is Hardware_Timer NOT HardwareTimer... WITH an underscore
Nov 20 2016 12:01
oops, got crash
Fatal exception 0(IllegalInstructionCause):
epc1=0x40238dd8, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

 ets Jan  8 2013,rst cause:2, boot mode:(1,7)

 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset
after ~8min running
Nov 20 2016 12:16
and again, ~12min,
dev 1143

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
recompiled back to "normal" Timer, to see if it is HardwareTimer related
Nov 20 2016 13:41
it looks elated :(, with Timer (soft) 1h8min and no crash, any ideas?
Nov 20 2016 20:59
@laurentppol , exception 0 with epc1=0x402xxxxx usually means that you tried to run some code from flash from a hardware IRQ. Add the IRAM_ATTR to the function which is pointed to and everything it calls.
(well, everything that gets called from the HardwareTimer)
Nov 20 2016 21:28
Finally I uploaded arduino sketch to my custom board with esp32... Had problems with 2 faulty usb to serial ttl adapters. But blink to pin11 doesn't works. It works on pin5 though.
Nov 20 2016 23:11
@alltheblinkythings oops, to ALL functions innterrupt routine calls? There is a lot of LCD, even TCP, does in mean that I need to switch back to my "old" software design (working on AVR, but there is "sleep_mode()" function), that HW int ONLY sets flags (100ms, 500ms, 1s) and main progam loop executes tasks based on those flags? Is some "sleep_mode()" [sleep until interrupt] construct?
"neverenging" "check a flag and react upon" loop will not break aything?
Nov 20 2016 23:51
what if I use digitalRead/Write? should I modify libs?