RaspBerry PI3 B + Dragino HAT ( RF95 / RFM95 ) = RF24_NOP error



  • I'm trying to use the mysensors library 2.1.1, but it is giving this error:

    In file included from ./MySensors.h:304:0,
                     from examples_linux/mysgw.cpp:74:
    ./drivers/RFM95/RFM95.cpp: In function ‘uint8_t RFM95_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)’:
    ./drivers/RFM95/RFM95.cpp:58:13: error: ‘RF24_NOP’ was not declared in this scope
        *ptx++ = RF24_NOP;
                 ^
    In file included from ./MySensors.h:304:0,
                     from examples_linux/mysgw.cpp:74:
    ./drivers/RFM95/RFM95.cpp: At global scope:
    ./drivers/RFM95/RFM95.cpp:494:12: warning: ‘void RFM95_ATCmode(bool, int16_t)’ defined but not used [-Wunused-function]
     LOCAL void RFM95_ATCmode(const bool OnOff, const int16_t targetRSSI)
                ^
    Makefile:114: recipe for target 'build/examples_linux/mysgw.o' failed
    make: *** [build/examples_linux/mysgw.o] Error 1
    

    What I am using:

    What I have made so far:

    pi@pi:~ $ sudo git clone https://github.com/mysensors/MySensors.git --branch master
    Cloning into 'MySensors'...
    remote: Counting objects: 13994, done.
    remote: Compressing objects: 100% (54/54), done.
    remote: Total 13994 (delta 13), reused 0 (delta 0), pack-reused 13940
    Receiving objects: 100% (13994/13994), 9.71 MiB | 141.00 KiB/s, done.
    Resolving deltas: 100% (8441/8441), done.
    Checking connectivity... done.
    pi@pi:~ $ cd MySensors
    pi@pi:~/MySensors $ sudo ./configure --my-gateway=ethernet --my-port=5003 --my-transport=rfm95
    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=BCM2836, Type=RPi3, CPU=armv7l.
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:BCM.
    [SECTION] Detecting init system.
      [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    pi@pi:~/MySensors $ sudo make
    .
    .
    .
    .
     examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
    In file included from ./MySensors.h:304:0,
                     from examples_linux/mysgw.cpp:74:
    ./drivers/RFM95/RFM95.cpp: In function ‘uint8_t RFM95_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)’:
    ./drivers/RFM95/RFM95.cpp:58:13: error: ‘RF24_NOP’ was not declared in this scope
        *ptx++ = RF24_NOP;
                 ^
    In file included from ./MySensors.h:304:0,
                     from examples_linux/mysgw.cpp:74:
    ./drivers/RFM95/RFM95.cpp: At global scope:
    ./drivers/RFM95/RFM95.cpp:494:12: warning: ‘void RFM95_ATCmode(bool, int16_t)’ defined but not used [-Wunused-function]
     LOCAL void RFM95_ATCmode(const bool OnOff, const int16_t targetRSSI)
                ^
    Makefile:114: recipe for target 'build/examples_linux/mysgw.o' failed
    make: *** [build/examples_linux/mysgw.o] Error 1
    
    

    The RFM95.cpp code part:

    #if defined(LINUX_SPI_BCM)
    	uint8_t * prx = spi_rxbuff;
    	uint8_t * ptx = spi_txbuff;
    	uint8_t size = len + 1; // Add register value to transmit buffer
    
    	*ptx++ = cmd;
    	while (len--) {
    		if (aReadMode) {
    			*ptx++ = RF24_NOP;
    		} else {
    			*ptx++ = *current++;
    		}
    	}
    	_SPI.transfernb((char *)spi_txbuff, (char *)spi_rxbuff, size);
    	if (aReadMode) {
    		if (size == 2) {
    			status = *++prx;   // result is 2nd byte of receive buffer
    		} else {
    			status = *prx++; // status is 1st byte of receive buffer
    			// decrement before to skip status byte
    			while (--size) {
    				*buf++ = *prx++;
    			}
    		}
    	} else {
    		status = *prx; // status is 1st byte of receive buffer
    	}
    #else
    	status = _SPI.transfer(cmd);
    	while (len--) {
    		if (aReadMode) {
    			status = _SPI.transfer((uint8_t)0x00);
    			if (buf != NULL) {
    				*current++ = status;
    			}
    		} else {
    			status = _SPI.transfer(*current++);
    		}
    	}
    #endif
    
    

    any idea?


  • Mod

    @exdj21 welcome to the MySensors community! Seems like you missed running ./configure before make?
    If you haven't already, take a look at the documenation for the MySensors raspberry pi gateway at https://www.mysensors.org/build/raspberry

    EDIT: sorry, I see now that you ran configure.



  • @exdj21 said in RaspBerry PI3 B + Dragino HAT ( RF95 / RFM95 ) = RF24_NOP error:

    RF24_NOP

    What is "RF24_NOP" and what is it used for?


  • Mod

    @exdj21 it seems to be something used by the nrf24 radio. https://github.com/mysensors/MySensors/blob/2e0f6b62295dbe884386ee23ae312a2c02bdea20/drivers/RF24/RF24.h#L169

    See if adding that define to your code (before including mysensors) helps.

    @tekka might be able to shed a light.


  • Admin

    @mfalkvidd @exdj21 Thanks for reporting, bugfix submitted: https://github.com/mysensors/MySensors/pull/800

    For an immediate fix in 2.1.1/RFM95.cpp line 58, change to:

    *ptx++ = (uint8_t)0x00;
    

Log in to reply
 

Suggested Topics

11
Online

11.4k
Users

11.1k
Topics

112.7k
Posts