No communication with NRF24L01 on RPi3 64bit [SOLVED]



  • Hi!

    Just recently discovered MySensors and this is what I was looking for!
    Unfortunately I can't get communications my RPI3 to communicate with a NRF24L01.

    My setup: RPi3 with a custom kernel 4.13.16 using 64bit, with loaded kernel module spi_bcm2835.

    $ uname -r
    4.13.16-v8+
    
    $ cat /boot/config.txt
    [...]
    dtparam=spi=on
    
    $ lsmod
    [...]
    spi_bcm2835            20480  0
    
    $ ls /dev/spidev0.*
    /dev/spidev0.0  /dev/spidev0.1
    

    I use the dev-branch (also tried stable, same behavior):

    $ ./configure --prefix=/data/home/gunther/mysensors --my-transport=nrf24 --my-gateway=ethernet --my-port=5003 
    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=unknown, Type=unknown, CPU=aarch64.
    [SECTION] Checking GPIO Sysfs.
      [OK] /sys/class/gpio/export found
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:SPIDEV.
    [SECTION] Detecting init system.
      [FAILED] unknown init system.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    

    The unknown init system should be fine, as I do not want to create any startup scripts or move files somewhere.

    Running the gateway as root gives:

    $ ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.1-alpha
    mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.1-alpha
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:DIS
    mysgw: TSF:TDI:TSL
    

    This tells me that the communication between radio and RPI fails.

    I (more than) triple-checked the wiring.
    I use a voltage regulator from 5V to 3.3V and have a 47ยตF capacitor between GND and 3.3V. I also tried a different voltage regulator and NRF24L01.

    I assume the radio itself should be fine because attached to a Arduino Nano (with voltage regulator, without condensator) I see:

    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0
    25 TSM:INIT
    26 TSF:WUR:MS=0
    33 TSM:INIT:TSP OK
    35 TSM:FPAR
    37 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2046 !TSM:FPAR:NO REPLY
    

    Which I expect to the missing gateway.

    -) Is the SPIDEV driver ok? BCM does not compile for 64bit.
    -) Do I need to activate any GPIO ports with
    echo "$i" > /sys/class/gpio/export or anything alike?
    -) Is it ok, that I use other GPIO ports directly for other things?
    -) Is there a way to test that SPI is working properly?

    Thanks!



  • @gunther After fighting with this problem for some days, I now got it working. The solution was to use the BCM driver instead of SPIDEV.

    I achieved that by commenting out the 32 bit gcc flags in ./configure

    function gcc_cpu_flags {
        local soc=$1
        case $soc in
        BCM2835)
            flags="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"
            ;;
        BCM2836)
            flags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
            ;;
        BCM2837)
            flags=""
            #flags="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard"
            ;;
    

    and running configure with this options:

    $ ./configure --my-transport=nrf24 --my-gateway=ethernet --my-port=5003 --soc=BCM2837
    

    Hope this shortens the learning curve for 64bit Rasperry Pi users!


  • Mod

    @gunther great work, thanks for sharing! And welcome to the MySensors community ๐Ÿ™‚


 

414
Online

7.9k
Users

8.8k
Topics

94.2k
Posts