Disabling UART0 for console output and use it for general-purpose on pocketbeagle - beagleboneblack

I am using a debian image running on the pocketbeagle (the smaller version of the beaglebone). I can't seem to figure out how to disable the UART0 for console debugging and use it for my own purposes.
When I type:
dmesg | grep tty
I get the following:
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet
[ 0.002567] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[ 1.446237] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
[ 1.459149] console [ttyS0] enabled
[ 1.460177] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a 8250
[ 1.461029] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 160, base_baud = 3000000) is a 8250
[ 1.462034] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 161, base_baud = 3000000) is a 8250
I have tried looking at the uEnv.txt file in /boot but there's nothing related to UART0. This is what I found in uEnv.txt:
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.9.82-ti-r102
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_uio (4.4.x-ti, 4.14.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet video=HDMI-A-1:1024x768#60e
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
What should I do to use the UART0 on my pocketbeagle? I can't seem to find any documentation about it whatsoever.

I don't think you will find a good answer by looking in the bootloader, device tree, or kernel. I think the ideal way to solve this problem is by configuring the operating system.
I did this with a pocketbeagle using debian 9.9, which uses systemd. It turns out that two systemd services interfere with uart0: serial-getty#ttyO0.service and serial-getty#ttyS0.service. systemd lets you force disable a service using mask. This only has to be done once. so 'systemctl mask serial-getty#ttyO0.service' and 'systemctl mask serial-getty#ttyS0.service' should do it. Note that before using ttyO0 you may have to manually configure a serial port. I did it with a c program and a library called termios, but there's probably a way to do it on the command line.
to verify my answer, you can investigate the /etc/systemd/system directory and run 'systemctl list-units --type=service' to see what's running on your system. more information about systemctl is here: https://www.tecmint.com/list-all-running-services-under-systemd-in-linux/

Related

Enable HDMI output for AM3358 Debian 10.3 2020-04-06 4GB SD IoT (BeagleBone Black) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
I am trying to get my BeagleBone Black to post to my monitor, to be able to use it as a stand-alone PC.
This was possible with the image that the BeagleBone shipped with.
I have just installed a new image on my BeagleBone Black Rev C.
The new image is AM3358 Debian 10.3 2020-04-06 4GB SD IoT.
I am able to SSH to it using PuTTY, and this way I have succesfully performed some actions with it, like using wget to download files from Google Drive etc.
So it seems like the board is working well, and that the HDMI output is disabled somewhere.
I have copied the contents of the uEnv.txt-file below, to show that the lines regarding disabling of video are commented out:
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r42
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768#60e
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Furthermore, the contents of /opt/scripts/tools/version.sh
git:/opt/scripts/:[a335abcf87d2ef5fd96e7de83cdf3f0ff5a4da2b]
eeprom:[A335BNLT00C02128SBB11942]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot SPL 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500)]:[location: dd MBR]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-gc9b3922522]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2019.04-00002-g07d5700e21 (Mar 06 2020 - 11:24:55 -0600)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0.bb.org-overlays]
kernel:[4.19.94-ti-r42]
nodejs:[v10.24.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~buster+20210821]
pkg:[bb-customizations]:[1.20211215.2-0~buster+20220102]
pkg:[bb-usb-gadgets]:[1.20220112.3-0~buster+20220112]
pkg:[bb-wl18xx-firmware]:[1.20211222.2-0~buster+20211222]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768#60e]
dmesg | grep remote
[ 43.365021] remoteproc remoteproc0: wkup_m3 is available
[ 43.467266] remoteproc remoteproc0: powering up wkup_m3
[ 43.467297] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 43.474100] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 45.923727] remoteproc remoteproc1: 4a334000.pru is available
[ 45.927100] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 45.923727] remoteproc remoteproc1: 4a334000.pru is available
[ 45.923942] pru-rproc 4a334000.pru: PRU rproc node pru#4a334000 probed successfully
[ 45.927100] remoteproc remoteproc2: 4a338000.pru is available
[ 45.927243] pru-rproc 4a338000.pru: PRU rproc node pru#4a338000 probed successfully
dmesg | grep pinctrl-single
[ 0.949255] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 1.475029] pinctrl-single 44e10800.pinmux: pin PIN108 already requested by ocp:A15_pinmux; cannot claim for 0-0070
[ 1.485668] pinctrl-single 44e10800.pinmux: pin-108 (0-0070) status -22
[ 1.492351] pinctrl-single 44e10800.pinmux: could not request pin 108 (PIN108) from group nxp_hdmi_bonelt_pins on device pinctrl-single
dmesg | grep gpio-of-helper
[ 0.962575] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
I solved the problem, following a solution found here.
The solution was to run a kernel update:
sudo /opt/scripts/tools/update_kernel.sh
So the real hero here is RobertCNelson who provided that answer.

About Beaglebone Black CAN protocol setting

Thank you for watching this.
I'm having difficulties with my BBB on CAN communication like for months...
I'd be really pleased if you could give me just a little help!
I'm working on CAN protocol between BBB and another CAN device.
The another device is confirmed to be working alright with CAN.
I'm using my BBB with Cloud9 platform on windows laptop,
and on the another device, it's using CAN0.
I have set the 'config-pin' on BBB like below using CAN1, and I tried 'cansend' utility.
The bitratre value on the another device is also set to be equal.
config-pin p9.24 can
config-pin p9.26 can
ip link set can1 up type can bitrate
cansend can1 300#AC.AB.AD.AE.75.49.AD.D1
Yet it still seems like there is no CAN packets being sent or received.
(That receiving code is written in additional info. )
Plus, I tried to catch some signal with oscilloscope machine, but I couldn't get a thing at all.
Then, I modified some lines of uEnv.txt like below, located inside the boot folder of BBB.
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-CAN0-00A0.dtbo
uboot_overlay_addr5=/lib/firmware/BB-CAN1-00A0.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
But CAN still does not work, and config-pin command after this uEnv.txt setting shows error like below
debian#beaglebone:/lib/firmware$ config-pin -q p9.24
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_24_pinmux/state failed, No such file or directory
I truly suspect there might be something wrong with the driver or pinmux setting,
because the code did work well in other situations.
The same messages for the other overlayed pins. Actually any config-pin commands don't work on these pins. (And of course the CAN bus is still not working)
I'm currently using the latest AM3358 Debian 10.3 (2020-04-06) SD IoT image, and packages seems to be all updated well. The image is flashed and no SD card is in.
I really appreciate you read this. Thank you!
Additional Info:
CAN receive part code
#include <linux/can.h>
#include <linux/can/raw.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
int InitCanInterface(const char *ifname){
    int sock = socket(PF_CAN, SOCK_RAW, CAN_RAW);
    fcntl(sock, F_SETFL, O_NONBLOCK);
    if (sock == -1){
        printf("Fail to create CAN socket for %s - %m \n", ifname);
        return -1;
    }
    printf("Success to create CAN socket for %s\n", ifname);
    struct ifreq ifr;
    strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
    int ret = ioctl(sock, SIOCGIFINDEX, &ifr);
    if (ret == -1){
        perror("Fail to get CAN interface index");
        return -1;
        }
    printf("Success to get CAN interface index: %d\n", ifr.ifr_ifindex);
    struct sockaddr_can addr;
    addr.can_family = AF_CAN;
    addr.can_ifindex = ifr.ifr_ifindex;
    ret = bind(sock, (struct sockaddr*)&addr, sizeof(addr));
    if (ret == -1){
        perror("Fail to bind CAN socket -");
        return -1;
    }
    printf("Success to bind CAN socket\n");
    return sock;}
    int TransmitCanFrame(const int sock, const uint32_t id, const uint8_t *data, const size_t data_len){
        struct  can_frame frame;
        frame.can_id = id & 0x1ffffff;
        frame.can_id |= (1<<31);
        memcpy(frame.data, data, data_len);
        frame.can_dlc = data_len;
        int tx_bytes = write(sock, &frame, sizeof(frame));
        if (tx_bytes == -1){
            perror("Fail to transmit CAN frame -");
            return -1;
        }
        printf("Success to transmit CAN frame - %d bytes is transmitted\n", tx_bytes);
        return 0;
    }
#define CAN_FRAME_MAX_LEN 8
int ReceiveCanFrame(const int sock){
    struct can_frame frame;
    int rx_bytes = read(sock, &frame, sizeof(frame));
    if (rx_bytes < 0){
        //perror("Fail to receive CAN frame -");
        return -1;
    }
    else if (rx_bytes < (int)sizeof(struct can_frame)){
        printf("Incomplete CAN frame is received - rx_bytes: %d/n", rx_bytes);
        return -1;
    }
    else if (frame.can_dlc > CAN_FRAME_MAX_LEN){
        printf("Invalid dlc: %u\n", frame.can_dlc);
        return -1;
    }
    if (((frame.can_id >> 29) & 1) ==1) {
        printf("Error frame is received\n");
    }
    else if (((frame.can_id >> 30) & 1) ==1) {
        printf("RTR frame is received\n");
    }
    else {
        if (((frame.can_id >> 31) & 1) == 0){
            printf("11bit long std CAN frame is received\n");
            printf("%#x\n",frame.can_id);
        }
        else {
            printf("29bit long ext CAN frame is received\n");
            printf("%#x\n",frame.can_id & 0x0001fffffff );
        }
    }
    for (int ii=0; ii<8; ii++) {
        printf("0x%X ", frame.data[ii]);
    }
    printf("\n");
    printf("\n");
    return 0;
}
int main(){
    int sock = InitCanInterface("can0");
    if (sock < 0 ){
        return -1;
    }
    // uint8_t can_data[CAN_FRAME_MAX_LEN] = {};
    while(1) {
    //printf("hello\n");
    //printf("%d",ReceiveCanFrame(sock));
    //if(ReceiveCanFrame(sock) == 0)
        //printf("No response\n");
    ReceiveCanFrame(sock);
    sleep(1);    
    }    
    return 0;
}
uname -a outputs
debian#beaglebone:/lib/firmware$ uname -a
Linux beaglebone 4.19.94-ti-r64 #1buster SMP PREEMPT Fri May 21 23:57:28 UTC 2021 armv7l GNU/Linux
debian#beaglebone:/lib/firmware$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[e8ae28ccc34a177e9435a0d24cdf8421e081c19a]
eeprom:[A335BNLT00C00620BBBK11BC]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2019.04-00002-g07d5700e21 (Mar 06 2020 - 11:24:55 -0600)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
UBOOT: Loaded Overlay:[BB-CAN0-00A0]
UBOOT: Loaded Overlay:[BB-CAN1-00A0]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0]
kernel:[4.19.94-ti-r64]
nodejs:[v10.24.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-CAN0-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr5=/lib/firmware/BB-CAN1-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210416.0-0~buster+20210416]
pkg:[bb-customizations]:[1.20210708.0-0~buster+20210708]
pkg:[bb-usb-gadgets]:[1.20200504.0-0~buster+20200504]
pkg:[bb-wl18xx-firmware]:[1.20210520.0-0~buster+20210520]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 65.289088] remoteproc remoteproc0: wkup_m3 is available
[ 65.320630] remoteproc remoteproc0: powering up wkup_m3
[ 65.320664] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 65.320951] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 68.227786] remoteproc remoteproc1: 4a334000.pru is available
[ 68.241566] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 68.227786] remoteproc remoteproc1: 4a334000.pru is available
[ 68.227985] pru-rproc 4a334000.pru: PRU rproc node pru#4a334000 probed successfully
[ 68.241566] remoteproc remoteproc2: 4a338000.pru is available
[ 68.241750] pru-rproc 4a338000.pru: PRU rproc node pru#4a338000 probed successfully
dmesg | grep pinctrl-single
[ 0.943044] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 0.956633] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
dmesg for CAN
debian#beaglebone:/lib/firmware$ dmesg | grep can
[ 1.205500] c_can_platform 481cc000.can: c_can_platform device registered (regs=3377e4b7, irq=42)
[ 1.206878] c_can_platform 481d0000.can: c_can_platform device registered (regs=292aef38, irq=43)
[ 1.422353] can: controller area network core (rev 20170425 abi 9)
[ 992.007971] c_can_platform 481d0000.can can1: setting BTR=2701 BRPE=0000
[ 992.016624] IPv6: ADDRCONF(NETDEV_UP): can1: link is not ready
[ 992.017512] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
The full uEnv.txt
debian#beaglebone:/lib/firmware$ cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r64
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-CAN0-00A0.dtbo
uboot_overlay_addr5=/lib/firmware/BB-CAN1-00A0.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768#60e
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Some help on can or socketCAN will be found here for the BBB or other family board:
https://www.beyondlogic.org/adding-can-to-the-beaglebone-black/
Also:
https://github.com/craigpeacock/CAN-Examples
These examples are a bit older and I have noticed that the Linux Distro on the BBB, if getting it from bbb.io/latest-images , is going through an overhaul.
For instance, I have noticed that the config-pin utility still works but that some of their overlays and DeviceTrees for the BBB peripherals are being sent into mainline, esp. for the BBAI.
When those examples do not help you configure the, and those examples are not mine but I figured they would help, socketCAN on Linux, please reply. I am working on a simple CAN interface from those examples and while using Linux is helpful, some things like the Device Trees are in a mode of change and I think this goes along w/ config-pin too.
For instance...
If you go to their forum at forum.beagleboard.org, you will see some people from GSOC working on examples from config-pin utilities to PRU cores which will be helpful for people getting into the shared memory, microcontroller game.
Here is the config-pin idea I found on their forum page:
https://forum.beagleboard.org/t/beagle-config-logs/30174
I have set up CAN on debian 10.3 (Buster) on beaglebone black.
I left uEnv.txt as default and issued these commands (as root) to enable CAN:
config-pin p9.24 can
config-pin p9.26 can
ip link set can1 up type can bitrate 1000000
candump can1
Once this is working, you can automate this setup using uEnv.txt and /etc/network/interfaces as descibed here - https://www.beyondlogic.org/adding-can-to-the-beaglebone-black/ and here - https://www.thomas-wedemeyer.de/beaglebone-canbus-python.html
If this doesnt work, I'd suggest ensuring there is no other software or updates installed that could be messing this up - try a fresh debian install on another SD card, and ensuring the hardware - the bus driver and wiring is ok.
I solved BBB CAN problem just by changing transceiver board into another one.
Don't use cjmcu-230 CAN transceiver board. I use the one from Waveshare. https://www.waveshare.com/sn65hvd230-can-board.htm
Both CAN transceiver board use same SN65HVD230 chip, but it seems that there is some ground pin circuit issue inside the cjmcu-230 board.
Hope you don't waste your time if you have this issue.

U-Boot writes incorrect CRC in env

I'm using u-boot on raspberry pi 4, A/B booting from USB attached SSD, integrated with mender without yocto. Everything works fine except the env saving: initially configured to use MMC and offsets, fw_printenv complained about a bad CRC and output the default config instead. I changed the env saving to FAT files on the boot partition, and I'm now troubleshooting 2 issues:
uboot.env does not get written by issuing saveenv in the u-boot prompt
uboot-redund.env gets written but its CRC is incorrect.
I'm checking the CRC by issuing the fw_printenv command from linux. Its config file states:
/boot/u-boot/uboot-redund.env 0x0000 0x4000
U-Boot is compiled with 0x4000 as env size, and using hexdump to check the file shows a correct file with a length of 0x4000.
When booting up, u-boot outputs the following log over TTL serial:
U-Boot 2021.07-rc2-00246-gd64b3c608d-dirty (Jun 16 2021 - 12:16:24 +0200)
DRAM: 7.9 GiB
RPI 4 Model B (0xd03114)
MMC: mmcnr#7e300000: 1, emmc2#7e340000: 0
Loading Environment from FAT... In: serial
Out: vidconsole
Err: vidconsole
Net: eth0: ethernet#7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 3 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot: 0
which shows that u-boot does load the env from FAT correctly.
How can I investigate further why u-boot does not write uboot.env, and why when it does write uboot-redund.env, writes it with a wrong CRC from fw_printenv's point of view?
env save
In function env_fat_save only one file is written. If CONFIG_SYS_REDUNDAND_ENVIRONMENT is defined, alternatively either file CONFIG_ENV_FAT_FILE_REDUND or file CONFIG_ENV_FAT_FILE is written.
You have to execute the command env save twice if you want to write both files.
Command env infoindicates which instance was written last via field env_valid:
=> env select FAT
Select Environment on FAT: OK
=> env info
env_valid = invalid
env_ready = true
env_use_default = false
=> env save
Saving Environment to FAT... OK
=> env info
env_valid = redundant
env_ready = true
env_use_default = false
=> env save
Saving Environment to FAT... OK
=> env info
env_valid = valid
env_ready = true
env_use_default = false
=>
fw_printenv
When using fw_printenv you must specify the configuration which matches your U-Boot build. By default file /etc/fw_env.config is used. You can pass the configuration file on the command line:
tools/env/fw_printenv -c fw_env.config
This is what your configuration file could look like:
uboot.env 0x0000 0x2000
uboot-redund.env 0x0000 0x2000
There is an example file in tools/env/fw_env.config explaining the available fields.

Buildroot - RPI3 - Find the BCM43438 firmware to enable wireless

i'm a beginner.
i use a RPI3 and a buildroot build system and try to enable wireless.
I followed several links without success.
In particulary, i followed this link : https://delog.wordpress.com/2014/10/10/wireless-on-raspberry-pi-with-buildroot/
and verify my linux kernel wireless options are activated, but no results.
However, the options i used on the buildroot . config file seems to be good :
debian-host:/build/buildroot# egrep -i "wireless|wpa|80211" .config
# BR2_PACKAGE_WIRELESS_REGDB is not set
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WIRELESS_TOOLS_LIB=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_NL80211=y
BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y
BR2_PACKAGE_WPA_SUPPLICANT_WIFI_DISPLAY=y
# BR2_PACKAGE_WPA_SUPPLICANT_MESH_NETWORKING is not set
BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y
BR2_PACKAGE_WPA_SUPPLICANT_EAP=y
BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT=y
BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y
BR2_PACKAGE_WPA_SUPPLICANT_WPS=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
# BR2_PACKAGE_WPA_SUPPLICANT_DBUS_OLD is not set
# BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW is not set
BR2_PACKAGE_WPAN_TOOLS=y
I installed a minibian an another rpi3, i noticed a firmware was used and i installed it by a :
apt-get install firmware-brcm80211
If the firmware is not installed, I noticed that iwlist wlan0 scan have empty results. On my RPI3-buildroot-system, after booting, lsmod show no modules.
I need to load manually by modprobe or by /etc/modules. So i load the same modules used on minibian, so i did (i loaded bluetooth mods also)
uname -a
Linux pi3 4.9.13-rt12-v7 #1 SMP Mon Mar 20 14:04:21 CET 2017 armv7l GNU/Linux
pwd
/lib/modules/4.9.13-rt12-v7/kernel/drivers
find . -name "*brcm*.ko"
./net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
./net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
modprobe 8192cu
modprobe brcmfmac
modprobe brcmutil
modprobe hci_uart
modprobe bnep
and the lsmod show :
lsmod
Module Size Used by Not tainted
8192cu 581125 0
hci_uart 19956 0
btbcm 7992 1 hci_uart
bnep 12051 0
bluetooth 364941 3 hci_uart,btbcm,bnep
brcmfmac 222136 0
brcmutil 9156 1 brcmfmac
cfg80211 543530 1 brcmfmac
rfkill 20944 2 bluetooth,cfg80211
ipv6 405794 18 [permanent]
but
iwlist wlan0 scan
wlan0 Interface doesn't support scanning.
I don't arrive to have the same result as my minibian distro with my apt-get ..
What is the way to retrieve the buildroot process to have the same result that on my minibian ?
I've forget something ?
Thanks for helping me.
When using make menuconfig, enable rpi-wifi-firmware under Target packages > Hardware handling > Firmware to include the firmware files.
For WiFi on the Raspberry Pi, you need to enable the following packages in your defconfig file :
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_RPI_WIFI_FIRMWARE=y
If you want to reference any other things, I have an older buildroot external tree here for the Raspberry Pi.

portaudio pa_devs report 0 device

My system is ubuntu 15.10. I am very sure my audio works,
arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 2: ALC887-VD Alt Analog [ALC887-VD Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
but pa_devs, which is a official provided execuatble file in portaudio, reports 0 device as below,
PortAudio version number = 1899
PortAudio version text = 'PortAudio V19-devel (built Jan 30 2016 19:22:45)'
Number of devices = 0
And I can get devices number with pyAudio
import pyaudio
pa = pyaudio.PyAudio()
print(pa.get_default_input_device_info())
print(pa.get_device_count())
--- output ---
{'defaultHighInputLatency': 0.034829931972789115, 'maxInputChannels': 32, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'defaultSampleRate': 44100.0, 'hostApi': 0, 'structVersion': 2, 'maxOutputChannels': 32, 'defaultHighOutputLatency': 0.034829931972789115, 'name': 'default', 'index': 6}
7
Should I install something or re-built portaudio with some special settings? Thanks!
I ran into this exact same problem. It was because portaudio was built with only support for OSS. You need to build it with ALSA support. Note that even if you specify --with-alsa to the ./configure script it still "succeeds" even if it can't find ALSA - you have to manually check the configuration summary for a line like this:
ALSA ........................ no
(Don't you love autotools?)
Anyway do this:
sudo apt-get install libasound2-dev
./configure
And so on. I unfortunately couldn't find a way to get pa_devs to list what backends it supports, so you just have to guess this is the problem and try it. Worked for me anyway!

Resources