-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Question] 5ms delay in powerUp()? #683
Comments
I talked about this specific delay on #621 The thread is worth a read (I posted some pretty specific info pertaining to the datasheet). Ultimately, we concluded that it should be 5 ms to compensate for some boards' lack of precision in implementing I recently toyed with the delay in my circuitpython library. When I removed any delay less than 100 us, I found that the SPI bus would frequently hang during the examples. Then I forced the SCK to clock out 1 byte after the CSN pin is reset to its inactive HIGH, and I haven't had any hanging problems since. After some research (with the datasheet), I noticed the CSN pin must be inactive for a minimum of 50 ns. I realize my solution is meant for SD cards, but it seemed faster than doing a time-based delay (albeit depending on SPI baudrate). |
(It's an ATTiny84 but yeah...) I read that thread, it is interesting; but maybe we shouldn't penalize everyone for a few bad boards? Just a thought. So I made a small change to the signature of powerUp() in my branch. This allows me to start powering-up while reading the sensor at the same time. As a result, the loop time goes down from 14ms to 9ms, which is a big deal! You could also imagine defaulting the delay to 5ms but allowing to pass it in to find out if 2ms was enough in a particular case? |
you just struck my biggest nuisance with this library. I'm of the mind that the software shouldn't overcompensate for faulty hardware (clones and counterfeits included).
you mean like |
Yes, exactly!
…On Sun, 15 Nov 2020 at 14:16, Brendan ***@***.***> wrote:
maybe we shouldn't penalize everyone for a few bad boards?
you just stuck my biggest nusance with this library. I'm of the mind that
the software shouldn't overcompensate for faulty hardware (clones and
counterfeits included).
You could also imagine defaulting the delay to 5ms but allowing to pass it
in to find out if 2ms was enough in a particular case?
you mean like radio.powerUp(1500); for trying to delay 1.5 ms instead of
default 5 ms?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#683 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFDGBQBE6F6ZGJDNP4KOHLSP7PDTANCNFSM4TWFKWNQ>
.
--
Steve
|
If your radio has an oscillator soldiered into it, then you might be able to get away with 1 ms or less (150 us minimum). This might be tricky as some oscillators suck (especially the cheaper ones). |
I've been giving the powerUp param more thought. I only have 1 objection: internal calls to IMO the
or
My CircuitPython library does the former |
There are a few more delays in RF24.cpp which could use this treatment too. Would certainly improve code readability. |
The delay on startup is required because the datasheet says that a PoR event takes 100 ms to complete. I see a The The delay in I don't fully understand the delay in All other delays are standard (per datasheet) or used for debouncing ( Although, // Must allow the radio time to settle else configuration bits will not necessarily stick.
// This is actually only required following power up but some settling time also appears to
// be required after resets too. For full coverage, we'll always assume the worst.
// Enabling 16b CRC is by far the most obvious case if the wrong timing is used - or skipped.
// Technically we require 4.5ms + 14us as a worst case. We'll just call it 5ms for good measure.
// WARNING: Delay is based on P-variant whereby non-P *may* require different timing.
delay(5); I'm not really sure what this is about. I don't recall the datasheet saying anything about this. In fact this is what made me think the |
Closing this due to merging of #690 . When re-working the timingSearch3pin.ino for the SpenceKonde ATTinyCore, I noticed that the settling delay times in Additionally, the RF24_config.h uses macros not defined in the SpenceKonde ATTinyCore to declare the RF24_TINY macro, but this is actually related to #646 EDIT: I've made changes according to this comment. See this commit |
Hi guys,
I have a battery-powered sensor whose loop() is:
The third step is basically:
Digging into why the third step takes over 8ms, the main culprit seems to be the unconditional 5ms delay in powerUp(). Is there any value in skipping this in order to do something useful for 5ms? (Coincidentally, this is the time-to-read the DHT22 sensor.)
Thanks,
Steve
The text was updated successfully, but these errors were encountered: