Difference between revisions of "Nrf24le1:tutorial"
(→Prerequisites) |
(→TX setup) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TocRight}} |
|||
The sources of the information here are |
The sources of the information here are nrf* datasheets, |
||
[http://diyembedded.com diyembedded] |
[http://diyembedded.com diyembedded] |
||
and experience. |
and experience. |
||
Line 18: | Line 19: | ||
== General init == |
== General init == |
||
* nrf24l01_initialize() - set all registers |
|||
* nrf24l01_initialize_debug() - simple RX or TX |
|||
* nrf24l01_initialize_debug_lite() - do not change config registers, just power on |
|||
== RX setup == |
== RX setup == |
||
Read payload either on interrupt or by polling. |
|||
==== Interrupt driven ==== |
|||
* nrf24l01_read_rx_payload() in the interrupt service routine |
|||
==== Polling ==== |
|||
* nrf24l01_irq_pin_active() - any RF interrupt |
|||
* irq_rx_dr_active() - is that a data-received interrupt? |
|||
* nrf24l01_read_rx_paylaod() - get the packet |
|||
More than one pipe: check the status register to see what pipe it was received on. NOTE: do this before you read the payload. |
|||
NOTE: Whenever a receiver reads the payload, it needs up to 130 uS to come back to active mode |
|||
and to start monitoring for packets again. Therefore, the transmitter node should wait as well. |
|||
== TX setup == |
== TX setup == |
||
* Check if TX FIFO register is not full (in either STATUS or FIFO_STATUS registers) |
|||
* nrf24l01_write_tx_payload() |
|||
* wait for the TX_DS interrupt to go active |
|||
* send another packet, as needed. |
|||
* When using Enhanced Shockburst feature, watch for the MAX_RT interrupt in case the send failed. |
|||
* Clear the interrupts. |
|||
== Low power tricks == |
|||
Read this: |
|||
* http://www.nrftalk.net/forum/viewtopic.php?f=13&t=31 |
Latest revision as of 23:48, 20 November 2012
The sources of the information here are nrf* datasheets, diyembedded and experience.
These are notes on how to get the nrf24le radio link working.
Operation modes
- Simple shockburst and enhanced shockburst.
- With or without automatic acknowledgements.
- Up to 6 pipes (multiceiver mode)
Prerequisites
You must implement or have:
- A delay function (in us)
- SPI bus control and communication to access the transceiver registers
- IO pins or register bits that go to the nrf24L01 or the embedded LE1 transceiver:
- CSN, CE, and IRQ
General init
- nrf24l01_initialize() - set all registers
- nrf24l01_initialize_debug() - simple RX or TX
- nrf24l01_initialize_debug_lite() - do not change config registers, just power on
RX setup
Read payload either on interrupt or by polling.
Interrupt driven
- nrf24l01_read_rx_payload() in the interrupt service routine
Polling
- nrf24l01_irq_pin_active() - any RF interrupt
- irq_rx_dr_active() - is that a data-received interrupt?
- nrf24l01_read_rx_paylaod() - get the packet
More than one pipe: check the status register to see what pipe it was received on. NOTE: do this before you read the payload.
NOTE: Whenever a receiver reads the payload, it needs up to 130 uS to come back to active mode and to start monitoring for packets again. Therefore, the transmitter node should wait as well.
TX setup
- Check if TX FIFO register is not full (in either STATUS or FIFO_STATUS registers)
- nrf24l01_write_tx_payload()
- wait for the TX_DS interrupt to go active
- send another packet, as needed.
- When using Enhanced Shockburst feature, watch for the MAX_RT interrupt in case the send failed.
- Clear the interrupts.
Low power tricks
Read this: