Jump to content
43oh

Launchpad v1.5 + M430G2553 serial communication on Linux


Recommended Posts

Hi! I'd like to ask about your experiences with Launchpad 1.5 + M430G2553 chip on Linux when doing UARTy communication. While programming the chip works fine for me, I'm just unable to get serial communication to work, both when using Energia's Serial object for communication or the msp430g2xx3_uscia0_uart_01_9600.c example - nothing ever appears in /dev/ttyACM0. I have also blogged about this recently at log.or.cz/?p=249 but Robert Wessels suggested that I should ask here about tips and tricks.

Link to post
Share on other sites

It works, for certain defintions of "works". The TUSB is very picky and tends to trip over every time a butterfly in Argentina (Denmark, if you are in Argentina) flaps its wings, also the driver seems to leave a lot to be desired. Your best bet is not using it, and simply connecting the RX/TX pins of the LP target side to some proper USB<->UART bridge (like FTDI or whatnot).

Link to post
Share on other sites

Hi!

 

The whole point of using Launchpad for me is having a super-cheap USB-hooked uC. If I need to use a separate FTDI dongle, I might as well stick with Arduino. :-(

 

Thanks, I didn't know about a possible issue with sending data when noone is listening on the computer side. I tried to add 30s delay to the start of my Serial test sketch, and making sure I'm reading data when the Launchpad tries to send them, but with no success. My problem is not a permission issue so the udev-related post does not seem relevant.

Link to post
Share on other sites

I have the same problem on Windows 7. The most strange thing was that I had it working for several hours this past weekend and then all the sudden it just stopped the next day. I thought it was my USB serial device drivers, but I tried installing others for several hours but that didn't seem to have helped. Very frustrating.

 

I will try to use an FTDI like gordon suggested.

Link to post
Share on other sites

Given the discussions on serial monitor, I wanted to share some observations in case it helps anyone..

I know this is a linux thread post but thought this was a better place than a duplicate thread for mac.

 

Mac osx , Launchpad v1.4 , launchpad v1.5. Energia 0101E0006, MSP430G2553

 

Doing the tx/rx 90 degree jumper swap did 3 things

 

1) Did not make the standard Serial version work on v1.4 board

2) Did make the standard serial work on v1.5 boards

3) Stopped TimerSerial.h version from working on both boards...(expected)

 

So... I can not get the serial examples working in some of the sketches on board version 1.4

AnalogReadSerial or DigitalReadSerial etc...

It uses

Serial.begin(9600);

Serial.println(sensorValue);

 

The thermometer from Robert example works great

It uses timer based serial so I just mention it as a temp work around for those with v1.4 boards.

 

#include

TimerSerial mySerial;

mySerial.begin()

mySerial.print("\n\n\n*** MSP430 Thermometer \n");

mySerial.print(ui/10, DEC);

 

Here is a modified AnalogReadSerial example code

/*

AnalogReadSerial

Reads an analog input on pin 0, prints the result to the serial monitor

This example code is in the public domain.

 

Modified by clyvb to use TimerSerial instead of Serial

On the launchpad this uses A0 which is also LED1.

If you connect a pot to this and vary the DC voltage

you can see the brightness of your LED varying at the same time

as the serial read numbers change.

*/

 

#include

TimerSerial mySerial;

void setup() {

mySerial.begin();

mySerial.print("\n\n\n*** clive example analog read \n");

}

 

void loop() {

int sensorValue = analogRead(A0);

mySerial.println(sensorValue);

}

Link to post
Share on other sites
pasky what distro are you using? whay does your kernel log say after you plug in your launchpad and what comm program are you using?

 

[232173.893358] usb 2-1.2: new full-speed USB device number 17 using ehci_hcd
[232174.008217] usb 2-1.2: New USB device found, idVendor=0451, idProduct=f432
[232174.008227] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[232174.008234] usb 2-1.2: Product: Texas Instruments MSP-FET430UIF
[232174.008239] usb 2-1.2: Manufacturer: Texas Instruments
[232174.008244] usb 2-1.2: SerialNumber: CFFF4695F6C11445
[232174.014597] cdc_acm 2-1.2:1.0: This device cannot do calls on its own. It is not a modem.
[232174.014611] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[232174.014663] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[232184.057200] generic-usb 0003:0451:F432.0027: usb_submit_urb(ctrl) failed
[232184.057252] generic-usb 0003:0451:F432.0027: timeout initializing reports
[232184.058245] generic-usb 0003:0451:F432.0027: hiddev0,hidraw0: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.0-1.2/input1
...i can use the board now...
[244613.117523] usb 2-1.2: USB disconnect, device number 17

 

It works with both stty + cat and minicom. Have not tried baudrates above 9600. Be sure to wait until the timeout report in dmesg before starting a comm program (10s delay) and at the same time you must do it before anything is sent from the board - so add at least 20s delay to the beginning of your sketch (lit a LED during that time so you have a visual feedback).

Link to post
Share on other sites
  • 2 weeks later...

Working with the /dev/ttyACM0 on linux needs some precations:

 

1. During registering of the driver (takes about 5 seconds after connectiong to the launchpad) the laucnhpad may not send any characters

2. The driver blocks the whole linux machine for several seconds if the lauchpad sends characters, which are not capture by minicom or energia terminal.

 

This how I cope with it: In the setup() part block, until you press the p1.2 button. After pressing the button init the Serial and start sending characters.

 

Before downloading a new program, press the reset button.

Before pressing the p1.2 button, open the lauchpad terminal.

 

Anton

 

Example program:

 

int ticks = 0;

 

void setup() {

pinMode(RED_LED, OUTPUT);

pinMode(GREEN_LED, OUTPUT);

wait4push();

Serial.begin(9600);

Serial.print("\n\n\n*** MSP430 Blinky \n");

}

 

void loop() {

ticks++;

digitalWrite(RED_LED, HIGH);

delay(100);

digitalWrite(RED_LED, LOW);

delay(100);

Serial.print("\n ticks:");

Serial.print(ticks);

}

 

 

 

void wait4push(){

pinMode(PUSH2, INPUT_PULLUP);

//wait until p1.2 is pushed

while (digitalRead(PUSH2)==HIGH) {

digitalWrite(RED_LED, HIGH);

delay(100);

digitalWrite(GREEN_LED, HIGH);

delay(100);

digitalWrite(RED_LED, LOW);

delay(100);

digitalWrite(GREEN_LED, LOW);

delay(100);

}

//debounce

delay(100);

while (digitalRead(PUSH2)==LOW) {

delay(100);

}

delay(100);

 

}

Link to post
Share on other sites

In rare cases when we have no control over the timing of sending of data via the comm, like a pre-programmed chip with no scoure code, keep the "RESET" button pressed on the LP, and then insert the USB cable, wait for a few seconds or observing dmesg, when the driver is done with the registration, start minicom, wait for one or two seconds, finally release the RESET button. Has to strictly follow this sequence, otherwise it won't work.. in summary:

 

1. LP not connected, keep the RESET switch pressing.

 

2. insert USB cable to LP.

 

3. wait for a few second, until dmesg show something like this:

[ 1561.834960] generic-usb 0003:0451:F432.0009: hiddev0,hidraw0: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-ehci-omap.0-2.2/input1

 

4. start minicom, it will show "initializing modem", wait for one to two seconds.

 

5. release the RESET button. The MSP430 chip will now start and send data back. The steps above is to defer the program from starting, giving time for the USB driver to register properly.

 

It is also possible to connect the RST bin to ground with a jumper wire, instead of holding the RESET switch, for the same purpose if that pin can be accessed. i.e. Connect RST to GND in step one, and disconnect the wire in step 5.

 

Used this method to make the TMP006EVM with LP1.5/2553 outputing data to Beagleboard running Ubuntu 12.04 LTS :D

Link to post
Share on other sites

Thanks to a couple of people here for suggestions on this issue. It was the cue that will finally get me to switch to the Fraunchpad as my default platform, and led to what appears to be the solution to a long-standing issue with the Fraunchpad.

 

In my case, I've modified my test430 environment's platform-specific UART code to detect whether P4.0 is being held to ground, and if so spin with an LED flash pattern until the jumper is removed (P4.0 is right next to GND). I'm going to do the same for the Launchpad, but with P1.0 held to Vcc. Having this in my standard serial startup means whenever I grab an old board and plug it in, I can fix the problem by unplugging it, sticking on a jumper, and reconnecting. If I'm smart enough to install the jumper before I put the board away after use, it'll go even faster. (Holding the reset button may work, but it's awkward and inconvenient.)

 

Once I did this for the Fraunchpad I started using that platform more. Which led to repeated instances of the old fuse blown issue, which was a pain, and ultimately led to the complete inability to contact the board with either BSL or JTAG (see this E2E chain). Which in turn led to the discovery of an error in TI's documentation of the FRAM chips, which led to an error in the chip-specific information TI provides me for the mspgcc toolchain, which led to the BSL and JTAG passwords being overwritten every time an mspgcc-generated application was programmed onto an FRAM device. Net result, after the patches I'll put out next week, will be elimination of a major inconvenience with the Fraunchpad, making it actually a really nice platform to use. (I can't test it now, because, well, both my boards are bricks. The ones my TI contact's sending me as replacements should arrive next week.)

 

So all in all, significant improvements from a open discussion of a simple idea. This is how community is supposed to work. Thank you.

Link to post
Share on other sites

I doubt this helps but I've only found one way to use a Launchpad on my linux box. It works perfectly fine using msp430Andy's "Poor Man's Command Line" Software. http://www.43oh.com/forum/viewtopic.php?f=10&t=2212&p=16426&hilit=msp430andy#p16426 Any LP that I install this on works great on the first try, no reset button or other tricks. Other UART communication programs always fail, as you guys already know. I used his software as a base for controlling a few functions of my CNC mill. The mill is controlled by LinuxCNC 2.5 which is built on Ubuntu 10.04. It's running headless in the garage and I use VNC to access it. Now, I have terminal access for controlling a SSR to power up/down the mill as well as proximity sensors for homing the spindle.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...