Pages

Monday, 6 August 2012

stk1160 driver on beaglebone

Had another look at this

There's a branch of STK1160 for the raspberry pi, and that works for the beaglebone

(think all the AC97 has been commented out)

it's here - https://github.com/piotr-e/stk1160-raspberrypi

(some history of it -  https://github.com/ezequielgarcia/stk1160-standalone/issues/8 )


It still exhibits the same picture breakup as seen on the RPi - but I've checked my DMA fix ... and it hasn't been, so that's my first step; (Disable USB DMA at drivers->USB support->Inventra-> select [*] Disable DMA) http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/791/t/185953.aspx


Disable DMS makes it worse; the picture is a horrible mess now!

=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Attempt to build the updated easycap driver stk1160 from Ezequiel Garcia.

http://easycap.blogspot.com.ar/2012/07/new-driver-for-easycap-dc60-stk1160.html

https://github.com/ezequielgarcia/stk1160-standalone/tree/0.9.4_v3.2


need kernel sources to build it on beaglebone - trying to create them using this method;


git clone git://github.com/RobertCNelson/linux-dev.git
cd linux-dev
git checkout origin/am33x-v3.2 -b am33x-v3.2
./build_kernel.sh


from http://elinux.org/BeagleBoardUbuntu#BeagleBone



exciting highlights;

arch/arm/configs/omap2plus_defconfig:244:warning: unexpected data # # configuration written to .config # `.config' -> `/home/michael/beaglebone/linux-dev/patches/ref_omap2plus_defconfig' `/home/michael/beaglebone/linux-dev/patches/defconfig' -> `.config' HOSTCC scripts/kconfig/lxdialog/checklist.o HOSTCC scripts/kconfig/lxdialog/inputbox.o HOSTCC scripts/kconfig/lxdialog/menubox.o HOSTCC scripts/kconfig/lxdialog/textbox.o HOSTCC scripts/kconfig/lxdialog/util.o HOSTCC scripts/kconfig/lxdialog/yesno.o HOSTCC scripts/kconfig/mconf.o HOSTLD scripts/kconfig/mconf scripts/kconfig/mconf Kconfig *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. `.config' -> `/home/michael/beaglebone/linux-dev/patches/defconfig' make -j2 ARCH=arm LOCALVERSION=-psp20 CROSS_COMPILE="ccache arm-linux-gnueabihf-" zImage modules scripts/kconfig/conf --silentoldconfig Kconfig

I'm using the machine in my loft to build all this, because (being an ubuntu 12.04 server) it was easier to install the cross compiler toolchain. Seemed to be as easy as sudo apt-get install gcc-arm-linux-gnueabihf

found some files that look like source in /KERNEL and some headers and a zImage in /deploy... looks like the kernel i've made isn't the one i'm using on the beaglebone (not very surprising). I've made a uImage from the new zImage and will see what happens.

Found the command below at http://eewiki.net/display/linuxonarm/BeagleBone

mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux" -d ./linux-dev/deploy/3.2.21-psp16.zImage ./uImage

Wednesday, 1 August 2012

1-wire and blinking LEDs

Not much progress tonight. I got distracted looking at opencv/simplecv - which is something that interests me for the future - and I think I may have broken motion/ffmpeg in the process of trying to install opencv with ffmpeg and python support. I've built a new image and have disabled creating ffmpeg videos to be on the safe side. (I'm not really interested in video footage, but I'm quite interested in stability). I hasn't crashed yet since. (still running at 720x576).

I have been looking at 1wire for humidity and temperature monitors. I don't think I'm feeling bold enough to attempt anything like http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone
ultimately this, or something like it (I2C?) is going to make the device £20 cheaper.... but in terms of simplicity I want to see it working first with something like the DS9094 http://www.sheepwalkelectronics.co.uk/products-adapters.shtml

useful?
http://apartment-automation.blogspot.co.uk/2009/09/installing-1-wire-usb-adapter-ds9490r.html

Currently the SWE3 module from http://www.sheepwalkelectronics.co.uk/SWE3.shtml looks favorite, with a DS18S20 sensor (http://www.sheepwalkelectronics.co.uk/products-components.shtml) wired directly into the 3way terminal block on the board to create a dual temp/humidity unit. The IR led lighting can live on this module too and take power from the cat5.



Afterwards, I made LED 3 turn on and off

echo 0 > /sys/class/leds/beaglebone\:\:usr3/brightness 
echo 1 > /sys/class/leds/beaglebone\:\:usr3/brightness 


RTC on i2c


Instructions for the DS1307 below, step one is build the thing;

 http://adafruit.com/product/264
http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html

http://datasheets.maxim-ic.com/en/ds/DS1307.pdf

Then buy this (should have used the

http://proto-pic.co.uk/pca9306-level-translator-breakout/

(set EN high)
connect them all together;



(The 1-wire thermometer can just be seen at the bottom of the breadboard)

L@@K! something (hopefully the DS1307) is at address 0x68.


root@omap:/home# i2cdetect -r -y 3    

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                      



The DS1307 didn't seem to burst into life until you set it... I would probably know that if I read the friendly manual. I seem to be able to set the seconds byte to 00x0 with


i2cset -y 3 0x68 0x00 0x00


and a couple of seconds later 0x00 is 02... so I think it's working. Note to self - need to refine this to actually set/read the time.

i2cdump -y 3 0x68


No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
10: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
20: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
30: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?
40: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
50: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
60: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
70: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?
80: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
90: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
a0: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
b0: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?
c0: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
d0: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
e0: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
f0: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?


lots of numbers....

getting the time out of the ds1307 looks like it's going to be easier than i thought


echo ds1307 0x68 >/sys/bus/i2c/devices/i2c-3/new_device

or

echo ds1307 0x68>/sys/devices/platform/omap/omap_i2c.3/i2c-3/

both these seem to work, and it also seems this information can be found at  /sys/class/i2c-adapter/i2c-3/

There's a driver in the kernel for the ds1307, so getting the time is seemingly as straight forward as; 

hwclock -f /dev/rtc1 --set --date="8/11/2012 21:31"

I had some problems with the hours last night - either it was me, or whatever time zone i'm in (haven't set any locale data yet) or the bits for 24h/12h on the ds1307 (see datasheet).

so look there for a fuller explaination - but here are the useful commands I need for my own reference;
Read time from hwclock;
hwclock -f /dev/rtc1 -r
Set system time from hwclock;
hwclock -f /dev/rtc1 -s
Write system time to the hwclock
hwclock -f /dev/rtc1 -w


Looking into getting this to work on startup next...

got some advice here;

https://groups.google.com/forum/?fromgroups#!topic/beagleboard/DegreEdtI-Q%5B1-25%5D

Which seems to work.
I think this should set the right time and write it to the hwclock

dpkg-reconfigure tzdata
ntpdate ntp.ubuntu.com
hwclock -f /dev/rtc0 -w


1 wire


Datasheet for DS9094;
http://www.sheepwalkelectronics.co.uk/datasheets/DS9490-DS9490R.pdf 

pinout for DS9094;


pinout for RJ45;


The humidity module SWE3 from sheepwalk (http://www.sheepwalkelectronics.co.uk/SWE3.shtml) has two rj45 sockets - I'm going to use one of these at the host end to build a RJ12 - RJ45 adapter. Pins 4 and 5 will come from the 1wire host RJ12 socket but this adapter doesn't provide enough power to drive the IR leds so my RJ45 adapter is going to inject 5v from the regulator.


Image of the SWE3 from sheepwalkelectronics.co.uk - the terminal block is where the temperature sensor will be mounted.

Having built my RJ12 -> RJ45 adaptor I dmesg, and have just spied;

[ 1.827064] BeagleBone cape: initializing w1-gpio
[ 1.832094] w1-gpio connected to P8_6


This implies to me that the ubuntu 12.04 already has the 1wire patch and I don't need my USB host!? Looking at the comments at http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone leads me to believe I probably should have expected than...

last comment regarding the 4k7 pull up seems pertinent too.


...Found two approx. 10k resistors in the loft! Hooking up to P8_6 does indeed work.


root@omap:~# cat /sys/bus/w1/devices/10-000802307b83/w1_slave 
31 00 4b 46 ff ff 01 10 27 : crc=27 YES
31 00 4b 46 ff ff 01 10 27 t=24687

cat /sys/bus/w1/devices/10-000802307b83/w1_slave | tail -n1 | awk -F= '{print $2/1000 " degrees Celsius"}'
24.625 degrees Celsius

A comfortable 24.635 C°.


I need to do some homework before I hook up the humidity sensor as 3.3v is outside the voltage range of the 4031. Looks like I might be able to replace it with the 5031;

http://uk.farnell.com/jsp/search/productdetail.jsp?sku=1784721

I've have to do some homework/ read the datasheet.
http://sensing.honeywell.com/index.php/ci_id/49692/la_id/1/document/1/re_id/0


Voltage supply 2.7 - 5.5 Vdc

Current supply 200 - 500 uA

Voltage output (1st order curve fit) VOUT=(VSUPPLY)(0.00636(sensor RH) + 0.1515), typical at 25 C

Temperature compensation True RH = (Sensor RH)/(1.0546  0.00216T), T in  C



NB The ADC may lose accuracy at 3.3v... so maybe some more bidirectional level conversion is better?

This looks a bit like the SWE3 circuit to me;
http://owfs.org/uploads/File/humsensor.pdf
note the True RH calculation above for the 5031 differs from the information in the sidebar for the other chip.


Further reading


Application notes on 1-wire
http://www.maxim-ic.com/app-notes/index.mvp/id/148


References/ Acknowledgements

Invaluable 1-wire info;
http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone

Great i2c beaglebone tutorial;
http://www.youtube.com/watch?v=8C2zk6B-eLU

another RTC resource
http://wiki.glacsweb.info/index.php?title=Beaglebone&redirect=no

Monday, 30 July 2012

Hardware




  1. Raspberry Pi
  2. BeagleBone
  3. syntek/'easycap' capture device
  4. em28xx capture devices
  5. 5v regulator
  6. SD card reader
  7. Multimeter

The bullet camera is mostly obscured by an elephant.

Friday, 27 July 2012

MIO-2260

Advantech MIO2260

€217.00


http://downloadt.advantech.com/ProductFile/PIS/MIO-2261/Product%20-%20Datasheet/MIO-2261_DS(06.11.12)20120621201441.pdf



Monday, 23 July 2012

BeagleBone - ubuntu precise 12.04 armhf

Beaglebone with ubuntu precise


On debian laptop 


(elinux.org, 2012)

wget http://rcn-ee.net/deb/rootfs/precise/ubuntu-12.04-r4-minimal-armhf-2012-07-16.tar.xz

sudo ./setup_sdcard.sh --mmc /dev/sdX --uboot "board"




ssh into BeagleBone


 (R.Nelson, 2012)



apt-get update

apt-get upgrade


apt-get install libncurses5-dev lzma make gcc patchutils libproc-processtable-perl


create a swapfile


mkdir -p /var/cache/swap/ sudo dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024 sudo 

chmod 0600 /var/cache/swap/swapfile 
mkswap /var/cache/swap/swapfile
swapon /var/cache/swap/swapfile

get sources and BeagleBone patches



mkdir /home/stuff

cd /home/stuff

wget http://rcn-ee.net/deb/precise-armhf/v3.2.21-psp16/defconfig

wget http://rcn-ee.net/deb/precise-armhf/v3.2.21-psp16/patch-3.2-psp16.diff.gz


mkdir /home/linux



cd /home/linux


wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.tar.bz2

tar xjf linux-3.2.tar.bz2 

cd linux-3.2

zcat /home/stuff/patch-3.2-psp16.diff.gz | patch -p1

cp /dir/downloaded/defconfig .config




edit the em28xx driver (Makarov, 2011)


cd drivers/media/video/em28xx/

sed -i 's/height >>= norm_maxh(dev)/height = norm_maxh(dev) >> 1/' em28xx-core.c

cd /home/linux/linux-3.2

make menuconfig

Device drivers > USB support > disable DMA (always use PIO)

make

make modules_install

apt-get install motion

Getting a decent picture out of the lifecam, but timeouts from the em28xx.


I AM STUCK NOW. TIME TO ASK THE INTERNETS.




Answer = use a syntek device!



thanks to : https://groups.google.com/forum/?fromgroups#!topic/beagleboard/NZGU2gt-U2Y
http://easycap.blogspot.co.uk/p/devices.html


Amazon uk link;

http://www.amazon.co.uk/LogiLink-USB-Video-Adapter-Audio/dp/B0013BXFLG/ref=sr_1_1?ie=UTF8&qid=1343662212&sr=8-1

This card is currently producing a 720x576 image in motion on the BeagleBone running ubuntu 12.04 - and no mucking about with the kernel.





References

elinux.org, July 2012, BeagleBoardUbuntu, available from  http://elinux.org/BeagleBoardUbuntu#BeagleBone accessed 23rd July 2012


Robert C Nelson, (2012) in reply to ubuntu make error No such file or directory available from https://groups.google.com/forum/?fromgroups#!topic/beagleboard/5xMAyFxQbdE accessed 23rd July 2012




Vitaly Makarov (2011) Non-portable code in em28XX driver, available from http://www.digipedia.pl/usenet/thread/18550/7691/ , accessed 21st July 2012

Sunday, 22 July 2012

BeagleBone Angstrom

Angstrom-Cloud9-IDE-eglibc-ipk-v2012.04-core-beaglebone-2012.04.09.img.xz

beaglebone.org/bone
www.angstrom-distribution.org/demo/beaglebone/archive/

used recommended

xz -dkc my_image_file.img.xz | pv | sudo dd of=/dev/your_sd_card


boots ok, logging in as root.
not familiar with opkg package manager, but first steps seems straightforward.
(http://www.linuxtogo.org/gowiki/AngstromManual)

opkg update 

opkg upgrade

fuck, no motion/ffmpeg on opkg, ...girding my loins;



git clone git://github.com/sackmotion/motion.git

./configure

make

make install


Well, this seems to work with the lifecam at 320x240, struggled at 1280x720! Ram? 
Not working for the easycap DC60, but it is picking up the em28xx module.
No ffmpeg, (it's not installed), can't seem to install patchutils, let alone media_build drivers either. Feeling a bit lost without apt-get, going to bask my head against Ubuntu again for a while. Lots of new palettes on this motion installation though (17!).
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License