Jump to content

rubfi

Members
  • Content Count

    7
  • Joined

  • Last visited

  • Days Won

    1
  1. Thanks for your comment and for the link to the Bluetooth Debugging Assistant. It will be really useful for future projects.
  2. Find here a small guide for building the Android side of the app (The launchpad side can be found on the original post) Android App Setup Download Android Serialport API code (I used the revision 54 for the pinball proof of concept) $ mkdir build $ cd build $ svn checkout -r54 http://android-serialport-api.googlecode.com/svn/trunk/ android-serialport-api Download Vector Pinball code (rev 04ee044b27) $ git clone https://github.com/dozingcat/Vector-Pinball.git $ cd Vector-Pinball/ $ git checkout 04ee044b27 Apply the modifications to the Vector Pinball (MSP430Pinball.patch is attached to this post, copy it to build dir) patch -p1 < ../MSP430Pinball.patch Copy serial port code and libs on the Vector Pinball tree. $ cp -r ../android-serialport-api/android-serialport-api/project/src/android_serialport_api/ src/ $ rm -rf src/android_serialport_api/sample/ $ cp -r ../android-serialport-api/android-serialport-api/project/libs/armeabi/libserial_port.so libs/armeabi/ $ cp -r ../android-serialport-api/android-serialport-api/project/libs/armeabi-v7a/libserial_port.so libs/armeabi-v7a/ You may need to modify "src/android_serial_port/SerialPort.java" for pointing the "su" path to the "su" command on your Android device. In my case, I did: $ vim src/android_serialport_api/SerialPort.java - su = Runtime.getRuntime().exec("/system/bin/su"); + su = Runtime.getRuntime().exec("/system/xbin/su"); To import the modified VectorPinball project to your Android Development environment (In eclipse File > New >> Project... >> Android project from existing code -> Root directory = <path_to_vector_pinball> ) Adding Serial Port emulation over USB to your OTG supporting Android Tablet (in my case an Allwiner A10 based) Download the kernel source code (I used the lichee3 branch in order to create a module compatible with the kernel already in the device) $ git clone -b lichee-3.0.8-sun4i git://github.com/linux-sunxi/linux-sunxi.git Configure the kernel, for adding CDC_ACM support $ make ARCH=arm sun4i_crane_defconfig $ make ARCH=arm menuconfig Device Drivers >> USB Support >> <M> USB Modem (CDC ACM) support Compile the kernel and the modules $ export PATH=$PATH:/<path_to_your_cross_compiler>/bin (i.e "export PATH=$PATH:/opt/arm-2010q1/bin" ) $ export CROSS_COMPILE=arm-none-linux-gnueabi- $ make ARCH=arm $ make ARCH=arm modules Copy the cdc-acm.ko module to your Android device and install it $ scp drivers/usb/class/cdc-acm.ko root@<ip>:/data/local/ ( i.e $ scp drivers/usb/class/cdc-acm.ko root@192.168.0.11:/data/local/ ) (I used DropBear SSH Server II on Android as SSH server) After copying cdc-acm.ko, you should ssh your Android device and execute as root "insmod cdc-acm.ko". (you may need to do this step every time you reboot your tablet). Check if /dev/ttyACM0 has been created after loading cdc-acm.ko in order to see if the module was installed correctly. From Eclipse build the apk or launch the BouncyActivity app. Hopefully, following these steps it works for you, and you can build awesome apps using MSP430 Launchpad and Android. MSP430Pinball_VectorPinball.patch.gz
  3. Yes, the internal pull-up resistors are enabled for pins 2.3 and 2.5
  4. I would like to participate with the Launchpad+Android pinball, http://forum.43oh.com/topic/3128-msp430-launchpad-android-pinball/ Could you please add me to the list? Good luck to all!
  5. Thanks for the comments. The schematics are very simple, just two buttons, one LED, and some cables scavenged from an old PC, together with three 330 ohm resistors. Anyway, I wanted to give a try to Fritzing, so find attached the schematics (Launchpad SVG was taken from this post: http://www.43oh.com/2011/07/launchpad-svg-for-fritzing/ )
  6. Hi everyone, I wanted to connect a MSP430 to an Android device. In fact, my idea was to use the MSP430 launchpad as a low-cost GPIO board for an Android tablet. I did a little research, and first thought on the audio port for the communication ( http://robots-everywhere.com/re_wiki/index.php?title=Serial_on_Android_using_the_audio_port ) but then I remembered that the tablet supported USB OTG. So, I compiled the CDC_ACM module for the (Allwinner A10 based) tablet in order to emulate serial port over USB. Then, in the MSP430 Launchpad side, I needed a lib for using the serial port. I found MSP430-softuart by Stefan Wendler (https://github.com/wendlers/msp430-softuart) and used it for the bidirectional communication Android-Tablet<->MSP430-Launchpad. In order to make a demo, I modified the code of Open Source Vector Pinball (http://dozingcatsoftware.com/VectorPinball/index.html ), adding support for serial port access (using http://code.google.com/p/android-serialport-api/). This modified Vector Pinball has the flippers linked to MSP430 Launchpad buttons. When the buttons on P2.5 and P2.3 are pressed they flippers are activated. A LED is also connected on P1.6 in order to toggle it when receiving "toggle" command from the Android app. You can find the video demo here: This is the source code for the MSP430 (find it also attached to this post) #include <msp430.h> #include <stdint.h> #include "uart.h" #define LED1 BIT0 #define LED2 BIT6 #define BUTTON1 BIT5 #define BUTTON2 BIT3 static volatile bool r = false; static volatile bool l = false; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; // Initialize clock DCOCTL = CALDCO_1MHZ; P1DIR |= (LED1 + LED2); // Set BIT0 and BIT6 as output P1OUT &= ~(LED1 + LED2); // LEDs off P2REN |= (BUTTON1 + BUTTON2); // Select pull-up resitors por P2.3 and P2.5 P2IE |= (BUTTON1 + BUTTON2); // Enabling Button interrupts P2IFG &= ~(BUTTON1 + BUTTON2); // Clear interrupt flags for the buttons uart_init(); __enable_interrupt(); uint8_t c; while(1) { if(uart_getc(&c)) { if (c == 't') { P1OUT ^= (LED2); // Toggle LED2 } } if (l) { uart_putc('l'); // Send "left" command via UART l = false; } if (r) { uart_putc('r'); // Send "right" command via UART r = false; } } } // Port 2 interrupt service #pragma vector=PORT2_VECTOR __interrupt void Port_2(void) { if ((P2IFG & BUTTON2)) { P1OUT ^= LED1; // Toggle LED1 P2IFG &= ~BUTTON2; // Clear BUTTON2 interrupt flag P2IES ^= BUTTON2; // Interrupt called on High-to-Low and Low-to-High l = true; } if ((P2IFG & BUTTON1)) { P1OUT ^= LED1; // Toggle LED1 P2IFG &= ~BUTTON1; // Clear BUTTON1 Interrupt flag P2IES ^= BUTTON1; // Interupt called on High-to-Low and Low-to-High r = true; } } Later today, I will include the schematic and a guide with the steps for replicating the setup in case you want to build it. Do you find the project interesting? msp430-pinball.tar.gz
×
×
  • Create New...