Friday, June 11, 2010

Nordic FOB and nRF24L01+ Interfacing

Receiver schematic

Datasheet

Characteristics

• 2.4 GHz wireless

• 0-10Mbps 4-wire SPI

• 8 bit command set

Pin functions

      SPI

MISO Digital Output, SPI Slave Data Output, with tri-state option

MOSI Digital Input, SPI Slave Data Input

SCK Digital Input, SPI Clock

CSN Digital Input, SPI Chip Select

     Power

VCC Input Power +3.3v

GND Common Ground

    Other

CE Digital Input, Chip Enable Activates RX or TX mode

IRQ Digital Output, Maskable interrupt pin. Active low

Interfacing

A. Configure nRF24L01+ via SPI

Note: Every command start with a CSN pin on low and end with a CSN pin on high

A command usually has two bytes:

The first byte is the command (read register, write register with register address).
Page 51/70 of the datasheet is the list of commands

Page 57/70 of the datasheet is the register map

Example firmware for AVR controller
If the command is a read command, the second byte is a dummy byte (any value).
If the command if a write command, the second byte is the data to write to the register.


B. Uses

1 Wait for new data by using interrupt. nRF24L01+ will activate a low interrupt when there is new data

2 Set wireless to standby mode by set pin CE to low

3 Activate SPI on nRF24L01+ by set CSN to low

4 Send read command (0x61)

5 Read 4 bytes data to a variable

6 Clear RF FIFO interrupt by send 2 bytes (0x27, 0x40)

7 Disable SPI by set CSN to high

8 Set wireless to monitor mode by set pin CE to high

Data information

Key information is in the first byte of the 4 bytes data.

Used for Nordic FOB

0x17 Left button

0x1E Bottom button

0x1B Right button

0x1D Top button

0x0F Center button