A BeagleBone Blue Setup Guide

cool il find out when i get some more wires.

I’m also not confident that it’s as simple as just connecting wires. I imagine there’s a different initialization routine that has to be called for CAN vs flow controlled UART.

I think this is what i need to do

to enable the power supply to the servo pins and enable CAN add this script and add these lines to enable pin 80 and start CAN.

sudo nano /usr/bin/ardupilot/aphw

#!/bin/bash
# aphw
# ArduPilot hardware configuration.

/bin/echo 80 >/sys/class/gpio/export
/bin/echo out >/sys/class/gpio/gpio80/direction
/bin/echo 1 >/sys/class/gpio/gpio80/value
/bin/echo pruecapin_pu >/sys/devices/platform/ocp/ocp:P8_15_pinmux/state

/sbin/ip link set up can0 type can bitrate 1000000

then in

sudo nano /lib/systemd/system/ardurover.service

add this line

ExecStartPre=-/usr/bin/ardupilot/aphw
[Unit]
Description=ArduRover Service
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device
StartLimitIntervalSec=0
Conflicts=arducopter.service arduplane.service antennatracker.service

[Service]

ExecStartPre=-/usr/bin/ardupilot/aphw
EnvironmentFile=/etc/default/ardurover
ExecStart=/usr/bin/ardupilot/ardurover $SERIAL0 $SERIAL1 $SERIAL3  $SERIAL2  $SERIAL4
Restart=on-failure
RestartSec=1

[Install]

now the servos should get power and CAN should work* based no what i can figure out from the other post about CAN.

I’m going to try and get the voltage monitoring and wheel encoders working tomorrow

1 Like

I have the voltage monitoring working for the Internal 2s battery connection and the 12v input, its already wired with a voltage divider to ADC5 and ADC6, so by setting batt1 and batt2 to monitor voltage only on pins 5 and 6 i can now monitor the voltages from ardupilot.

GPIO is mapped here

Hi,

the can is easy, you need to load the kernel modules for can and then setup the correct device inside the ardupilot.
Sorry, I just saw your post today, how can I help?

1 Like

@juvinski I have copied this post here, I am waiting for some wires before i can test it.

perhaps you can answer this question? is the CAN port tied to UART0?? or is it just using the flow control pins?

Hi @geofrancis ,

The simple answer is the CAN is using just the flow control pins - generic names in this case, if I’m talking about very basic things, but all devices in the beaglebones are defined by the device tree overlay file.
One thing I always suffer, you need to check the CAN device in the linux and check inside ardupilot - ardupilot/libraries/AP_HAL_Linux/hwdef/blue/hwdef.dat at 312e42ecfa91c859b030c5dbb047f7292b6b59a6 Β· ArduPilot/ardupilot Β· GitHub
if they match.
Another thing is to load the can modules in linux kernel and you can use the can-tools to sniff and check the packages between for instance, a device/sensor and the linux itself.

1 Like

Good news!!

CAN is working!

got lua working

image

SBUS in on encoder signal B input.

I2c is working,
add uboot_overlay_addr4=/lib/firmware/BB-I2C1-00A0.dtbo in /boot/uEnv.txt to enable the external i2c 1 port.

2 Likes

Great news @geofrancis
:slight_smile:

1 Like

Rather than trying to deal with potentially damaging the 1.0mm connectors I just added them onto a big servo style block with all its connectors that I can just leave attached.

this is by final setup list of commands to get the latest ardupilot working with 4 serial ports, canbus, SBUS, LUA external I2c, ADC and 6v servo power.

Using bone-debian-10.13-console-armhf-2023-04-06-1gb.img.xz

echo "debian ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers.d/debian >/dev/null
connmanctl services | grep 'YOUR_SSID' | grep -Po 'wifi_[^ ]+'
connmanctl services <OUTPUT-FROM-CONNMANCTL-COMMAND>`
sudo nano /var/lib/connman/wifi.config
[service_<OUTPUT-FROM-CONNMANCTL-COMMAND>]
 Type = wifi
 Security = wps
 Name = YOUR_SSID
 Passphrase = password
sudo chmod 0600 /var/lib/connman/wifi.config
sudo sed -i '/init-eMMC-flasher/s/^#//' /boot/uEnv.txt
sudo reboot

the leds will strobe when its copying don’t touch it until all the lights go off.

sudo apt update
sudo apt -y dist-upgrade
sudo apt install -y git cpufrequtils locales lsb-release
sudo dpkg-reconfigure locales

en_US.UTF-8
cd /opt/scripts && git pull && cd ~
sudo /opt/scripts/tools/update_kernel.sh --kernel 4.19.94-bone-rt-r43
sudo nano /boot/uEnv.txt

dtb=am335x-boneblue.dtb
dtb_overlay=/lib/firmware/BB-I2C1-00A0.dtbo

#uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo

uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo

sudo sed -i 's/GOVERNOR="ondemand"/GOVERNOR="performance"/g' /etc/init.d/cpufrequtils
sudo nano /etc/default/ardurover

Setting the UDP IP to 255.255.255.255 lets any computer connect from any ip.

# WiFi Telemetry
SERIAL0="-A udp:255.255.255.255:14550"

# Radio Telemetry1 (UART1 - "UT1")
SERIAL1="-C /dev/ttyS1"

# GPS1 (UART2 - "GPS")
SERIAL3="-B /dev/ttyS2"

# Radio Telemetry2 (UART0 - "UT0")
SERIAL2="-D /dev/ttyS0"

# Radio Telemetry3 (UART5 - "UT5")
SERIAL4="-E /dev/ttyS5"
sudo nano /lib/systemd/system/ardurover.service
[Unit]
Description=ArduRover Service
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device
StartLimitIntervalSec=0
Conflicts=arducopter.service arduplane.service antennatracker.service

[Service]

ExecStartPre=-/usr/bin/ardupilot/aphw
EnvironmentFile=/etc/default/ardurover
ExecStart=/usr/bin/ardupilot/ardurover $SERIAL0 $SERIAL1 $SERIAL3  $SERIAL2  $SERIAL4
Restart=on-failure
RestartSec=1

[Install]
WantedBy=multi-user.target
sudo mkdir -p /usr/bin/ardupilot

sudo wget -O /usr/bin/ardupilot/ardurover https://firmware.ardupilot.org/Rover/stable/blue/ardurover
OR
sudo wget -O /usr/bin/ardupilot/ardurover https://firmware.ardupilot.org/Rover/latest/blue/ardurover

sudo chmod 0755 /usr/bin/ardupilot/ardurover
sudo systemctl enable ardurover.service
cd ~
mkdir scripts
sudo ln -s /home/debian/scripts /scripts

sudo nano /usr/bin/ardupilot/aphw

#!/bin/bash
# aphw
# ArduPilot hardware configuration.

/bin/echo 80 >/sys/class/gpio/export
/bin/echo out >/sys/class/gpio/gpio80/direction
/bin/echo 1 >/sys/class/gpio/gpio80/value
/bin/echo pruecapin_pu >/sys/devices/platform/ocp/ocp:P8_15_pinmux/state

/sbin/ip link set up can0 type can bitrate 1000000
sudo chmod 0755 /usr/bin/ardupilot/aphw
sudo systemctl mask serial-getty@ttyO0.service
sudo systemctl mask serial-getty@ttyS0.service

sudo reboot

once you have everything working run this and reboot to cpy it to the SD card as a backup

sudo opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh

I wish i bought one of these years ago…

also discovered since its a linux flight controller its compatible with all the cool networking features being added.

Did you check for newer debian images?
I thought I fixed most of the stuff in early 2024 before frying my board.
It looks like you are using debian 10.x image.

Everything I found online said there was issues with newer versions.

OK, I thought it was just the devicetree that was completely broken after kernel 5.4. The PRU overlays did not work IIRC but I managed to get PWM and Motors working with debian 12.

1 Like

I dont use the pwm output, i use mavlink for all my outputs but i tested and it doesnt seem like pwm is working, i will look into it more.

I have ran into an issue with canbus acting weird. its showing devices on it but the GPS is saying no fix and the led isnt coming on. I think it could be related to this missing resistor. I dont have any 120ohm resistors so I ordered some.


it takes a really long time for its name to show


its getting a fix there just isn’t any data coming through.

I got the PWM output working, I think the issue was I had some outputs set to gpio, they were set because I restored a backup, once I disabled all the outputs I wasn’t using the PWM started functioning.

CANBUS GPS is working !!!

I tried enabling NTRIP just to see what would happen and it immediately changed to 3d fix !

ok this is really weird, if i stop ntrip the gps stops sending data.. other than this one little issue everything is now working.

ok setting CAN_D1_UC_OPTION to ClearDNADatabase fixed the GPS problems, its all working apart from the led on the GPS.

I have also discovered that the SBUS input is sketchy AF, if its not connected to anything it just detects random values on every channel. it was arming and disarming on its own.

Relay output is working on the GP0 connector with, I tried setting them to buttons but it wouldn’t start up when i did that.

GPIO1_25 = pin 57
GPIO1_17 = pin 49
GPIO3_20 = pin 116
GPIO3_17 = pin 113

Ok I suspect I found the issue with my CAN GPS…

I’m actually surprised it worked at all, rather than spend more time getting canbus working at the moment i have just disconnected the RC telemetry and connected the GPS over Serial, I have a second controller and GPS I will continue to look at but for now this is working good enough for me.

1 Like