gobot.io/x/gobot/v2@v2.1.0/platforms/nanopi/README.md (about)

     1  # NanoPi Boards
     2  
     3  The FriendlyARM NanoPi Boards are single board SoC computers with different hardware design. It has built-in GPIO, PWM,
     4  SPI, and I2C interfaces.
     5  
     6  For more info about the NanoPi Boards, go to [https://wiki.friendlyelec.com/wiki/index.php/Main_Page](https://wiki.friendlyelec.com/wiki/index.php/Main_Page).
     7  
     8  ## How to Install
     9  
    10  Tested OS:
    11  
    12  * [armbian](https://www.armbian.com/nanopi-neo/) with Debian or Ubuntu
    13  
    14  You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your
    15  workstation, transfer the final executable to your board, and run the program on the board as documented here.
    16  
    17  ```sh
    18  go get -d -u gobot.io/x/gobot/v2/...
    19  ```
    20  
    21  ### System access and configuration basics
    22  
    23  Please follow the installation instructions for the chosen OS.
    24  
    25  ### Enabling hardware drivers
    26  
    27  Please follow the configuration instructions for the chosen OS.
    28  
    29  E.g. for armbian:
    30  
    31  ```sh
    32  sudo armbian-config
    33  ```
    34  
    35  After configuration was changed, an reboot is necessary.
    36  
    37  ```sh
    38  sudo reboot
    39  ```
    40  
    41  ## How to Use
    42  
    43  The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.
    44  
    45  ```go
    46  r := nanopi.NewNeoAdaptor()
    47  led := gpio.NewLedDriver(r, "7")
    48  ```
    49  
    50  ## How to Connect
    51  
    52  ### Compiling
    53  
    54  Compile your Gobot program on your workstation like this:
    55  
    56  ```sh
    57  GOARM=7 GOARCH=arm GOOS=linux go build examples/nanopi_blink.go
    58  ```
    59  
    60  Once you have compiled your code, you can upload your program and execute it on the board from your workstation
    61  using the `scp` and `ssh` commands like this:
    62  
    63  ```sh
    64  scp nanopi_blink nan@nanopineo:~
    65  ssh -t nan@nanopineo "./nanopi_blink"
    66  ```
    67  
    68  ## GPIO's
    69  
    70  At least for NEO, nearly all 14 GPIO's supports the advanced pin options "bias", "drive", "debounce" and "edge detection".
    71  
    72  > Configure of edge detection will cause an initial event. GPIO header pins 19, 21, 23, 24 - do NOT support "debounce" and
    73  > "edge detection" for NEO. Using unsupported options leads to reconfigure errors with text "no such device or address".
    74  
    75  ## PWM
    76  
    77  A single PWM output is available at UART0-RX (UART_RXD0, internal PA5). So the UART0 needs to be disabled. The sunxi-
    78  overlay (e.g. for armbian) disables the UART0 and the kernel console at ttyS0. The related kernel module needs to be
    79  loaded: `sudo modprobe pwm-sun4i`. The default frequency is 100Hz.
    80  
    81  ## I2C
    82  
    83  The default bus number is set to 0, which is connected to header pins 3 (PA12-SDA) and 5 (PA11-SCL). At least for NEO
    84  rev.1.4 it is possible to activate bus 1, which is connected to "USB/Audio/IR" header pins 9 "PCM0_CLK/I2S0_BCK"
    85  (PA19-SDA) and 8 "PCM0_SYNC/I2S0_LRC" (PA18-SCL). Armbian allows to activate bus 2 (PE12-SCL, PE13-SDA), which pins are
    86  not wired for NEO and NEO2, but we do not block it at adaptor side.
    87  
    88  ## SPI
    89  
    90  There is a known issue on [armbian](https://forum.armbian.com/topic/20033-51525-breaks-spi-on-nanopi-neo-and-does-not-create-devspidev00/)
    91  for later Kernels.