aarossig / nrfnet

Using NRF24L01 as a virtual network device under Linux.
Apache License 2.0
70 stars 19 forks source link

Unable to get nerfnet up and running ... #1

Closed newfoundlandplucky closed 3 years ago

newfoundlandplucky commented 3 years ago

Could not get nerfnet to function although RF24 linux example gettingstarted works as expected. Test devices are NanoPi NEO Core2 and Raspberry Pi Zero. RF24 library is configured with linux support so SPI and sysfs GPIO APIs are used to interface to the NRF24L01. Using short 1.5" wires as recommended. Never used NRF24L01 devices before so I'm on unfamiliar territory.

Will migrate nerfet startup sequence to gettingstarted until the startup sequences are similar. Hopefully a tunnel reset will succeed. To that end I wrote an NRF24L01 register decoder to help with the task. NOTE: Also modified nernet to accept SPI port as an argument instead of hard coding.

clear; sudo ./nerfnet/build/nerfnet/net/nerfnet --secondary --enable_tunnel_logs --ce_pin 203 --cs_pin 10

I: tunnel 'nerf0' opened I: tunnel 'nerf0' up I: tunnel 'nerf0' configured with '192.168.10.2' mask '255.255.255.0' write_register(SETUP_RETR[04,5f] ARD:5 ARC:15) write_register(RF_SETUP[06,07] RSV:0 PLL_LOCK:0 RF_DR:0 RF_PWR:3 LNA_HCURR:1) write_register(DYNPD[1c,00] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:0 P0:0) write_register(EN_AA[01,3f] RSV:0 P5:1 P4:1 P3:1 P2:1 P1:1 P0:1) write_register(EN_RXADDR[02,00] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:0 P0:0) write_register(RX_PW_P0[11,20] RSV:0 P0:32) write_register(RX_PW_P1[12,20] RSV:0 P1:32) write_register(RX_PW_P2[13,20] RSV:0 P2:32) write_register(RX_PW_P3[14,20] RSV:0 P3:32) write_register(RX_PW_P4[15,20] RSV:0 P4:32) write_register(RX_PW_P5[16,20] RSV:0 P5:32) write_register(SETUP_AW[03,03] RSV:0 AW:3) write_register(RF_CH[05,4c] RSV:0 RF_CH:76) write_register(STATUS[07,70] RSV:0 RX_DR:1 TX_DS:1 MAX_RT:1 RX_P_NO:0 TX_FULL:0) write_register(e2::FLUSH_RX) write_register(e1::FLUSH_TX) write_register(CONFIG[00,0c] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:1 PWR_UP:0 PRIM_RX:0) write_register(CONFIG[00,0e] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:1 PWR_UP:1 PRIM_RX:0) write_register(RF_CH[05,4c] RSV:0 RF_CH:76) write_register(RF_SETUP[06,07] RSV:0 PLL_LOCK:0 RF_DR:0 RF_PWR:3 LNA_HCURR:1) write_register(RF_SETUP[06,0f] RSV:0 PLL_LOCK:0 RF_DR:1 RF_PWR:3 LNA_HCURR:1) write_register(SETUP_AW[03,01] RSV:0 AW:1) write_register(EN_AA[01,3f] RSV:0 P5:1 P4:1 P3:1 P2:1 P1:1 P0:1) write_register(SETUP_RETR[04,00] ARD:0 ARC:0) write_register(CONFIG[00,0a] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:0 PWR_UP:1 PRIM_RX:0) write_register(EN_RXADDR[02,02] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:1 P0:0) write_register(CONFIG[00,0b] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:0 PWR_UP:1 PRIM_RX:1) write_register(STATUS[07,70] RSV:0 RX_DR:1 TX_DS:1 MAX_RT:1 RX_P_NO:0 TX_FULL:0) write_register(EN_RXADDR[02,02] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:1 P0:0) I: Read 76 bytes from the tunnel I: Read 48 bytes from the tunnel I: Read 76 bytes from the tunnel I: Read 76 bytes from the tunnel I: Read 76 bytes from the tunnel [Reading 32 bytes 0 blanks] write_register(STATUS[07,40] RSV:0 RX_DR:1 TX_DS:0 MAX_RT:0 RX_P_NO:0 TX_FULL:0) I: Responding to tunnel reset request write_register(CONFIG[00,0a] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:0 PWR_UP:1 PRIM_RX:0) write_register(EN_RXADDR[02,03] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:1 P0:1) [Writing 32 bytes 0 blanks] RF24::write: elapsed=0,status=1e,TX_DS=00,MAX_RT=10 write_register(STATUS[07,70] RSV:0 RX_DR:1 TX_DS:1 MAX_RT:1 RX_P_NO:0 TX_FULL:0) STATUS 0x1e RX_DR=0 TX_DS=0 MAX_RT=1 RX_P_NO=7 TX_FULL=0 write_register(e1::FLUSH_TX) RF24::write: return 0 E: Failed to write request E: Failed to send tunnel reset response

clear; sudo ./nerfnet/build/nerfnet/net/nerfnet --primary --enable_tunnel_logs --poll_interval_us 1000

I: tunnel 'nerf0' opened I: tunnel 'nerf0' up I: tunnel 'nerf0' configured with '192.168.10.1' mask '255.255.255.0' write_register(SETUP_RETR[04,5f] ARD:5 ARC:15) write_register(RF_SETUP[06,07] RSV:0 PLL_LOCK:0 RF_DR:0 RF_PWR:3 LNA_HCURR:1) write_register(DYNPD[1c,00] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:0 P0:0) write_register(EN_AA[01,3f] RSV:0 P5:1 P4:1 P3:1 P2:1 P1:1 P0:1) write_register(EN_RXADDR[02,00] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:0 P0:0) write_register(RX_PW_P0[11,20] RSV:0 P0:32) write_register(RX_PW_P1[12,20] RSV:0 P1:32) write_register(RX_PW_P2[13,20] RSV:0 P2:32) write_register(RX_PW_P3[14,20] RSV:0 P3:32) write_register(RX_PW_P4[15,20] RSV:0 P4:32) write_register(RX_PW_P5[16,20] RSV:0 P5:32) write_register(SETUP_AW[03,03] RSV:0 AW:3) write_register(RF_CH[05,4c] RSV:0 RF_CH:76) write_register(STATUS[07,70] RSV:0 RX_DR:1 TX_DS:1 MAX_RT:1 RX_P_NO:0 TX_FULL:0) write_register(e2::FLUSH_RX) write_register(e1::FLUSH_TX) write_register(CONFIG[00,0c] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:1 PWR_UP:0 PRIM_RX:0) write_register(CONFIG[00,0e] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:1 PWR_UP:1 PRIM_RX:0) write_register(RF_CH[05,4c] RSV:0 RF_CH:76) write_register(RF_SETUP[06,07] RSV:0 PLL_LOCK:0 RF_DR:0 RF_PWR:3 LNA_HCURR:1) write_register(RF_SETUP[06,0f] RSV:0 PLL_LOCK:0 RF_DR:1 RF_PWR:3 LNA_HCURR:1) write_register(SETUP_AW[03,01] RSV:0 AW:1) write_register(EN_AA[01,3f] RSV:0 P5:1 P4:1 P3:1 P2:1 P1:1 P0:1) write_register(SETUP_RETR[04,00] ARD:0 ARC:0) write_register(CONFIG[00,0a] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:0 PWR_UP:1 PRIM_RX:0) write_register(EN_RXADDR[02,02] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:1 P0:0) I: Resetting connection write_register(CONFIG[00,0a] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:0 PWR_UP:1 PRIM_RX:0) write_register(EN_RXADDR[02,03] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:1 P0:1) [Writing 32 bytes 0 blanks] RF24::write: elapsed=1,status=2e,TX_DS=20,MAX_RT=00 write_register(STATUS[07,70] RSV:0 RX_DR:1 TX_DS:1 MAX_RT:1 RX_P_NO:0 TX_FULL:0) STATUS 0x2e RX_DR=0 TX_DS=1 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RF24::write: return 1 write_register(CONFIG[00,0b] RSV:0 MASK_RX_DR:0 MASK_TX_DS:0 MASK_MAX_RT:0 EN_CRC:1 CRCO:0 PWR_UP:1 PRIM_RX:1) write_register(STATUS[07,70] RSV:0 RX_DR:1 TX_DS:1 MAX_RT:1 RX_P_NO:0 TX_FULL:0) write_register(EN_RXADDR[02,02] RSV:0 P5:0 P4:0 P3:0 P2:0 P1:1 P0:0) E: Timeout receiving response E: Failed to receive tunnel reset response E: Connection reset failed

aarossig commented 3 years ago

Thanks for the report! Glad to hear that someone else has decided to try this out.

I remember I had issues with RF24. I configured, compiled and installed it myself in order to overcome a similar issue that you describe. Here are the commands that I used (from bash history):

cd RF24/
make clean
./configure --driver=SPIDEV; make -j4; sudo make install

Without this, I was unable to communicate with the nRF24L01 radio reliably.

Let me know if this helps and I can update the README with instructions. I will admit that I am not an expert on the RF24 library so it is certainly possible that I have misused it in some way.

newfoundlandplucky commented 3 years ago

Thanks for responding so quickly and for contributing some really nice code. nerfnet is a fantastic idea and would be a great tool for stretching the limits of wireless IP without a lot of expense.

The nerfnet control flow looks similar to gettingstarted except for auto ack. Don't know what a working simple Shockburst example looks like so it may be worthwhile for me to experience and learn this first before graduating to nerfnet.

newfoundlandplucky commented 3 years ago

nerfnet is up and running!!! Key changes were building a perfboard soldered point-to-point instead of single pin dupont connectors, adding 47uF caps to the power rails at the ingress to the nRF24L01+ modules, and using a pair of Raspberry Pi Zeros. Both Linux drivers and BCM work fine.

Thanks to your generous nerfnet contribution it should be possible to test the nRF24L01+ module against a WiFi DD-WRT repeater bridge at the edge of the WiFi range. Thanks.

For anybody following your work it may be useful to also take a peek at https://github.com/nRF24/RF24Gateway/issues/16#issuecomment-764222269.