-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
update master branch from lite-beta branch #14
Conversation
tested using a compiled mpy file (for circuitpython v5)
employing my wrapper modules from another repo called circuitpython2micropython
abandon timeout calculations in send() & resend(). `payload_length` is set to all pipes & removed internal `_pl_widths[]` for context manager as it was synonomous with `paylaod_length` anyway
@jerryneedell I wrapped the PA/LNA module with electrical tape and then foil around that (for shielding). Then I wired up a PA/LNA module with a 3V regulator (L4931 with a 2.2 µF capacitor between Vout & GND) using my ItsyBitsy M4 5V (AKA USB) pin (going directly to the L4931 Vin pin). The following are experiences from running simple, ack, & stream tests with a reliable nRF24L01+ (no PA/LNA) on the other end (driven by a RPi2): Ordered by different
|
@2bndy5 Interesting results. Thanks for all the examples. The PA/LNA units sure are complex! I won't be able to do any more testing until this weekend, but will try to do some when I can. |
Today, using the L4931 regulator still wired up, I swapped out the shielded PA/LNA module with an un-shielded (bare) PA/LNA module (purchased from the same stock -- if that means anything) and ran the simple_test on all available |
Back home and trying a few more tests. Still having issues transmitting with the PA/LNA modules. I have not tried any alternative ways of powering it yet. Will try to explore more of the examples later today and tomorrow. |
@jerryneedell that's great! I'll probably modify the BLE example to alternate advertisements between the different "PDU types" (basically that's what it boils down to). I also modified the context test to demonstrate how to use 1 nRF24L01 as a BLE device and a normal RF24 device in the same script. With your iPhone confirmation, I'm ready to release, but I want to give it another proofread and make sure it passes the all the tests again (you know -- "for good measure"). Heads up, I'll be changing the default setting of the |
Updating https://github.com/2bndy5/CircuitPython_nRF24L01 to 1.2.0 from 1.1.2: > Merge pull request nRF24/CircuitPython_nRF24L01#14 from 2bndy5/lite-beta > found typos > badge missing target link > update badges & prepare switch to github actions > Update build.yml > Update build.yml > Create build.yml > deleting travis.yml > enabling github actions > updated examples for new returned format of send() > updated darkness.css for sidebar menu > (-) experimentals from logitech-mouse branch > updates from logitech-mouse branch > found pin conflict in irq example -> uses d12 now > context manager powers down radio on exit > changed spi bus attribute to a hidden attribute > docs badge links to stable releases > valid names: irq_D* => irq_d*, ce => ce_pin, etc > Delete .gitattributes
many optimizations and fixes. Once this PR is merged, there will be a new release. Updated docs for this branch are live. Changes include:
New Modules
rf24_lite.py
) has been introduced for boards with limited available memory (e.g. ATSAMD21 core M0 based boards). Although, using TMRh20's Arduino/PlatformIO library is still highly recommended (especially for complex applications) as CircuitPython leaves little room for user-space code in this scenario. This lite version may not remain in the next release, so consider it experimental. Info about what was stripped away can be found in the docs (main difference is no context manager compatibility in the lite version). MemoryError: memory allocation failed on ATSAMD21 M0 boards #10fake_ble.py
has been added to implement using the nRF24L01+ as a fake BLE advertising beacon. Docs have been updated to include an example and describe the additional API including battery level, URL, and temperature measurement service data helper classes.FakeBLE
class allows advertising a devicename
, the nRF24L01'spa_level
as "TX power level", custommac
address, & ato_iphone
flag to aim advertisements at different smartphones. This newfake_ble.py
module is NOT compatible with therf24_lite.py
module.Optimizations:
spi_frequency
to customize the frequency used for SPI transactions. However the SPI frequency cannot be changed after instantiating the RF24 or FakeBLE objects.send()
has been re-written. It now employs recursion when passing a list/tuple of payloads. Payload format checking now relies on internalwrite()
call.send()
no longer calculates a timeout, rather it blocks until a status flag is asserted by the ESB protocol from the nRF24L01 (application will only hang if there is a SPI bus malfunction).send()
now only returnsFalse
orTrue
; it can still return an ACK payload, but empty ACK payloads will show asTrue
(notNone
). NEWsend_only
parameter to disable automatic fetching of ACK payloads when callingsend()
orresend()
(this parameter defaults toFalse
for backward compatibility).any()
may have been returning incorrect data in some cases. This seemed to affectrecv()
also because it callsany()
to get the RX'd payload length.recv()
now takes an optional parameter,length
, that can manually specify how many bytes to read from the RX FIFO. Notice every attempt to read from the RX FIFO starts with the first byte (if available) in the top level of the RX FIFO. A payload is only removed when it is completely read from the RX FIFO.length
is greater than payload in top level, then data from next available payload(s) is returned.length
is greater than last available payload in RX FIFO, then the returned buffer is padded with the last byte in payload and payload is removed from FIFO. Also, the last byte read from RX FIFO is repeatedly returned when reading from an empty RX FIFO.length
is less than payload in top level, the payload will remain in RX FIFO.help()
). Detailed info on function parameters and attributes now live in online documentation. This reduced the size of source code stored on CIRCUITPY drive by more than 50% (84 kB -> 30 kB when using rf24.py -- rf24.mpy compiles to less than 20 kB).address_length
check onopen_rx_pipe()
&open_tx_pipe()
. The nRF24L01 will only save up to 5 bytes for addresses assigned to pipes 0 & 1 (1 byte max for the rest of the data pipes). Furthermore, the nRF24L01 will only use the first X number of bytes (where X is specified usingaddress_length
attribute) when reading addresses from the respective pipe address registers during automatic packet assembly.write()
now has an optional parameter calledwrite_only
. Use this parameter asTrue
to fill the nRF24L01's TX FIFO before beginning transmissions.Changes
read_ack()
marked for deprecation. It is currently still available until the next major release for backward compatibility with previous versions of this library. I highly recommend usingrecv()
instead as it is synonymous withread_ack()
irq_DS
is nowirq_ds
,irq_DF
is nowirq_df
,irq_DR
is nowirq_dr
.pipe()
is now a read-only attribute with same name (RF24.pipe
)address()
function (read-only; see docs for more info).what_happened(True)
to show expectedpayload_length
setting for static payloads (whendynamic_payloads
are disabled) only on open pipes.reset
parameter fromclose_rx_pipe()
. It doesn't matter what the address for a data pipe is if that data pipe is closed. Error in v1.1.2 docs: addresses for data pipes do reset to factory defaults on nRF24L01 boot (when VCC goes from 0V to 3.3V).rpd
attribute (read-only) for advanced usage. This can be used to detect interference or a carrier wave on a specific channel. Docs contain link to datasheet for more detail.start_carrier_wave()
andstop_carrier_wave()
functions to verify the nRF24L01 TX output is functioning. This a hardware test only. The carrier wave can be detected with another nRF24l01listen
ing for arpd
flag (example code in API docs).pa_level
now accepts list or tuple in addition to original functionality to compensate for the peculiar LNA_HUCRR bit used by nRF24L01 (non-plus variant) and the Si24R1 (cheap nRF24L01 clone).is_plus_variant
attribute to determine if the nRF24L01 is a plus variant module or an older non-plus variant module. This attribute is also used internally to accommodate the difference in expected behaviors among the 2 variants.dynamic_payloads
,auto_ack
, &payload_length
all now take an optional tuple or list of parameters to control the respective features on a per pipe basis. Apayload_length
of 0 means that pipe remains unaffected. Setting a pipe'sauto_ack
ordynamic_payload
feature to a negative number means that pipe will remain unaffected.write()
function properly in conjunction with the nRF24L01's IRQ pin (while also using the nRF24L01'sack
payloads feature). Notice that this example runs extremely quick as there are no unnecessarytime.sleep()
calls.Testing 4-byte payloads on an ItsyBitsy M4 Express has shown that transmissions now take about 26-55 milliseconds (60-65 milliseconds for ACK packets with customized payloads).