Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Mysensors Gateway on OrangePi (Zero) (opi)

Mysensors Gateway on OrangePi (Zero) (opi)

Scheduled Pinned Locked Moved Development
117 Posts 11 Posters 43.1k Views 11 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M marceloaqno

    I'm trying to add support for Orange Pi to MySensors, this is the work-in-progress repository:
    https://github.com/marceloaqno/MySensors/tree/spidev

    It would be great if someone could test and submit results from the configure and make commands:

    git clone https://github.com/marceloaqno/MySensors marceloaqno-spidev
    cd marceloaqno-spidev
    git checkout spidev
    ./configure
    make
    
    T Offline
    T Offline
    Tag
    wrote on last edited by
    #43

    @marceloaqno

    Hi!, really appreciate your hard work on this!!, below are the results,
    (I was not able to execute the 1st command :( but... tried something else..

    root@orangepizero:~# git clone https://github.com/marceloaqno/MySensors.git marceloaqno-spidev
    Cloning into 'marceloaqno-spidev'...
    remote: Counting objects: 13834, done.
    remote: Compressing objects: 100% (26/26), done.
    remote: Total 13834 (delta 2), reused 0 (delta 0), pack-reused 13808
    Receiving objects: 100% (13834/13834), 9.67 MiB | 3.16 MiB/s, done.
    Resolving deltas: 100% (8289/8289), done.
    Checking connectivity... done.
    root@orangepizero:~# cd marceloaqno-spidev
    root@orangepizero:~/marceloaqno-spidev# git checkout spidev
    Branch spidev set up to track remote branch spidev from origin.
    Switched to a new branch 'spidev'

    root@orangepizero:~/marceloaqno-spidev# ./configure
    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=H3, Type=unknown, CPU=armv7l.
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:SPIDEV.
    [SECTION] Detecting init system.
    [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    root@orangepizero:~/marceloaqno-spidev# make
    gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/log.c -o build/drivers/Linux/log.o
    g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o
    g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
    g++ -MT build/drivers/Linux/Print.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o
    g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o
    g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o
    g++ -MT build/drivers/Linux/Stream.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o
    g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
    g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o
    g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o
    g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o
    g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o
    g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
    /tmp/ccVhf8xP.s: Assembler messages:
    /tmp/ccVhf8xP.s:14808: Warning: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
    g++ -MT build/drivers/SPIDEV/SPI.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV -DLINUX_GPIO_CAPABLE -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/SPIDEV/SPI.cpp -o build/drivers/SPIDEV/SPI.o
    g++ -pthread -o bin/mysgw build/drivers/Linux/log.o build/drivers/Linux/noniso.o build/drivers/Linux/GPIO.o build/drivers/Linux/Print.o build/drivers/Linux/EthernetClient.o build/drivers/Linux/SerialPort.o build/drivers/Linux/Stream.o build/drivers/Linux/IPAddress.o build/drivers/Linux/compatibility.o build/drivers/Linux/interrupt.o build/drivers/Linux/SoftEeprom.o build/drivers/Linux/EthernetServer.o build/examples_linux/mysgw.o build/drivers/SPIDEV/SPI.o

    root@orangepizero:~/marceloaqno-spidev# ll bin
    total 640
    -rwxr-xr-x 1 root root 654544 Jan 7 22:48 mysgw

    Seems we have a binary!!
    :D

    1 Reply Last reply
    0
    • M marceloaqno

      I'm trying to add support for Orange Pi to MySensors, this is the work-in-progress repository:
      https://github.com/marceloaqno/MySensors/tree/spidev

      It would be great if someone could test and submit results from the configure and make commands:

      git clone https://github.com/marceloaqno/MySensors marceloaqno-spidev
      cd marceloaqno-spidev
      git checkout spidev
      ./configure
      make
      
      T Offline
      T Offline
      Tag
      wrote on last edited by Tag
      #44

      @marceloaqno

      Just hooked up a radio to the GPIO header. (used this link for the model 1 RPI https://www.mysensors.org/build/raspberry and attached the interrupt pin also to pin 15)

      This is the result i get
      root@orangepizero:~/marceloaqno-spidev/bin# mysgw
      mysgw: Starting gateway...
      mysgw: Protocol version - 2.2.0-beta
      mysgw: Could not open /sys/class/gpio/gpio10/direction
      Illegal instruction
      root@orangepizero:~/marceloaqno-spidev/bin#

      M 2 Replies Last reply
      0
      • T Tag

        @marceloaqno

        Just hooked up a radio to the GPIO header. (used this link for the model 1 RPI https://www.mysensors.org/build/raspberry and attached the interrupt pin also to pin 15)

        This is the result i get
        root@orangepizero:~/marceloaqno-spidev/bin# mysgw
        mysgw: Starting gateway...
        mysgw: Protocol version - 2.2.0-beta
        mysgw: Could not open /sys/class/gpio/gpio10/direction
        Illegal instruction
        root@orangepizero:~/marceloaqno-spidev/bin#

        M Offline
        M Offline
        marceloaqno
        Code Contributor
        wrote on last edited by marceloaqno
        #45

        @Tag Great! The mapping of the physical GPIO number in OrangePi is not ready yet, so you need to figure out the correct value for the CE and CSN pins by adding this to the examples_linux/mysgw.cpp or MyConfig.h

        #define MY_RF24_CE_PIN X
        #define MY_RF24_CS_PIN Y
        

        This is the best pinout image I've found that could help:
        https://oshlab.com/orange-pi-zero-pinout/

        This may also give you some hint:

        cat /sys/kernel/debug/gpio
        
        M 1 Reply Last reply
        0
        • M marceloaqno

          @Tag Great! The mapping of the physical GPIO number in OrangePi is not ready yet, so you need to figure out the correct value for the CE and CSN pins by adding this to the examples_linux/mysgw.cpp or MyConfig.h

          #define MY_RF24_CE_PIN X
          #define MY_RF24_CS_PIN Y
          

          This is the best pinout image I've found that could help:
          https://oshlab.com/orange-pi-zero-pinout/

          This may also give you some hint:

          cat /sys/kernel/debug/gpio
          
          M Offline
          M Offline
          marceloaqno
          Code Contributor
          wrote on last edited by marceloaqno
          #46

          @Tag Maybe this one can help too:
          http://orange314.com/WiringOP

          M 1 Reply Last reply
          0
          • M marceloaqno

            @Tag Maybe this one can help too:
            http://orange314.com/WiringOP

            M Offline
            M Offline
            marceloaqno
            Code Contributor
            wrote on last edited by
            #47

            @Tag also, please don't set the interrupt pin for now.

            1 Reply Last reply
            0
            • T Tag

              @marceloaqno

              Just hooked up a radio to the GPIO header. (used this link for the model 1 RPI https://www.mysensors.org/build/raspberry and attached the interrupt pin also to pin 15)

              This is the result i get
              root@orangepizero:~/marceloaqno-spidev/bin# mysgw
              mysgw: Starting gateway...
              mysgw: Protocol version - 2.2.0-beta
              mysgw: Could not open /sys/class/gpio/gpio10/direction
              Illegal instruction
              root@orangepizero:~/marceloaqno-spidev/bin#

              M Offline
              M Offline
              marceloaqno
              Code Contributor
              wrote on last edited by
              #48

              @Tag I found more information on the wiki page about the gpio pins:
              http://linux-sunxi.org/GPIO

              It seems that there is a calculation to be made to know which number to use :scream:

              1 Reply Last reply
              0
              • T Offline
                T Offline
                Tag
                wrote on last edited by Tag
                #49

                @marceloaqno

                Hi!!, many thanks for the info!! really helpful!
                Made some progress. first I created this table based on this page: http://linux-sunxi.org/GPIO

                Pin - Num - Name - Calculated value A=1 ((1-1)*32 + Pin)
                CE / 22 / PA02 / 2
                SCK / 23 / PA14 / 14
                MISO / 21 / PA16 / 16
                CSN / 24 / PA13 / 13
                MOSI / 19 / PA15 / 15

                Now it is important that you know which kernel is used on your systems the 4.x architecture is different compared to the 3.x arch...

                If the 4.x kernel is used you need to use the calculated value for the GPIO pin numbering, i could not test that since I am using the 3.x kernel, so this is what i did:

                1. load the GPIO kernel module:
                modprobe gpio-sunxi
                
                1. Create the GPIO device files since these were not available on my system by default.
                for A in 1 2 3 4 5 6 7 8 9 10 11 12; do echo "$A" > /sys/class/gpio/export ; done
                

                This created the following entries in /sys/class/gpio

                root@orangepizero:~/marceloaqno-spidev/bin# ls -l /sys/class/gpio
                total 0
                --w------- 1 root root 4096 Jan  8 07:39 export
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio1 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio1
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio11 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio11
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio12 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio12
                lrwxrwxrwx 1 root root    0 Jan  8 07:32 gpio13 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio13
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio2 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio2
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio3 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio3
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio4 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio4
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio5 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio5
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio6 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio6
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio7 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio7
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio8 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio8
                lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio9 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio9
                lrwxrwxrwx 1 root root    0 Jan  1  1970 gpiochip0 -> ../../devices/platform/sunxi-pinctrl/gpio/gpiochip0
                --w------- 1 root root 4096 Jan  1  1970 unexport
                

                Modified mysgw.cpp to use:

                #define MY_RF24_CE_PIN 2
                #define MY_RF24_CS_PIN 13
                

                And did a clean build:

                make clean
                ./configure
                make
                

                Now some thing has changed! :)

                root@orangepizero:~/marceloaqno-spidev/bin# ./mysgw -d
                mysgw: Starting gateway...
                mysgw: Protocol version - 2.2.0-beta
                mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
                mysgw: TSM:INIT
                mysgw: TSF:WUR:MS=0
                mysgw: !TSM:INIT:TSP FAIL
                mysgw: TSM:FAIL:CNT=1
                mysgw: TSM:FAIL:PDT
                

                Will do some more testing with an LED today see if the GPIO pin numbering that was created is okay,

                will keep you posted!:

                M 1 Reply Last reply
                1
                • T Offline
                  T Offline
                  Tag
                  wrote on last edited by Tag
                  #50

                  @marceloaqno
                  Did some testing,

                  Setup the GPIO pins:

                  modprobe gpio-sunxi
                  
                  for A in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 
                  do echo "$A" > /sys/class/gpio/export
                  done
                  

                  (The device files that are created by the commands above do not survive a reboot, so remember to execute the above commands after each reboot!)

                  Hooked up an led between ground and i.e. pin 22, this pin is linked to GPIO2

                  Then:

                  echo out > /sys/class/gpio/gpio2/direction
                  echo 1 > /sys/class/gpio/gpio2/value
                  echo 0 > /sys/class/gpio/gpio2/value
                  
                  

                  And eureka!! Led went on and off :D

                  Did this for all GPIO ports used by mysgw, below is the verified pin / GPIO table

                  Pin#  -  GPIO / NRF24 
                  22 - GPIO2   / CE
                  23 - GPIO14  / SCK
                  21 - GPIO16  / MISO
                  24 - GPIO13  / CSN
                  19 - GPIO15  / MOSI
                  

                  Tested all pins and led went on and off on all

                  How i connected the radio: https://www.mysensors.org/build/raspberry (see the Pi1 part)
                  How to setup GPIO: http://linux-sunxi.org/GPIO (3.x kernel part, and added pin 13/14/15/16)
                  Pinout for the OPI Zero: https://i1.wp.com/oshlab.com/wp-content/uploads/2016/11/Orange-Pi-Zero-Pinout-banner2.jpg?fit=1200%2C628&ssl=1 (carefully look at the pin numbering!)

                  Maybe it is usefull, I rebuild mysgw with NRF24 radio debugging enabled, this is the output I get:

                  root@orangepizero:~/marceloaqno-spidev/bin# ./mysgw -d
                  mysgw: Starting gateway...
                  mysgw: Protocol version - 2.2.0-beta
                  mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
                  mysgw: TSM:INIT
                  mysgw: TSF:WUR:MS=0
                  mysgw: RF24:write register, reg=0, value=14
                  mysgw: RF24:write register, reg=3, value=3
                  mysgw: RF24:write register, reg=4, value=95
                  mysgw: RF24:write register, reg=5, value=76
                  mysgw: RF24:write register, reg=6, value=39
                  mysgw: RF24:write register, reg=16, value=115
                  mysgw: RF24:write register, reg=29, value=6
                  mysgw: RF24:read register, reg=6, value=0
                  mysgw: RF24:read register, reg=5, value=0
                  mysgw: !RF24:INIT:SANCHK FAIL
                  mysgw: !TSM:INIT:TSP FAIL
                  mysgw: TSM:FAIL:CNT=1
                  mysgw: TSM:FAIL:PDT
                  mysgw: RF24:write register, reg=0, value=12
                  mysgw: RF24:PD
                  ^Cmysgw: Received SIGINT
                  

                  keeps looping, until ctrl-c is given.

                  1 Reply Last reply
                  0
                  • T Tag

                    @marceloaqno

                    Hi!!, many thanks for the info!! really helpful!
                    Made some progress. first I created this table based on this page: http://linux-sunxi.org/GPIO

                    Pin - Num - Name - Calculated value A=1 ((1-1)*32 + Pin)
                    CE / 22 / PA02 / 2
                    SCK / 23 / PA14 / 14
                    MISO / 21 / PA16 / 16
                    CSN / 24 / PA13 / 13
                    MOSI / 19 / PA15 / 15

                    Now it is important that you know which kernel is used on your systems the 4.x architecture is different compared to the 3.x arch...

                    If the 4.x kernel is used you need to use the calculated value for the GPIO pin numbering, i could not test that since I am using the 3.x kernel, so this is what i did:

                    1. load the GPIO kernel module:
                    modprobe gpio-sunxi
                    
                    1. Create the GPIO device files since these were not available on my system by default.
                    for A in 1 2 3 4 5 6 7 8 9 10 11 12; do echo "$A" > /sys/class/gpio/export ; done
                    

                    This created the following entries in /sys/class/gpio

                    root@orangepizero:~/marceloaqno-spidev/bin# ls -l /sys/class/gpio
                    total 0
                    --w------- 1 root root 4096 Jan  8 07:39 export
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio1 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio1
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio11 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio11
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio12 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio12
                    lrwxrwxrwx 1 root root    0 Jan  8 07:32 gpio13 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio13
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio2 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio2
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio3 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio3
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio4 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio4
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio5 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio5
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio6 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio6
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio7 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio7
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio8 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio8
                    lrwxrwxrwx 1 root root    0 Jan  8 07:16 gpio9 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio9
                    lrwxrwxrwx 1 root root    0 Jan  1  1970 gpiochip0 -> ../../devices/platform/sunxi-pinctrl/gpio/gpiochip0
                    --w------- 1 root root 4096 Jan  1  1970 unexport
                    

                    Modified mysgw.cpp to use:

                    #define MY_RF24_CE_PIN 2
                    #define MY_RF24_CS_PIN 13
                    

                    And did a clean build:

                    make clean
                    ./configure
                    make
                    

                    Now some thing has changed! :)

                    root@orangepizero:~/marceloaqno-spidev/bin# ./mysgw -d
                    mysgw: Starting gateway...
                    mysgw: Protocol version - 2.2.0-beta
                    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
                    mysgw: TSM:INIT
                    mysgw: TSF:WUR:MS=0
                    mysgw: !TSM:INIT:TSP FAIL
                    mysgw: TSM:FAIL:CNT=1
                    mysgw: TSM:FAIL:PDT
                    

                    Will do some more testing with an LED today see if the GPIO pin numbering that was created is okay,

                    will keep you posted!:

                    M Offline
                    M Offline
                    mihai.aldea
                    wrote on last edited by
                    #51

                    @Tag said:

                    Made some progress. first I created this table based on this page: http://linux-sunxi.org/GPIO

                    Pin - Num - Name - Calculated value
                    CE / 22 / PA02 / 482
                    SCK / 23 / PA14 / 494
                    MISO / 21 / PA16 / 496
                    CSN / 24 / PA13 / 493
                    MOSI / 19 / PA15 / 495

                    Are you sure this is correct?
                    The formula is: (position of letter in alphabet - 1) * 32 + pin number
                    For PA02 for instance the correct value is:
                    PA02 = (1 - 1) * 32 + 02 = 2

                    Actually you don't need to use the formula at all with the PA ports, all you have to do is use the trailing number.

                    T 1 Reply Last reply
                    0
                    • M mihai.aldea

                      @Tag said:

                      Made some progress. first I created this table based on this page: http://linux-sunxi.org/GPIO

                      Pin - Num - Name - Calculated value
                      CE / 22 / PA02 / 482
                      SCK / 23 / PA14 / 494
                      MISO / 21 / PA16 / 496
                      CSN / 24 / PA13 / 493
                      MOSI / 19 / PA15 / 495

                      Are you sure this is correct?
                      The formula is: (position of letter in alphabet - 1) * 32 + pin number
                      For PA02 for instance the correct value is:
                      PA02 = (1 - 1) * 32 + 02 = 2

                      Actually you don't need to use the formula at all with the PA ports, all you have to do is use the trailing number.

                      T Offline
                      T Offline
                      Tag
                      wrote on last edited by
                      #52

                      @mihai.aldea

                      You are right, took the letter P, which is 16.... but is should have been A.... (for the 4.x kernel)
                      Updated the table!,

                      Thx!!

                      M 1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Reza
                        wrote on last edited by Reza
                        #53

                        i have problem in build gateway on orangepi one

                        root@OrangePI:~/marceloaqno-spidev# make
                        Makefile:16: Makefile.inc: No such file or directory
                        [Running configure]
                        [SECTION] Detecting target machine.
                          [OK] machine detected: SoC=H3, Type=unknown, CPU=armv7l.
                        [SECTION] Detecting SPI driver.
                          [OK] SPI driver detected:SPIDEV.
                        [SECTION] Detecting init system.
                          [OK] init system detected: systemd.
                        [SECTION] Saving configuration.
                        [OK] Finished.
                        gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/log.c -o build/drivers/Linux/log.o
                        g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
                        g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o
                        g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
                        g++ -MT build/drivers/Linux/Print.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o
                        g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o
                        g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o
                        g++ -MT build/drivers/Linux/Stream.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o
                        g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o
                        g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o
                        drivers/Linux/interrupt.cpp: In function ‘void* interruptHandler(void*)’:
                        drivers/Linux/interrupt.cpp:107:26: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
                           (void)read (fd, &c, 1) ;
                                                  ^
                        g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o
                        g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o
                        g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
                        In file included from ./MySensors.h:294:0,
                                         from examples_linux/mysgw.cpp:74:
                        ./drivers/RF24/RF24.cpp:39:11: error: Not supported on this platform.
                          hwDigitalWrite(MY_RF24_CS_PIN, level);
                                   ^
                        ./drivers/RF24/RF24.cpp:44:11: error: Not supported on this platform.
                          hwDigitalWrite(MY_RF24_CE_PIN, level);
                                   ^
                        ./drivers/RF24/RF24.cpp:388:11: error: Not supported on this platform.
                          hwPinMode(MY_RF24_CE_PIN,OUTPUT);
                                   ^
                        ./drivers/RF24/RF24.cpp:389:11: error: Not supported on this platform.
                          hwPinMode(MY_RF24_CS_PIN,OUTPUT);
                                   ^
                        ./drivers/RF24/RF24.cpp:37:32: warning: unused parameter ‘level’ [-Wunused-parameter]
                         LOCAL void RF24_csn(const bool level)
                                                        ^
                        ./drivers/RF24/RF24.cpp:42:31: warning: unused parameter ‘level’ [-Wunused-parameter]
                         LOCAL void RF24_ce(const bool level)
                                                       ^
                        ./drivers/RF24/RF24.cpp: In function ‘uint8_t RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)’:
                        ./drivers/RF24/RF24.cpp:56:11: error: ‘LOW’ was not declared in this scope
                          RF24_csn(LOW);
                                   ^
                        ./drivers/RF24/RF24.cpp:99:11: error: ‘HIGH’ was not declared in this scope
                          RF24_csn(HIGH);
                                   ^
                        ./drivers/RF24/RF24.cpp: In function ‘void RF24_startListening()’:
                        ./drivers/RF24/RF24.cpp:235:10: error: ‘HIGH’ was not declared in this scope
                          RF24_ce(HIGH);
                                  ^
                        ./drivers/RF24/RF24.cpp: In function ‘void RF24_stopListening()’:
                        ./drivers/RF24/RF24.cpp:241:10: error: ‘LOW’ was not declared in this scope
                          RF24_ce(LOW);
                                  ^
                        ./drivers/RF24/RF24.cpp: In function ‘void RF24_powerDown()’:
                        ./drivers/RF24/RF24.cpp:251:10: error: ‘LOW’ was not declared in this scope
                          RF24_ce(LOW);
                                  ^
                        ./drivers/RF24/RF24.cpp: In function ‘bool RF24_sendMessage(uint8_t, const void*, uint8_t)’:
                        ./drivers/RF24/RF24.cpp:269:10: error: ‘HIGH’ was not declared in this scope
                          RF24_ce(HIGH);
                                  ^
                        ./drivers/RF24/RF24.cpp:276:10: error: ‘LOW’ was not declared in this scope
                          RF24_ce(LOW);
                                  ^
                        ./drivers/RF24/RF24.cpp: In function ‘bool RF24_initialize()’:
                        ./drivers/RF24/RF24.cpp:395:10: error: ‘LOW’ was not declared in this scope
                          RF24_ce(LOW);
                                  ^
                        ./drivers/RF24/RF24.cpp:396:11: error: ‘HIGH’ was not declared in this scope
                          RF24_csn(HIGH);
                                   ^
                        Makefile:114: recipe for target 'build/examples_linux/mysgw.o' failed
                        make: *** [build/examples_linux/mysgw.o] Error 1
                        root@OrangePI:~/marceloaqno-spidev#
                        
                        

                        i want build a gateway with orangepi one with channel 0 . what am i do ? thank you

                        M 1 Reply Last reply
                        0
                        • R Reza

                          i have problem in build gateway on orangepi one

                          root@OrangePI:~/marceloaqno-spidev# make
                          Makefile:16: Makefile.inc: No such file or directory
                          [Running configure]
                          [SECTION] Detecting target machine.
                            [OK] machine detected: SoC=H3, Type=unknown, CPU=armv7l.
                          [SECTION] Detecting SPI driver.
                            [OK] SPI driver detected:SPIDEV.
                          [SECTION] Detecting init system.
                            [OK] init system detected: systemd.
                          [SECTION] Saving configuration.
                          [OK] Finished.
                          gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/log.c -o build/drivers/Linux/log.o
                          g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
                          g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o
                          g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
                          g++ -MT build/drivers/Linux/Print.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o
                          g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o
                          g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o
                          g++ -MT build/drivers/Linux/Stream.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o
                          g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o
                          g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o
                          drivers/Linux/interrupt.cpp: In function ‘void* interruptHandler(void*)’:
                          drivers/Linux/interrupt.cpp:107:26: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
                             (void)read (fd, &c, 1) ;
                                                    ^
                          g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o
                          g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o
                          g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
                          In file included from ./MySensors.h:294:0,
                                           from examples_linux/mysgw.cpp:74:
                          ./drivers/RF24/RF24.cpp:39:11: error: Not supported on this platform.
                            hwDigitalWrite(MY_RF24_CS_PIN, level);
                                     ^
                          ./drivers/RF24/RF24.cpp:44:11: error: Not supported on this platform.
                            hwDigitalWrite(MY_RF24_CE_PIN, level);
                                     ^
                          ./drivers/RF24/RF24.cpp:388:11: error: Not supported on this platform.
                            hwPinMode(MY_RF24_CE_PIN,OUTPUT);
                                     ^
                          ./drivers/RF24/RF24.cpp:389:11: error: Not supported on this platform.
                            hwPinMode(MY_RF24_CS_PIN,OUTPUT);
                                     ^
                          ./drivers/RF24/RF24.cpp:37:32: warning: unused parameter ‘level’ [-Wunused-parameter]
                           LOCAL void RF24_csn(const bool level)
                                                          ^
                          ./drivers/RF24/RF24.cpp:42:31: warning: unused parameter ‘level’ [-Wunused-parameter]
                           LOCAL void RF24_ce(const bool level)
                                                         ^
                          ./drivers/RF24/RF24.cpp: In function ‘uint8_t RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)’:
                          ./drivers/RF24/RF24.cpp:56:11: error: ‘LOW’ was not declared in this scope
                            RF24_csn(LOW);
                                     ^
                          ./drivers/RF24/RF24.cpp:99:11: error: ‘HIGH’ was not declared in this scope
                            RF24_csn(HIGH);
                                     ^
                          ./drivers/RF24/RF24.cpp: In function ‘void RF24_startListening()’:
                          ./drivers/RF24/RF24.cpp:235:10: error: ‘HIGH’ was not declared in this scope
                            RF24_ce(HIGH);
                                    ^
                          ./drivers/RF24/RF24.cpp: In function ‘void RF24_stopListening()’:
                          ./drivers/RF24/RF24.cpp:241:10: error: ‘LOW’ was not declared in this scope
                            RF24_ce(LOW);
                                    ^
                          ./drivers/RF24/RF24.cpp: In function ‘void RF24_powerDown()’:
                          ./drivers/RF24/RF24.cpp:251:10: error: ‘LOW’ was not declared in this scope
                            RF24_ce(LOW);
                                    ^
                          ./drivers/RF24/RF24.cpp: In function ‘bool RF24_sendMessage(uint8_t, const void*, uint8_t)’:
                          ./drivers/RF24/RF24.cpp:269:10: error: ‘HIGH’ was not declared in this scope
                            RF24_ce(HIGH);
                                    ^
                          ./drivers/RF24/RF24.cpp:276:10: error: ‘LOW’ was not declared in this scope
                            RF24_ce(LOW);
                                    ^
                          ./drivers/RF24/RF24.cpp: In function ‘bool RF24_initialize()’:
                          ./drivers/RF24/RF24.cpp:395:10: error: ‘LOW’ was not declared in this scope
                            RF24_ce(LOW);
                                    ^
                          ./drivers/RF24/RF24.cpp:396:11: error: ‘HIGH’ was not declared in this scope
                            RF24_csn(HIGH);
                                     ^
                          Makefile:114: recipe for target 'build/examples_linux/mysgw.o' failed
                          make: *** [build/examples_linux/mysgw.o] Error 1
                          root@OrangePI:~/marceloaqno-spidev#
                          
                          

                          i want build a gateway with orangepi one with channel 0 . what am i do ? thank you

                          M Offline
                          M Offline
                          marceloaqno
                          Code Contributor
                          wrote on last edited by
                          #54

                          @Reza You need to run:

                          modprobe gpio-sunxi
                          

                          so that /sys/class/gpio/export is created.

                          1 Reply Last reply
                          0
                          • T Tag

                            @mihai.aldea

                            You are right, took the letter P, which is 16.... but is should have been A.... (for the 4.x kernel)
                            Updated the table!,

                            Thx!!

                            M Offline
                            M Offline
                            marceloaqno
                            Code Contributor
                            wrote on last edited by marceloaqno
                            #55

                            @Tag Does the TMRh20 works in the way your radio is currently connected?

                            T 1 Reply Last reply
                            0
                            • M marceloaqno

                              @Tag Does the TMRh20 works in the way your radio is currently connected?

                              T Offline
                              T Offline
                              Tag
                              wrote on last edited by Tag
                              #56

                              @marceloaqno
                              The library compiled, but unfortunately i cannot get the examples for linux working.
                              need to edit i.e. gettingstarted.cpp with the correct pin setting, have tried a lot, but either it says that the radio is not connected, and if used with incorrect settings it will not compile at all....

                              Maybe someone following this thread who has experince with this lib?
                              if there is any progress from my side will keep you posted...

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mihai.aldea
                                wrote on last edited by mihai.aldea
                                #57

                                If you used this wiring scheme:

                                nRF24L01 | Orange Pi
                                _________|________________
                                VCC      | VCC3V3-EXT
                                GND      | GND
                                CSN      | SPI0_CS0 (SPI-CE0)
                                CE       | PA7 (IO-7)
                                MOSI     | SPI0_MOSI (SPI-MOSI)
                                SCK      | SPI0_CLK (SPI-CLK)
                                MISO     | SPI0_MISO (SPI-MISO)
                                
                                

                                Then you should initialize the radio with:

                                RF24 radio(7,0);
                                

                                Worked for me:

                                root@opi-pc-1:~/RF24-master/examples_linux# ./gettingstarted
                                RF24/examples/GettingStarted/
                                STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                                RX_ADDR_P0-1	 = 0x65646f4e32 0x65646f4e31
                                RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
                                TX_ADDR		 = 0x65646f4e32
                                RX_PW_P0-6	 = 0x20 0x20 0x00 0x00 0x00 0x00
                                EN_AA		 = 0x3f
                                EN_RXADDR	 = 0x02
                                RF_CH		 = 0x4c
                                RF_SETUP	 = 0x07
                                CONFIG		 = 0x0e
                                DYNPD/FEATURE	 = 0x00 0x00
                                Data Rate	 = 1MBPS
                                Model		 = nRF24L01+
                                CRC Length	 = 16 bits
                                PA Power	 = PA_MAX
                                
                                 ************ Role Setup ***********
                                Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
                                
                                M T 2 Replies Last reply
                                0
                                • M mihai.aldea

                                  If you used this wiring scheme:

                                  nRF24L01 | Orange Pi
                                  _________|________________
                                  VCC      | VCC3V3-EXT
                                  GND      | GND
                                  CSN      | SPI0_CS0 (SPI-CE0)
                                  CE       | PA7 (IO-7)
                                  MOSI     | SPI0_MOSI (SPI-MOSI)
                                  SCK      | SPI0_CLK (SPI-CLK)
                                  MISO     | SPI0_MISO (SPI-MISO)
                                  
                                  

                                  Then you should initialize the radio with:

                                  RF24 radio(7,0);
                                  

                                  Worked for me:

                                  root@opi-pc-1:~/RF24-master/examples_linux# ./gettingstarted
                                  RF24/examples/GettingStarted/
                                  STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                                  RX_ADDR_P0-1	 = 0x65646f4e32 0x65646f4e31
                                  RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
                                  TX_ADDR		 = 0x65646f4e32
                                  RX_PW_P0-6	 = 0x20 0x20 0x00 0x00 0x00 0x00
                                  EN_AA		 = 0x3f
                                  EN_RXADDR	 = 0x02
                                  RF_CH		 = 0x4c
                                  RF_SETUP	 = 0x07
                                  CONFIG		 = 0x0e
                                  DYNPD/FEATURE	 = 0x00 0x00
                                  Data Rate	 = 1MBPS
                                  Model		 = nRF24L01+
                                  CRC Length	 = 16 bits
                                  PA Power	 = PA_MAX
                                  
                                   ************ Role Setup ***********
                                  Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
                                  
                                  M Offline
                                  M Offline
                                  marceloaqno
                                  Code Contributor
                                  wrote on last edited by
                                  #58

                                  @mihai.aldea Could you try the repo I'm working on (https://github.com/marceloaqno/MySensors/tree/spidev marceloaqno-spidev) adding your settings to the examples_linux/mysgw.cpp?

                                  #define MY_RF24_CE_PIN 7
                                  #define MY_RF24_CS_PIN 0
                                  
                                  M 1 Reply Last reply
                                  0
                                  • M mihai.aldea

                                    If you used this wiring scheme:

                                    nRF24L01 | Orange Pi
                                    _________|________________
                                    VCC      | VCC3V3-EXT
                                    GND      | GND
                                    CSN      | SPI0_CS0 (SPI-CE0)
                                    CE       | PA7 (IO-7)
                                    MOSI     | SPI0_MOSI (SPI-MOSI)
                                    SCK      | SPI0_CLK (SPI-CLK)
                                    MISO     | SPI0_MISO (SPI-MISO)
                                    
                                    

                                    Then you should initialize the radio with:

                                    RF24 radio(7,0);
                                    

                                    Worked for me:

                                    root@opi-pc-1:~/RF24-master/examples_linux# ./gettingstarted
                                    RF24/examples/GettingStarted/
                                    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                                    RX_ADDR_P0-1	 = 0x65646f4e32 0x65646f4e31
                                    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
                                    TX_ADDR		 = 0x65646f4e32
                                    RX_PW_P0-6	 = 0x20 0x20 0x00 0x00 0x00 0x00
                                    EN_AA		 = 0x3f
                                    EN_RXADDR	 = 0x02
                                    RF_CH		 = 0x4c
                                    RF_SETUP	 = 0x07
                                    CONFIG		 = 0x0e
                                    DYNPD/FEATURE	 = 0x00 0x00
                                    Data Rate	 = 1MBPS
                                    Model		 = nRF24L01+
                                    CRC Length	 = 16 bits
                                    PA Power	 = PA_MAX
                                    
                                     ************ Role Setup ***********
                                    Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
                                    
                                    T Offline
                                    T Offline
                                    Tag
                                    wrote on last edited by Tag
                                    #59

                                    @mihai.aldea

                                    Hmmm.... checked the docs again and guess what. the 26 pin header on the OPI Zero has SPI1.... instead of SPI0

                                    Expansion Port

                                    The Orange Pi Zero has a 26-pin, 0.1" unpopulated connector with several low-speed interfaces.
                                    2x13 Header
                                    1	3.3V	           2	5V
                                    3	TWI0_SDA / PA12	   4	5V
                                    5	TWI0_SCK / PA11	   6	GND
                                    7	PWM1 / PA06	       8	UART1_TX / PG06
                                    9	GND	               10	UART1_RX / PG07
                                    11	UART2_RX / PA01	   12	SIM_CLK/PA_EINT7 / PA07
                                    13	UART2_TX / PA00	   14	GND
                                    15	UART2_CTS / PA03   16	TWI1-SDA / PA19
                                    17	3.3V	           18	TWI1-SCK / PA18
                                    19	SPI1_MOSI / PA15   20	GND
                                    21	SPI1_MISO / PA16   22	UART2_RTS / PA02
                                    23	SPI1_CLK / PA14    24	SPI1_CS / PA13
                                    25	GND	               26	SIM_DET/PA_EINT10 / PA10
                                    

                                    From http://linux-sunxi.org/Xunlong_Orange_Pi_Zero
                                    If i look at /dev I only see spi0, which is most probably used for the onboard flash...

                                    root@orangepizero:/# ll /dev | grep -i spi
                                    crw------- 1 root root    153,   0 Jan  8 11:12 spidev0.0
                                    

                                    So now i need to figure out a way to get SPI1 up and running

                                    1 Reply Last reply
                                    0
                                    • M marceloaqno

                                      @mihai.aldea Could you try the repo I'm working on (https://github.com/marceloaqno/MySensors/tree/spidev marceloaqno-spidev) adding your settings to the examples_linux/mysgw.cpp?

                                      #define MY_RF24_CE_PIN 7
                                      #define MY_RF24_CS_PIN 0
                                      
                                      M Offline
                                      M Offline
                                      mihai.aldea
                                      wrote on last edited by
                                      #60

                                      @marceloaqno Here's the output:

                                      ./MySensors.h:258:2: error: #error No support for nRF24 radio on this platform
                                       #error No support for nRF24 radio on this platform
                                        ^
                                      In file included from ./drivers/RF24/RF24.cpp:23:0,
                                                       from ./MySensors.h:294,
                                                       from examples_linux/mysgw.cpp:77:
                                      ./drivers/RF24/RF24.h:52:17: fatal error: SPI.h: No such file or directory
                                       #include <SPI.h>
                                                       ^
                                      compilation terminated.
                                      Makefile:98: recipe for target 'build/examples_linux/mysgw.o' failed
                                      make: *** [build/examples_linux/mysgw.o] Error 1
                                      
                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        mihai.aldea
                                        wrote on last edited by
                                        #61

                                        @Tag Use this info:
                                        http://linux-sunxi.org/Sunxi-tools
                                        To export /boot/script.bin, edit the output file and enable SPI1, then compile it back and reboot your OPi with the SPI1 active.

                                        If you haven't done this before, it's quite simple.

                                        apt-get install sunxi-tools
                                        cd ~
                                        bin2fex /boot/script.bin > script.fex
                                        

                                        Edit the script.fex file, find the [spi1] section and change spi_used = 0 to spi_used = 1. Save the file and exit.
                                        Then

                                        fex2bin script.fex > /boot/script.bin
                                        

                                        Reboot, then you should have the SPI1 active.

                                        T 1 Reply Last reply
                                        0
                                        • R Offline
                                          R Offline
                                          Reza
                                          wrote on last edited by
                                          #62

                                          @marceloaqno
                                          i have error yet
                                          orangepi is a good board. please work at this board and run mysensors gateway on this, i follow this topic when you can fix this on orange pi . thank you

                                          M 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular