NMI-based hw_timer implementation in RTOS SDK

rhaenel
Posts: 6
Joined: Tue Jul 21, 2015 2:45 pm

NMI-based hw_timer implementation in RTOS SDK

Postby rhaenel » Tue Jul 21, 2015 2:53 pm

Hi,

I have some pulse shaping applications that are very sensitive to correct timing (in the 100ns-range).

After some experiments I found that even though I disabled interrupts during my function, I still get interrupted, and I assume thats the NMI which I cannot turn off.

However someone pointed me towards the hw_timer implementation where I can actually execute code from within the NMI, and that means that another NMI cannot interrupt me - great!

Unfortunately I just found out that the hw_timer stuff with NMI doesn't seem exist in the RTOS SDK. Stuff is missing from the header files, I could add that, but then it seems that some internal stuff is missing from libmain.a (NmiTimSetFunc) and that's a binary blob I don't have access to.

So the question is: is there any way to use an NMI-based hw_timer in the RTOS SDK? Or any other way to capture and/or disable the NMI in the RTOS SDK? I only need uninterruptible control for a very short period (~ 10 microseconds).

Greetings,
Roland

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

Re: NMI-based hw_timer implementation in RTOS SDK

Postby ESP_Faye » Fri Jul 24, 2015 4:49 pm

Hi,

rhaenel wrote: I only need uninterruptible control for a very short period (~ 10 microseconds).

Do you mean that this 10 microseconds can not be interrupt by NMI either ?

1. Call wifi_set_opmode(NULL_MODE); first, then enter critical state. These will allow an uninterruptible control for about 1.5 seconds.

2. Call wifi_set_opmode to set a normal Wi-Fi mode, then enter critical state. Only Wi-Fi NMI can interrupt task or other interrupts.

Thanks for your interest in Espressif Systems and ESP8266 !

rhaenel
Posts: 6
Joined: Tue Jul 21, 2015 2:45 pm

Re: NMI-based hw_timer implementation in RTOS SDK

Postby rhaenel » Thu Jul 30, 2015 3:13 am

Thanks.

Calling wifi_set_opmode(NULL_MODE); would kill the current WiFi connection, correct? If I enable station mode after the time critical stuff (10us), this will trigger WiFi connect including DHCP etc. again, correct?

Greetings,
Roland

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

Re: NMI-based hw_timer implementation in RTOS SDK

Postby eriksl » Sat Aug 01, 2015 2:00 am

AFAIK pwm also uses nmi, maybe other software emulated subsystems as well.

dkinzer
Posts: 52
Joined: Fri Jul 31, 2015 7:37 am

Re: NMI-based hw_timer implementation in RTOS SDK

Postby dkinzer » Sat Aug 01, 2015 5:25 am

eriksl wrote:AFAIK pwm also uses nmi,
I haven't seen a PWM example using NMI. The PWM code in the v0.9.5 SDK IOT_demo directory uses a regular interrupt. Earlier versions of the SDK (e.g. v0.6) had PWM example code that used os_timer_setfn(). Do you have a URL for PWM code that uses NMI?
Don Kinzer
Beaverton, OR, USA

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

Re: NMI-based hw_timer implementation in RTOS SDK

Postby eriksl » Sun Aug 02, 2015 3:41 pm

I am talking of the pwm implementation IN the sdk, not an example. Current sdk is 1.2.0, why would you use 0.9.5? See include/pwm.h.

dkinzer
Posts: 52
Joined: Fri Jul 31, 2015 7:37 am

Re: NMI-based hw_timer implementation in RTOS SDK

Postby dkinzer » Sun Aug 02, 2015 11:09 pm

eriksl wrote:Current sdk is 1.2.0, why would you use 0.9.5? See include/pwm.h.
I am using v1.2.0. I was referring to the example pwm.c code found in the earlier versions of the SDK that is not present in 1.2.0.
Don Kinzer
Beaverton, OR, USA

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

Re: NMI-based hw_timer implementation in RTOS SDK

Postby eriksl » Mon Aug 03, 2015 1:57 am

I was merely trying to explain that at least one sdk subsystem is using NMI interrupts, namely pwm, maybe others too. These might interfere with your tight timing requirements.

Who is online

Users browsing this forum: Baidu [Spider] and 9 guests