NMI-based hw_timer implementation in RTOS SDK
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
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
Re: NMI-based hw_timer implementation in RTOS SDK
Postby ESP_Faye » Fri Jul 24, 2015 4:49 pm
Hi,
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 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 !
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
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
Re: NMI-based hw_timer implementation in RTOS SDK
Postby dkinzer » Sat Aug 01, 2015 5:25 am
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?eriksl wrote:AFAIK pwm also uses nmi,
Don Kinzer
Beaverton, OR, USA
Beaverton, OR, USA
Re: NMI-based hw_timer implementation in RTOS SDK
Postby dkinzer » Sun Aug 02, 2015 11:09 pm
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.eriksl wrote:Current sdk is 1.2.0, why would you use 0.9.5? See include/pwm.h.
Don Kinzer
Beaverton, OR, USA
Beaverton, OR, USA
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: No registered users and 28 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.