BeagleBone Black: USB errors when using Webcam - linux

I want to use my BeagleBone Black to setup a Webcam. I installed fswebcam and configured it to take a picture every 10 seconds. However, the BeagleBone produces the following errors in dmesg every few minutes:
dmesg | tail -n 3
-> [ 220.258214] musb_host_rx 1762: Rx interrupt with no errors or packet!
-> [ 490.302277] musb_ep_program 896: broken !rx_reinit, ep13 csr 0003
-> [ 490.308731] musb_host_rx 1762: Rx interrupt with no errors or packet!
After a few hours (at most!) it freezes up completely and I have to power-cycle it. (The power-button doesn't shut it down anymore.)
This error has been bugging me for weeks. I tried all possible configurations I can think of:
Three different Beaglebones: Two revision A5A and one revision A5C
Five different Power supplies: Three via USB, two via Barrel connector
Three different Webcams: One Logitech C920, one HP 3100, one no-name El-Cheapo
Two different Linux distributions: The current ArmHF Ubuntu 14.04 distribution and the currently linked debian distribution on the official "latest images" page (which is a few months behind!). I updated the Kernel of the latter image using the appropriate script in /opt/scripts - but that did not help either.
I installed fswebcam through package managers and compiled it from source.
For fswebcam I tried various config files (including delays and skipping images). One example config file that I tried:
background
loop 10
resolution 1920x1080
scale 1280x720
title "test-picture"
timestamp "%d.%m.%Y %H:%M:%S (%Z)"
jpeg 70
banner-colour #FF000000
line-colour #FF000000
no-shadow
save ~/test-picture.jpg
How can I keep my BeagleBone Black from crashing?
Update: I finally got it to work using a (borrowed) Rev A5C BeagleBone. I still get the dmesg errors, but at least the BeagleBone does not crash. I currently suspect a hardware issue on the RevA5B BeagleBone.

Related

Network booted RPi3 can't find 1wire devices

Currently trying to implement a net-booted RPi3b+ network and there is an auxiliary board to these pi's I've had printed. The auxiliary board has a classic DS18B20 among other things to monitor the temperature of the box the rpi and aux board are contained in.
The issue is, when I use a netbooted pi I cannot get any devices to show up (including the w1_bus_master1) when I access /sys/bus/w1/devices. See below,
pi#raspberrypi:/etc $ cd /sys/bus/w1/devices/
pi#raspberrypi:/sys/bus/w1/devices $ ls -l
total 0
I know that my circuit is correct as it works when I boot the RPi from an SD card with the same image of raspbian as the netbooted image. On the netbooted rpi I see the 1-wire processes running for w1-therm and w1-gpio.
lsmod
Module Size Used by
w1_therm 16384 0
w1_gpio 16384 0
wire 40960 2 w1_gpio,w1_therm
My netbooting process roughly follows this tutorial,
https://blockdev.io/network-booting-a-raspberry-pi-3/
I have a NFS mount which holds the config.txt file containing the
dtoverlay=w1-gpio,gpiopin=4
I'm pulling my hair out a bit here, really would like to maintain the netbooting capability as this implementation is preferred to last and is across 30+ pi's, don't want to be pissing about the sd cards.
Cheers

Beaglebone Black Custom Audio Cape DMA/IRQ trouble

I'm running a BBB straight out of the box running debian. Kernel version is 3.8.13-bone-47.
I'm working with a cape that is very similar to the one here. The difference is that I'm using a TLV320AIC3106 instead of the AIC3104, and I only have enabled the audio out, I'm not interested in recording audio in this application.
My pinout for my application is identical to the cape in the link above.
I've followed the link here to get the cape up and running. Everything that I have matches the output of the tutorial up until I try and play a sample wave file.
When I play a sample wave file, I get the following message: aplay: pcm_write:1710: write error: Input/output error
Running dmesg gives me ALSA sound/core/pcm_lib.c:1010 playback write error (DMA or IRQ trouble?)
Where I'm having trouble is I don't understand how the DMA is coming in to play. Is this a DMA problem? Is it a symptom of something else going wrong like my I2C? Am I missing a configuration somewhere else?
Any thoughts on how to track this down are appreciated.
I realize it has been covered in multiple places before, but it can never be stressed enough. Make sure that when you're sending out information, make sure it goes to the right address over the I2C. I figured out this morning that the audio codec was at address 0x1B, while the driver was addressed to 0x18. Small but critical difference.
The easy fix is to edit the BB-BONE-AUDI-02-00A0.dts file.
Edit line 65 to <0x1B>. Re-compile using the line: dtc -O dtb -o BB-BONE-AUDI-02-00A0.dtbo -b 0 -# BB-BONE-AUDI-02-00A0.dts
move the generated file to the /lib/firmware directory
Insert it using echo BB-BONE-AUDI-02 > /sys/devices/bone_capemgr*/slots
After applying this simple fix it seems to work. I can't say for certain because I have to get the audio amplifier circuit up and running still. At least aplay will play the file without crashing out on me, which is a start.

UART doesn't work on BeagleBoneBlack running Ubuntu 14.04

I have been working for a few days trying to get the UART1 port to work on a bbb. I flashed the prebuilt kernel from the elinux wiki (http://www.elinux.org/BeagleBoardUbuntu#Flasher), and the UART1 appears in the /dev folder (as /dev/ttyO1, with a capital "o" not a zero), but when I write to it, nothing comes out of the pins. I can use UART0 (on a separate little serial header, but not the one I need) without any trouble.
I see a lot of tutorials for enabling UART1 that deal with a folder called /sys/devices/bone_capemgr.* but I don't have one. I think it is because I have a newer kernel, and nearly all of those tutorials are exclusively for older kernels (<=3.8).
I read that the current 3.13 images from Robert C Nelson don't have a cape-manager (https://groups.google.com/forum/m/#!topic/beagleboard/ND3_w7_dn8Q), and you can use the "really simple cape manager" (https://github.com/RobertCNelson/rscm), but the build.sh script doesn't work on my 3.14 kernel. I tried to change a path in the script to fix it and now that bbb won't boot.
I also tried the beaglebone-universal-io script (
https://github.com/cdsteinkuehler/beaglebone-universal-io) but when I query the relevant pin:
sudo ./config-pin -q P8_26
I get the error:
P8_26 pinmux file not found!
Please verify your device tree file
Am I missing something really simple here?

installing Angstrom on Beaglebone black

I am a newbie in Beaglebone Black, I install Ubuntu on my Beaglebone Black which works fine, Now I am trying to install Angstrom on Beaglebone Black, for this I first of all download image of Angstrom "Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.08.21.img" , then extract it using "7Zip" , after that I use "Win32 Disk Imager" to copy it into a 16 GB SD card.Now insert my SD card in Beaglebone Black. Then I press boot button and after that I provide power supply using 5v and 1 Amp adapter. After making sure that all four LED's are glowing , I release boot button.
Now the problem is the installation should be completed in around 45 minute and all four LED's should become stable , but in my case LED's keeps blinking. I check it more than four times for around more than one and a half hour and after that I take out the power supply and check Beaglebone Board on my desktop monitor, surprisingly Ubuntu is Still there.So, please tell where is the problem.
Use this file "BBB-eMMC-flasher-2013.09.04" under BeagleBone Black (eMMC flasher) for flashing to eMMC
I had also installed Angstrom on BeagleBoard Black.
You should follow derek molloy tutorial. Here is the link to tutorial
It should boot up in 10 seconds. It will not take 45 minute to boot up if properly installed.

Duplicating identical BeagleBone Black setups

After having set-up and customized my "master" BeagleBone Black (BBB) with applications etc. on the on-board eMMC, I want to duplicate it on other BBB boards.
What is the best way to duplicate the BBB?
My understanding of options:
SD-Card: Programming each board by inserting a prepared SD card containing an image and pressing the "boot" switch while powering up.
How should I prepare that .img file or the SD card from my master BBB?
The image should copy to the on-board eMMC, so that the SD-card can be removed afterwards.
USB: Programming by connecting the board over USB to a (Win7) PC.
Is it possible to write the full on-board eMMC from the PC?
With which app to do the writing?
How to prepare the image which will be written, starting from the master BBB?
Ethernet: Programming over LAN after boot-up with default angstrom distro.
Is it even possible over LAN?
How to do the writing?
How to prepare the image which will be written, starting from the master BBB?
Which is possible/best?
Edit: My current solution is to flash with a standard image (from the BeagleBoe website) and then have a script do all modifications as expected. This includes disabling many services I don't need, installing applications and configuring stuff etc.
If there is an easier way for making a SD card with a full image on it, I'm still interested.
As noted at the bottom of the eLinux article, there is a much easier way if you are running the Debian distribution:
Boot master BBB with no SD card in
Insert SD card
Log in (e.g. with serial terminal, SSH etc.) and run sudo /opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh. LEDs will flash in sequence whilst SD card is being written.
When the LEDs stop and the script terminates, remove the SD card.
Insert SD card into new BBB then power on.
eMMC will be flashed; LEDs on new BBB will flash in sequence until complete.
For anyone else that needs this, the best answer I've found to this is to do the following:
First setup your master Beaglebone Black the way you want it.
Backup the eMMC
FAT format a 4GB or larger SD card (must be a MBR/bootable formatted microSD card)
Download beagleboneblack-save-emmc.zip and extract the contents onto your SD card
Note: this is an image from Jason Krinder at his github https://github.com/jadonk/buildroot using the save-emmc-0.0.1 tag
Put the card into your powered off Beaglebone Black
Power on your Beaglebone Black while holding the S2 Button
The USR0 led will blink for about 10 minutes, when it's steady on you have an SD card with a copy of your eMMC in a .img file
Use the eMMC to flash a new Beaglebone Black
On the SD card edit autorun.sh
#!/bin/sh
echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger
dd if=/mnt/<image-file>.img of=/dev/mmcblk1 bs=10M
sync
echo default-on > /sys/class/leds/beaglebone\:green\:usr0/trigger
where <image-file> is the image file you got after copying backing up your eMMC
Insert the card into your powered off Beaglebone Black
Power on your Beaglebone Black while holding the S2 Button
The Beaglebone Black should go into rebuilding mode and within about 20 minutes you'll have a newly flashed Beaglebone Black (when all 4 USR LEDs are solid) with a copy of your original
eLinux reference used for this article - http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents
I have the same need and am using dd and nc (NetCat) to save directly on my desktop without having to use an intermediary SD Card. You can do this over the USB connection, or ethernet connection, by changing the IP address in the steps below.
After setting up your BBB with the applications you want, the basic steps are:
On the desktop, run this command in a terminal:
nc -l 19000|bzip2 -d|dd bs=16M of=BBB.img
On the BeagleBone Black, run this command in a terminal (you can SSH into it, or do it directly from the BBB):
dd bs=16M if=/dev/mmcblk0|bzip2 -c|nc 192.168.7.1 19000
The 192.168.7.1 address is for the USB connection. (BBB is 192.168.7.2) If you're doing this over an ethernet connection, you should use your desktop's IP address.
This is taken from instructions here.
Finally, follow any method to install onto the next BBB. Here's an example of how to flash the emmc.
Copying your emmc Image back to a SD card is a bit tricky, since it will need to be formated in a certain way to get it to mount. Here are some tips to get that working: http://dev.gentoo.org/~armin76/arm/beagleboneblack/install_emmc.xml#expand
What might be easier is using an USB thumb drive, or USB SD card reader. Note, currently there are some issues hot-plugging USB devices, so boot with it plugged in.
You can copy your entire FS to the USB drive, then compress it. Create a new bootable linux sd image, and put your compressed FS on there and use one of the scripts Ottavio linked to to copy over the compressed image. you can make a systemd service to launch the script on startup.
We have noticed that on Beaglebones with the Jan 23rd 2015 release of Debian, the only way to successfully copy the image from SD is not to hold the boot button down when powering up.

Resources