ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

hrsavla
Posts: 5
Joined: Sun May 24, 2015 11:50 am

Re: ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

Postby hrsavla » Wed Aug 12, 2015 4:46 pm

I am using "Sming Framework with latest SDK1.3" and trying to port hw_timer code. But I am not able to compile hw_timer.c code.
It seems there is no NmiTimSetFunc(func).

Kindly look the bellow error and let me know of header files which I need to point NmiTimSetFunc.

I am getting bellow error

Code: Select all

CLEAN SUCCESSFUL (total time: 4s)
C+ app/application.cpp
C+ app/hw_timer.cpp
In file included from c:/tools/Sming/Sming/system/include/esp_systemapi.h:6:0,
                 from include/user_config.h:29,
                 from app/hw_timer.cpp:1:
app/hw_timer.cpp: In function 'void hw_timer_init(FRC1_TIMER_SOURCE_TYPE, u8)':
c:/Espressif/ESP8266_SDK/include/ets_sys.h:55:20: error: 'NmiTimSetFunc' was not declared in this scope
  NmiTimSetFunc(func)
                    ^
app/hw_timer.cpp:65:9: note: in expansion of macro 'ETS_FRC_TIMER1_NMI_INTR_ATTACH'
         ETS_FRC_TIMER1_NMI_INTR_ATTACH(hw_timer_isr_cb);
         ^
c:/Espressif/ESP8266_SDK/include/ets_sys.h:52:62: error: invalid conversion from 'void (*)()' to 'void*' [-fpermissive]
     ets_isr_attach(ETS_FRC_TIMER1_INUM, (func), (void *)(arg))
                                                              ^
app/hw_timer.cpp:67:9: note: in expansion of macro 'ETS_FRC_TIMER1_INTR_ATTACH'
         ETS_FRC_TIMER1_INTR_ATTACH(hw_timer_isr_cb, NULL);
         ^
In file included from include/user_config.h:29:0,
                 from app/hw_timer.cpp:1:
c:/tools/Sming/Sming/system/include/esp_systemapi.h:46:13: error:   initializing argument 2 of 'void ets_isr_attach(int, void*, void*)' [-fpermissive]
 extern void ets_isr_attach(int intr, void *handler, void *arg);
             ^
make.exe": *** [out/build/app/hw_timer.o] Error 1

BUILD FAILED (exit value 2, total time: 9s)

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

Postby ESP_Faye » Wed Aug 12, 2015 7:51 pm

Hi,

Please have a try with the attachment.
compilation.jpg

download into flash.jpg
Attachments
esp_iot_sdk_v1.3.0.zip
(3.42 MiB) Downloaded 461 times

philip
Posts: 12
Joined: Thu Jan 14, 2016 11:47 am

Re: ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

Postby philip » Thu Jan 14, 2016 11:50 am

I'm using the SDK1.5.1 and it appears that I have problems when I use the NMI_SOURCE option (I get crashes in the SDK).

dkinzer: Did you get your issue solved? Or is the solution to use the FRC1_SOURCE instead?

Thanks

Philip

eriksl
Posts: 159
Joined: Fri May 22, 2015 6:22 pm

Re: ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

Postby eriksl » Mon Jan 18, 2016 11:20 pm

Are you using pwm?

Are you returning within a few instructions from the handler?

Is the handler in iram?

philip
Posts: 12
Joined: Thu Jan 14, 2016 11:47 am

Re: ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

Postby philip » Mon Jan 18, 2016 11:44 pm

Yes, the handler is in iram0.text -- I added the annotations to hw_timer.c to the isr callback function for this as well.

My handler does call gpio_output_set (which is in the bootrom) -- I guess that that is ok.

On further investigation, it appears that the handler does access a data structure, and this has been placed into irom0 -- the compiler figured out that I never modified this data structure so it could make it const and put it in irom0. Argh!!

It seems to be working much better now -- hasn't crashed yet.

Thank you.

eriksl
Posts: 159
Joined: Fri May 22, 2015 6:22 pm

Re: ETS_FRC_TIMER1_NMI_INTR_ATTACH does not work

Postby eriksl » Tue Jan 19, 2016 5:10 pm

If only remotely possible you shouldn't do any real work in an interrupt service route. Make it set a flag and handle it in normal code. It's very easy completely setup all sorts of hardware handling by running too long in an ISR, especially NMI.

Who is online

Users browsing this forum: No registered users and 18 guests