nrf24L01 with Atmega168 driving me crazy

I’m trying to use an nrf24L01 breakout board with an Atmega168. I’m using the library here:

http://www.tinkerer.eu/AVRLib/nRF24L01

I’m spitting out the registers before and after transmitting a packet, here are the applicable registers after config and prior to sending a packet:

CONFIG is 0x0B - 0000 1011 = EN_CRC, PWR_UP, and PRIM_RX (PRX is set)

STATUS ix 0x0E - 0000 1110 = RX_FIFO empty, available locations in TX FIFO

FIFO_STATUS is 0x11 - 0001 0001 = TX FIFO empty, RX FIFO empty

And after transmit:

CONFIG is 0x0A - 0000 1011 = EN_CRC, PWR_UP, and PTX is set

STATUS ix 0x1E - 0001 1110 = RX_FIFO empty, MAX_RT is set

FIFO_STATUS is 0x01 - 0000 0001 = Data in TX FIFO, RX FIFO empty

OBSERVE_TX is 0x11 - 0001 0001 = 1 lost packet, 1 retransmitted (This is weird, because SETUP_RETR is set to 0x03)

I have two identical setups, and never see a packet on the receiver. Also, the IRQ pin never goes high even though MAX_RT is set to trigger it. I’m not sure where to look next. I’ve read over the datasheet numerous times and everything looks OK. I’ve tried with and without auto-acknowledgement.

Does anyone have any ideas?

I had EN_AA set incorrect in the above sample. Once fixed, the results are the same but OBSERVE_TX is correct at 0x13. 1 lost packet, 3 retransmits. I still don’t get the IRQ for MAX_RT.

I realized if I remove the connection to the AVR and hook up an LED, I do see a brief blink on the IRQ pin.

I’m pretty sure the interrupt handler is setup right. I’m using the SIG_PIN_CHANGE2 interrupt handler on PD6. When I manually tie it high I see my handler hit. I thought it could be a level issue since the nRF24L01 runs at 3.3V, so I tried it with the output of the 3.3V regulator and it was fine too. When the LED and the AVR are both hooked up to the IRQ pin, the LED doesn’t light. I thought I had an input wrong, but it all looks OK and works manually. Any ideas what could be causing this?

Signal level may still be a level issue: ATmega168 high input is rated at 0.6VCC (min), which would be 3.0V if Vcc=5.0V. The nrf24L01 output high is rated at VDD-0.3, which would be 3.0V. That is right on the edge, so that may explain what you are seeing.

Are you using level shifters for the SPI pins? Any trouble with that part of the circuit?

I tried to hook one of these to an '168 a while back and was not able to get it to talk at all without level shifters. I just figured that “5V tolerant” != “5V compatible” and put FET buffers on all the lines between the nrf24L01 BOB and the '168.

Cheers,

  • Dean

IRQ is active low !

so it is always in interruption, you need to clear it in your ISR so it return to high (idle).

by sending :

SendOnSPI( 0x27, 0x40); // reset RX_DR int

or

SendOnSPI( 0x27, 0x70); // reset RX_DR, TX_DS and MAX_RT int

best regards

I’ve ‘ported’ the tinkerer.eu library to Arduino. It works with both a 5V Duemilanove and a 3.3V Skinny using the Sparkfun nRF24L01+ modules.

See: http://www.madsie.co.uk/arduino/Mirf.zip

So it’s definitely possible to use the those the modules with 5V signals.

I can recommend aaronds library which is now online at http://www.arduino.cc/playground/Interf … e/Nrf24L01

:slight_smile: