Sunday, January 19, 2014

Getting the beagle board to start the console with the new angstrom

Essentially the same procedure, but the serial console changed name from  ttyS2 to ttyO2 (A letter O, not a zero).  So, if you already have u-boot there for the second stage boot, you just stop the load process by hitting any key before boot, and then change the boot parameters:

First check your variables with printenv.

OMAP3 beagleboard.org # printenv

Then copy and paste the bootargs somewhere and replace the serial console. In my case it's:

OMAP3 beagleboard.org # setenv bootargs console=ttyO2,115200n8 console=tty0 root=/dev/mmcblk0p2 rootwait video=omapfb:vram:2M,vram:4M nohz=off

Here I have already replaced the previous ttyS2 with ttyO2. Finally, you save your settings in nand to make them persistent by using saveenv:

OMAP3 beagleboard.org # saveenv



Thursday, January 09, 2014

RC USB connection protocol

Yesterday I received a hobbyking shipment with a 6 channel remote control and a cable use it from the USB port. However, all the software to use it was written for Windows. Since I use Linux, I decided to see how does the protocol work and write some software for it to practice in virtual before crashing my toys.

It turns out that the protocol is very simple. Two characters per channel. The first two characters of the packet are 'U' and chr(252).

You can run the following lines in python to visualize what's going on.  I release these lines as usual under GNU LGPL.

# Written by gralfca
import sys
def readsync():
    sync = 'U'+ chr(252)
    s = sys.stdin.read(2)
    while s != sync:
        s1 = sys.stdin.read(1)
        s = s[1] + s1

def posval(xx):
    return int(ord(xx[0])*256 + ord(xx[1]))

def readpos():
    return posval(sys.stdin.read(2))

while True:
    readsync()
    positions = [ readpos() for _ in range(6) ]
    print positions

######

You can save the program as poscat.py and then run it as :

cat /dev/ttyUSB0 | python poscat.py