Beaglebone Black – unload cape - beagleboneblack

I am using a Beaglebone Black with the most recent OS (Debian Jessie, kernel v4.1). I need to be able to use pin P9_19 as a GPIO pin, but pin 19 has already been assigned to I2C_2_SCL.
When I try to use it, I get the error (octalbonescript):
The pin P9_19 is not availble to write. Please make sure it is not used by another cape.
How can I unload the I2C cape to expose pin P9_19 for GPIO access?

There are many ways to do that.
Using device tree overlay: echo cape-universaln dtbo file to slots
or use this link to gernerate overlay file for gpio purpose, compile source dts file using
dtc -O dtb -o /lib/firmware/bspm_P9_19_17-00A0.dtbo -b 0 -# /lib/firmware/bspm_P9_19_17-00A0.dts
and then deploy output dtbo file to /lib/firmware and then echo it to slots.
Also I personally recommend you to use this amazing library Wirigbone for beaglebone, this is by far best for beaglbone.

Related

how to write driver for MX 6 and TJA1100 PHY?

I am working on new costume board based on (i. MX 6Solo6DualLite).and I use (TJA1100 100BASE-T1 PHY) for Automotive Ethernet..
please correct me if my questions don't make sense, or I am in the wrong way.
I want to write driver for this device.. and make sure that it works correctly.
1- I can make sure that the driver works properly in the U-boot step, Right? I mean no need to load Linux kernel, so I have just to add source code C driver in U-boot source code and compile it. I want to do this in U-boot step, so I can limit the numbers of files that initialise all peripheriques, and make it simple as possible since that U-boot can behave like (mini-Os)
2-I don't know how to write this driver (exactly..), so I am looking for the driver (source code) that initialise the Ethernet Controller in any other processor , and initialise another typeof ethernet phy, in order to get an idea and write a similar driver source code for I.MX6 and TJA1100,?
after this i think that i could maybe add some very basic file c For simple Protocol like ARP, for test purpose..
3- is this good idea writing driver code by inspiring from another driver code source?
4 - maybe, if you already have a driver for (i. MX 6Solo6DualLite and TJA1100 100BASE-T1 PHY) can you provide to me please... ?
for my second question i tried to extract from U-boot source code the C file that initialise Ethernet Controller in AM335x, and initialise LAN8710A phy,(in beaglebone black) in order to get an idea and write a similar driver source code but i couldn't found it .. i found network C file for protocol .... but that's disturp me i couldn't seperate them from the real C file that initialise ethernet controller and ethernent Phy .
http://www.denx.de/wiki/U-Boot/SourceCode
There is a driver published on the NXP forum:
https://community.nxp.com/thread/460767
It includes both some bare metal code that should be usable with U-Boot and a Linux driver.

SPI on Beagleboard Black

I've been trying to make the serial communication work on my BBB for days now and I am running out of ideas.
When I use just the BBB and connect MISO/MOSI I get the signal transfer on MOSI, SCLK and CS (MISO is mainly at high level). However, when I connect the lines to my slave part it does not work. I checked the signals on the oscilloscope and they seem fine and the part which I am using as the slave is working well when I set it in parallel mode, so I believe some programming or configuration must be wrong.
This is basically what I do:
config-pin P9.17 spi_cs
config-pin P9.18 spi
config-pin P9.21 spi
config-pin P9.22 spi_sclk
python
from Adafruit_BBIO.SPI import SPI
spi = SPI(1,0) #I would expect SPI(0,0) here, but I get the signal on the above configured ports
Then I set the configurations (already tried in many ways):
spi.mode = 0
spi.cshigh = False
spi.msh = 10500000
spi.bpw = 16
spi.lsbfirst = False
After that I open it and try to send data:
spi.open(1,0)
spi.xfer2([1,254])
If anyone is interested, I am trying to program the LMH6517 as slave and I already tried to ask about this at the TI forum here:
https://e2e.ti.com/support/amplifiers/f/14/t/751415
Oscilloscope images:
CS and SCLK
MOSI and SCLK
MISO and SCLK
Thank you,
JPL

Beaglebone Black: How to turn pins on/off programatically?

I have a Beaglebone Black from which I use the some VCC pin. I need to programatically turn on/off VCC pins.
Say, the VCC pin number is #5, I am looking for some Linux command that will turn that particular pin on/off.
Is it possible via command line? or, there are some other way? is it possible at all?
please help.
What does you mean "VCC pin"?
You can't on/off VDD pins on connector P9 but tou can control GPIO pins (and switch power from VDD pins with an appropriate transistor).
From command line one can control GPIO via sysfs interface.
debian#beaglebone:$ cd /sys/class/gpio
debian#beaglebone:/sys/class/gpio$ ls
export gpio14 gpio26 gpio4 gpio48 gpio60 gpio68 gpiochip64
gpio112 gpio15 gpio27 gpio44 gpio49 gpio61 gpio69 gpiochip96
gpio114 gpio2 gpio3 gpio45 gpio5 gpio65 gpio7 unexport
gpio115 gpio22 gpio30 gpio46 gpio50 gpio66 gpiochip0
gpio116 gpio23 gpio31 gpio47 gpio51 gpio67 gpiochip32
You can see here directories for already exported GPIO pins and some additional files, see GPIO Sysfs Interface for Userspace
For example, I use GPIO49 (P9, pin 23) for LED control:
debian#beaglebone:/$ sudo su
root#beaglebone:/# cd /sys/class/gpio/gpio49
root#beaglebone:/sys/class/gpio/gpio49# cat direction
in
root#beaglebone:/sys/class/gpio/gpio49# echo out >direction
root#beaglebone:/sys/class/gpio/gpio49# echo 1 >value
root#beaglebone:/sys/class/gpio/gpio49# echo 0 >value
root#beaglebone:/sys/class/gpio/gpio49#
So that, you can control GPIO pins manually from command line, from bash script, and from any user-space program using file i/o.

Using GPIO3_13 (GPIO109) to disable USB VBUS

I found dev-USB-PWR-CTL-00A1.dtbo file. (I think this is source code for it).
Using this file I try to expose USB1_DRVVBUS pin as GPIO (GPIO3_13) with commands:
echo dev-USB-PWR-CTL > /sys/devices/platform/bone_capemgr/slots
echo 109 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio109/direction
I see new cape entry in slots and new gpio files tree.
But when I change value with command
echo 0 > /sys/class/gpio/gpio109/value
I see new value in this file but nothing happens with USB VBUS.
What am I missing?
(Before you ask do I really need this: let's leave the consequences on the side for a moment.)
Have you looked at this? question about exactly this on the Beagleboard Google Group
Please note that there are some differences to back then and current images, e.g. by default CapeManager is disabled and overlays are loaded once in U-Boot
If you are using a recent elinux.org Debian image (the necessary device tree overlay was merged in June 2015), it includes a device tree overlay (with the comment "Unless you know what you are doing, do not load this cape!!!"). This uses a hack to expose the usb1_drvvbus signal as a fictitious LED, which can then be controlled using the led interface in /sys.
Firstly, load the dev-USB-PWR-CTL-00A1.dtbo device tree overlay. For recent setups (where all dtbos are loaded by uboot and then passed to the kernel at boot time), this could be done by adding dtb_overlay=/lib/firmware/dev-USB-PWR-CTL-00A1.dtbo to /boot/uEnv.txt and rebooting (older kernels/uboots will need to use the older config mechanisms as described in /boot/uEnv.txt).
You can then do this:
echo 'usb1' > /sys/bus/usb/drivers/usb/unbind
echo 0 > /sys/devices/platform/leds/leds/usb_hub_power/brightness
sleep 1
echo 255 > /sys/devices/platform/leds/leds/usb_hub_power/brightness
echo 'usb1' > /sys/bus/usb/drivers/usb/bind
... to power-cycle the device attached to USB1.

beaglebone GPIO3_13 (aka GPIO109) not exposed on P8 or P9?

I have run into some problem controlling usb1' power. as I investigated from
"https://e2e.ti.com/support/arm/sitara_arm/f/791/t/270060" It tells me that GPIO3_13 controls usb1_drvvbus pin, which controls the usb power.
I understand that there is software method to change the voltage of this pin.
My question is that where is GPIO3_13 located on P8 or P9 expansion bays? I cannot find it on any diagrams. Is it purposefully not exposed anywhere?
You can control USB1 power from software on the beaglebone, if you are using a recent elinux.org Debian image (the necessary device tree overlay was merged in June 2015). This uses a hack to expose the usb1_drvvbus signal as a fake LED, which can then be controlled using the files in /sys.
Firstly, load the dev-USB-PWR-CTL-00A1.dtbo device tree overlay. For recent setups (where all dtbos are loaded by uboot and then passed to the kernel at boot time), this could be done by adding dtb_overlay=/lib/firmware/dev-USB-PWR-CTL-00A1.dtbo to /boot/uEnv.txt and rebooting (older kernels/uboots will need to use the older config mechanisms as described in /boot/uEnv.txt).
You can then do this:
echo 'usb1' > /sys/bus/usb/drivers/usb/unbind
echo 0 > /sys/devices/platform/leds/leds/usb_hub_power/brightness
sleep 1
echo 255 > /sys/devices/platform/leds/leds/usb_hub_power/brightness
echo 'usb1' > /sys/bus/usb/drivers/usb/bind

Resources