Main Menu

Menu

Wednesday 21 December 2011

mbed MicroBridge in Thunder Board

1. Import the mbed MicroBridge project for mbed NXP1768 to the online compiler.
2. Open the Adb.cpp file
3. Go to Line 768
4. Add the following red lines in the code:

................................................
                        //other
                        log("non input,output Endpoint address=%d,wMaxPacketSize=%d,bmAttributes=%d\r\n",input_ep,epDesc->wMaxPacketSize,epDesc->bmAttributes);
                    }
                }
                break;
            default:
                log("unkown desc type(%d) \r\n",descType);
        }
        p+=descLen;
    }
   
    input_ep=129;
    output_ep=1;
    
   
    if (!(input_ep && output_ep)) {
        log("can't find accessory endpoints\r\n");
        return(false);
    }
   
.................
5. Download and run the project to your connected mbed device.


Connections:
I used a mini B breakout of Sparkfun for this project.

Mini USB                  mbed NXP1768

Vcc                             Vout (3.3V Regulated Out)
D-                               D-
D+                              D+
ID                               No connection
GND                           GND (0V)

and the mini USB to the mini USB OTG (ADB) of the Thunder Board.
For testing I connected a potentiometer in pin13 and two LEDS in pin 25 and 26.

Applications in the side of Android:
ServoControl.zip -->http://code.google.com/p/microbridge/downloads/list

Application in the side of mbed (modified as explained above):
MicroBridge Project -->http://mbed.org/users/jksoft/programs/MicroBridge/lwareg

Sunday 18 December 2011

FezBridge in Thunder Board

This project is based on the FezBridge (http://code.google.com/p/robotfreak/wiki/FezBridge). Here you can find information from the original developer. Here we will see some modifications that I made in order the FezBridge to run on the Thunder Board of TechNexion (in Android 2.2 Froyo).
The general concept of the FezBridge is that the Fez Domino will behave as host (server) and the Android system like client. The connection that is established with a mini to mini usb cable (in the ADB of the Android system). The two devices use the TCP protocol for communication.
In the original project they use 1 distance sensor and two servos for testing. The distance sensor tests the communication from the Fez Domino to the Android and the two servos the other direction of communication. As it is being said in the FezBridge project the graphical animation for the distance sensor is not working but we can view the changes of the distance for example from the debug messages in the VS2010.
In this project, I used a potensiometer instead of the distance sensor (changes the level of voltage in the input of Fez Domino (A0)) and LEDs instead of the servos (we can notice the change of the PWM pulse in the Di2 and Di3 of the Fez Domino Board).
For this project you will need the Visual Studio 2010 to program the Fez Domino (general setup instructions: http://www.tinyclr.com/support/) and the ADB to install the Android Application to your board.
Finally, on Android side the ServoControl Application from the MicroBridge project has been used with some modifications (especially in the GUI of the application). 


--Here is the Android Application which you can install it in your board through ADB.
http://www.multiupload.com/480MAP0FKC
--And here is the C# project to program Fez Domino.
http://www.multiupload.com/D1AOL9HJW9
--Here is the a debug output from VS2010 which shows the different values that we take from the Potentiometer (out) and the x,y coordinates which drive the PWM pulse (in).
http://www.multiupload.com/PAYHVBFLZR


Useful Links:
MicroBridge
FezBridge
TinyCLR

The photos below show the project.
Fez with LED and Potentiometer connected for testing purposes

Fez Domino connected to the Thunder Board via ADB


The application on Android

Tuesday 13 December 2011

Read Magnetic Stripe Card in Thunder Board through Mbed NXP1768

Here I will describe how I manage to read the data of a normal bank magnetic stripe card with the Thunder Board, via the mbed NXP1678 module.

The next image depicts the block diagram of the project.

The project has 3 different interfaces.
The first step is to create the interface/driver for the communication between the Device that reads the 2 stripes of the magnetic card with the mbed NXP1768 PIC. In my case the driver can read in both directions the magnetic card. So the two LEDs indicate the direction of successful reading.
After the completion of this step I implemented the interface between the mbed and the Thunder Board which is divided in two parts: a) Serial between the mbed and the FTDI module and b) USB connection between the FTDI module and the Thunder Board.
Finally, to read the string that the mbed is sending to the Thunder Board, which is running Android Froyo, I had to enable the driver during the compilation of the system (FTDI driver), had all the permissions of the specific usb port and finally to set the baud rate of this usb port:
>stty 9600 -F /dev/ttyUSB0.
After setting the baud rate of the serial communication a cat command is enough to read the string that the mbed sends.
>cat /dev/ttyUSB0.

Monday 5 December 2011

Interface DS1621 temperature Sensor to TechNexion Thunder Board (Android)

Here I will describe how I manage to interface the DS1621 temperature sensor from Dallas Electronics to the Thunder Board from TechNexion while this is running
Froyo Android.

The block diagram below describes the connections between the sensor and the Android system.

After having the above schematic ready, it is time for the new kernel-bootloader-rootfs system compilation which will  include the DALLAS DS1621 driver which already exists in the kernel. You just have to include it in your compilation.

Before start the compilation you have to add some code in the 
"board-omap3tao3530.c" which exists in the folder:
"../rowboat-android/kernel/arch/arm/mach-omap2".
In this file find the :

static struct i2c_board_info __initdata tao3530_i2c_3_boardinfo[]={
};

and add inside it the following lines:

#if defined (CONFIG_SENSORS_DS1621)
   {
                    I2C_BOARD_INFO("ds1621",0x49),
                    .type   =  "ds1621",
   },
#else
                    {},
#endif

After that find the line:

omap_register_i2c_bus(3,100,tao3530_i2c_3_boardinfo,ARRAY_SIZE(tao3530_i2c_3_boardinfo)); 

and make sure that is like this.

For this project I use the source from the Rowboat Project.
When you are in the menuconfig of the Kernel you have to go:
"Device Drivers->Hardware Monitor->Dallas DS16212" (enable the driver and the hwmonitoring debugging messages).

After completing successfully the building of the system you have to boot the Thunder Board with your new compilation, which includes now the driver for the DS1621. To boot from the SD card you have to stop stop the auto-booting from the NAND memory, by pressing a button and then insert:

>setenv hh_android_args 'setenv bootargs mem=${mem_size} androidboot.console=ttyS2 console=tty0 console=${console} ${video_mode} ${extra_options} ${network_setting} root=${mmcroot} rootfstype=${mmcrootfstype} init=/init'

>setenv bootcmd 'mmc init; fatload mmc 0 84000000 uImage; run hh_android_args; bootm 84000000'

>boot

At the same time you can browse the folder of the Android SDK in order to use the ADB (Android Debug Brigde) through a USB connection.

Usually is very helpfull to load the busybox in the new Andoid/Linux system.
So, after detecting the Android device from the ADB, using the following command
>./adb devices

you can "push" the busybox in the android device:
>./adb push /home/kostas777711/busybox /data/busybox
if for example the busybox folder is in this location: /home/kostas777711/busybox /data/busybox
Then:
>./adb shell                                             , to enter the shell
>export PATH=/data/busybox:$PATH    , to add it in the PATH of the system
>cd /data/busybox                                  , browse its folder
>chmod 777 *                                         , change the permissions of the whole folder of busybox
>busybox --install                                    , install busybox

Then browse to:
>cd /sys/bus/i2c/devices/3-0049
>ls
withe ls you can see the attributes of the driver. By executing:
>cat temp1_input
you can read the temperature from the temperature register.

With an oscilloscope you can also "read" the SDA pin of the sensor.
In order to achieve this you can create an infinite loop in the Linux command line of the Android device (from the "adb shell"):

#while :
>do
>cat temp1_input
>done

With this you will be able to read the temperature in the "adb shell" and also notice the transmission of data from the oscilloscope.

At the same time that this project is running, I have set up another project mainly for testing using another DS1621 temperature sensor, the mbed NXP1768 PIC and a 4 lines LCD JHD204A. The NXP1768 communicates through an I2C bus with the sensor and parallel with the LCD. In this case, we have to add pull-up resistors in the SDA and the SCL lines.

Here are some pictures of the project:

Android Thunder Board connected with the DS1621 and the testing board (NXP1768, LCD JHD204A & DS1621) and the embedded oscilloscope connected to the SDA of the Thunder Board.

The data of the SDA line.

Display the temperature on the JHD204H LCD.

Monitoring the output from the "adb shell" after the infinite loop.

Thunder Base Board, Tao3530 and 4.3" touchscreen display.

Closer look to the external connections.