|
| 1 | +# Pine ROCK64 |
| 2 | + |
| 3 | +The Pine ROCK64 is a single board SoC computer based on the Rockchip RK3328 arm64 processor. It has built-in GPIO and |
| 4 | +I2C interfaces. SPI is most likely not usable (not tested), because in use by the SPI FLASH 128M memory chip. |
| 5 | + |
| 6 | +For more info about the Pine ROCK64, go to [https://pine64.org/documentation/ROCK64/](https://pine64.org/documentation/ROCK64/). |
| 7 | + |
| 8 | +## How to Install |
| 9 | + |
| 10 | +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) |
| 11 | + |
| 12 | +Tested OS: |
| 13 | + |
| 14 | +* [armbian](https://www.armbian.com/rock64/) with Debian |
| 15 | + |
| 16 | +## Configuration steps for the OS |
| 17 | + |
| 18 | +### System access and configuration basics |
| 19 | + |
| 20 | +Please follow the instructions of the OS provider. A ssh access is used in this guide. |
| 21 | + |
| 22 | +```sh |
| 23 | +ssh <user>@192.168.1.xxx |
| 24 | +``` |
| 25 | + |
| 26 | +### Enabling hardware drivers |
| 27 | + |
| 28 | +Not all drivers are enabled by default. You can have a look at the configuration file, to find out what is enabled at |
| 29 | +your system: |
| 30 | + |
| 31 | +```sh |
| 32 | +cat /boot/armbianEnv.txt |
| 33 | +``` |
| 34 | + |
| 35 | +```sh |
| 36 | +sudo apt install armbian-config |
| 37 | +sudo armbian-config |
| 38 | +``` |
| 39 | + |
| 40 | +## How to Use |
| 41 | + |
| 42 | +The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself. |
| 43 | + |
| 44 | +```go |
| 45 | +r := rock64.NewAdaptor() |
| 46 | +led := gpio.NewLedDriver(r, "7") |
| 47 | +``` |
| 48 | + |
| 49 | +## How to Connect |
| 50 | + |
| 51 | +### Compiling |
| 52 | + |
| 53 | +Compile your Gobot program on your workstation like this: |
| 54 | + |
| 55 | +```sh |
| 56 | +GOARCH=arm64 GOOS=linux go build -o output/ examples/rock64_blink.go |
| 57 | +``` |
| 58 | + |
| 59 | +Once you have compiled your code, you can upload your program and execute it on the board from your workstation |
| 60 | +using the `scp` and `ssh` commands like this: |
| 61 | + |
| 62 | +```sh |
| 63 | +scp rock64_blink <user>@192.168.1.xxx:~ |
| 64 | +ssh -t <user>@192.168.1.xxx "./rock64_blink" |
| 65 | +``` |
| 66 | + |
| 67 | +## Troubleshooting |
| 68 | + |
| 69 | +### I2C-0 overlay |
| 70 | + |
| 71 | +With the armbian-config sometimes the overlays can not properly applied (different open Bugs). To ensure your overlay |
| 72 | +is applied have a look into your /boot/boot.cmd and search for the name of the used shell variable(s). This name needs |
| 73 | +to be used in your /boot/armbianEnv.txt. |
| 74 | + |
| 75 | +```sh cat /boot/boot.cmd | grep overlay_file |
| 76 | +for overlay_file in ${overlays}; do |
| 77 | + if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then |
| 78 | + echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" |
| 79 | +for overlay_file in ${user_overlays}; do |
| 80 | + if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then |
| 81 | + echo "Applying user provided DT overlay ${overlay_file}.dtbo" |
| 82 | +``` |
| 83 | +
|
| 84 | +In the example above the variable is named `overlays`. So your /boot/armbianEnv.txt must contain this variable. |
| 85 | +
|
| 86 | +```sh cat /boot/armbianEnv.txt | grep overlay |
| 87 | +overlay_prefix=rockchip |
| 88 | +overlays=rk3328-i2c0 |
| 89 | +``` |
| 90 | +
|
| 91 | +In some buggy versions the variable is named "fdt_overlays", just rename the variable in your "armbianEnv.txt" to match |
| 92 | +the boot script. |
| 93 | +
|
| 94 | +As you can see in the boot script, the real file name is a concatenate of different variables `${overlay_prefix}-${overlay_file}.dtbo`. |
| 95 | +This file must exist in the folder `${prefix}dtb/rockchip/overlay` (prefix="/boot/"). So for the i2c-0 overlay: |
| 96 | +
|
| 97 | +```sh ls -la /boot/dtb/rockchip/overlay/ | grep i2c0 |
| 98 | +-rw-r--r-- 1 root root 218 Nov 25 19:15 rockchip-rk3328-i2c0.dtbo |
| 99 | +-rw-r--r-- 1 root root 223 Nov 25 19:15 rockchip-rk3568-hk-i2c0.dtbo |
| 100 | +``` |
| 101 | +
|
| 102 | +...means the entry in the armbianEnv.txt sould be set to "overlays=rk3328-i2c0". |
| 103 | +
|
| 104 | +The variable can contain a space separated list. |
| 105 | +
|
| 106 | +### PWM |
| 107 | +
|
| 108 | +There are 3 PWMs on the chip (pwm0, pwm1, pwm2). Unfortunately all pins are shared with the PMIC, so i2c-1 (pwm0, pwm1) |
| 109 | +can not be deactivated, because it is mandatory for the i2c communication to PMIC address 0x18. Simply an activation of |
| 110 | +pwm0 or pwm1 with an overlay leads to the Kernel can not be loaded anymore. |
0 commit comments