-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Feather Express M0 - pulseio.PulseIN - freezes at high frequency #516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Now that Feather M0 Express was running this PWMOut script. 50% duty cycle, starting at 8kHz with incremental increases. ItsyBitsy M0 Express (w/JLink) was running this PulseIn script. This version has a I got up to 64kHz before the REPL froze. After a few runs, I noticed that it always froze when the result was <20. But, after scrolling back through the terminal, 19's & 18's appeared with no effect. I'm still narrowing down where to look specifically, but something interesting is showing up. I've had the Feather PWMOut script halted, and the jumper removed, for over 20 minutes. When I pause the ItsyBitsy and step-over in Atmel Studio, the callstack shows that it's cycling through instances of |
CORRECTION: I thought I had the jumper removed. After actually removing it, the calls to |
It sounds like we're hitting the limit for how fast we can execute the interrupt handler. Are the pulse lengths close enough that we can determine the input frequency? We could add another C class specifically designed to measure an input frequency. It wouldn't need interrupts, we could have a counter measure input edges or something. |
That's pretty much the conclusion I've come to today. I removed the Setting a breakpoint in Atmel Studio on So, yeah, I think we're getting stuck in an endless EIC interrupt loop. Could we use the TC peripheral? During some searches I saw that it could be used for PWM In...but I didn't dig deep into it. Might also run into similar limitations with the EVSYS... EDIT: TC peripheral...not TCC |
I've got a Using the same PWMOut script as above, I'm now getting up to 512kHz before the REPL locks up. Using this script to capture the frequency in:
I have the TC prescaler set to 1 right now, and I think it may be hitting max COUNTER. Will continue to debug it. Will also look into a way to catch the upper bound and raise an exception (most likely the interrupt error flag). Progress at least. |
awesome! |
We now track the last time the background task ran and bail on the PulseIn if it starves the background work. In practice, this happens after the numbers from pulsein are no longer accurate. This also adjusts interrupt priorities so most are the lowest level except for the tick and USB interrupts. Fixes #516 and #876
Test Case:
Messure Light trough a light-to-frequency-coverter.
Test Setup:
Feather Express M0 - Circuit Python 2.2.0
TSL235R-LF
https://www.sparkfun.com/datasheets/Sensors/Imaging/TSL235R-LF.pdf
connected 3V to VDD, GND to GND and Output to D12
Error:
Board do not response, crash or disconnect while the input frequency is above 25 kHz.
The specific freqency could not be determinated.
While covering the Converter it is sometimes possible to recover the board. Outwise a reset is nessessary.
Source:
https://forums.adafruit.com/viewtopic.php?f=60&t=129061
The text was updated successfully, but these errors were encountered: