(solved)
Hi. Thanks a lot for this implentation and the helpful posts here!
I've got the gateway working with a tmp75 temperature sensor on an arduino. The nrf24 is sitting on the raspberry directly (CE pin 22), as a controller i'm using PiMatic. It works very nicely!
There is one small problem however. The PiGatewaySerial will only work if i have called PiGateway before (and closed it again). With working I mean picking up radio transmissions from my sensor node. Everything else seems normal (/dev/ttyPiGatewaySerial and radio details printout).
The details of both configurations might give a clue:
pi@raspberrypi ~/mysensors_rpi $ sudo ./PiGateway
Starting Gateway...
================ SPI Configuration ================
CSN Pin = CE0 (PI Hardware Driven)
CE Pin = Custom GPIO25
Clock Speed = 8 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xa8a8e1fc00 0xa8a8e1fc00
RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00
EN_AA = 0x3b
EN_RXADDR = 0x06
RF_CH = 0x4c
RF_SETUP = 0x23
CONFIG = 0x0e
DYNPD/FEATURE = 0x3f 0x06
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW
[CALLBACK]0;0;3;0;14;Gateway startup complete.
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
[CALLBACK]4;0;1;0;0;22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
after closing PiGateway and opening PiGatewaySerial i get this:
pi@raspberrypi ~/mysensors_rpi $ sudo ./PiGatewaySerial
Starting PiGatewaySerial...
Protocol version - 1.4
Created PTY '/dev/pts/3'
Gateway tty: /dev/ttyMySensorsGateway
================ SPI Configuration ================
CSN Pin = CE0 (PI Hardware Driven)
CE Pin = Custom GPIO22
Clock Speed = 8 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xa8a8e1fc00 0xa8a8e1fc00
RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00
EN_AA = 0x3b
EN_RXADDR = 0x06
RF_CH = 0x4c
RF_SETUP = 0x23
CONFIG = 0x0e
DYNPD/FEATURE = 0x3f 0x06
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.8
Notice how the CE pins of both SPI configurations are different!
I'm at the point that i want to daemonize the gateway. Which in fact i did, but the same problem persists. Before i hack the startup script to first run and close PiGateway before PiGatewaySerial, i was hoping that someone has an idea what i'm doing wrong.
Thanks in advance!
solved!
I have two RPIs (a Pi 2 B and a Pi B+), which both worked with the pyRF24 lib of TMRh20, so when i had a look in the source of the radio initialization of PiGatewaySerial and found this:
#ifdef __PI_BPLUS
gw = new MyGateway(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ, 1);
#else
gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 1);
#endif
When i changed it to:
#ifdef __PI_BPLUS
gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 1);
#else
gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 1);
#endif
and recompiled the gateways,it all started to work. After powerup everything runs :).
The Rpi that is connected now is the Pi 2 B. So i guess either i have my nrf25 wired differently then defined in this lib, or the precompiler was thinking i have a B+ connected. Or both.
I will find out when i get this also working on my B+.