MSP430 - Serial Communication Monitoring

Follow up on last post, I supposed to write about usage of MSPDebug but instead we will discuss out capturing the output from the LaunchPad.

The default microcontroller, MSP430G2553 was pre-installed with a demo Temperature Measurement program. Once you've powered up the LaunchPad via USB port, the red and green LED will toggle alternatively. Pressing the P1.3 button (left to the blinking LEDs) will start the measurement. To reset back, press the reset button (right to the blinking LEDs).

Since the only visual indicator (did I mentioned I should have bought the other LaunchPad with embedded LCD?) of the program is through the LEDs, how to we obtain the measurement of the temperature? Basically using mspdebug, stty, and cat (similar post but with more descriptions)
$ mspdebug rf2500 exit
$ stty 2400 -F /dev/ttyACM0
$ cat /dev/ttyACM0

There are other ways to read or sniff raw data from serial ports but this is out of the scope of the discussion here.

Press the P1.3 button to start the measurement. You will obtain a series of characters as shown below. Each character is the numerical representation of the ASCII characters. P indicates 80 °F / 26.67 °C and Q indicates 80 °F / 27.22 °C.
QPQPQQQQQQQPQQQQQQQPQQQQQQPQQQPQQQQQPQQQQQQQQQ

From the output above and `dmesg` output when we plugged in the USB cable to power up the LaunchPad, the device will be assigned to device name of `ttyACM0` instead of `ttyUSB0`. TTY stands for TeleTYpewriter.
[21518.005311] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[21518.005357] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device

Why so? Turn out for any USB communication devices like embedded microcontrollers or mobile phones, it's reusing an old control model called Abstract Control Model (ACM) for exchanging raw data. In other words, these devices were identified as modem and communication is done by reusing an old modem communication standard.

To reconfirm that, show all information on `/dev/ttyACM0' using `udevadm` command. For privacy reason, serial number have been replaced with `XXX`.
$ udevadm info /dev/ttyACM0
P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0
N: ttyACM0
S: serial/by-id/usb-Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX-if00
S: serial/by-path/pci-0000:00:1d.0-usb-0:1.2:1.0
E: DEVLINKS=/dev/serial/by-path/pci-0000:00:1d.0-usb-0:1.2:1.0
/dev/serial/by-id/usb-Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX-if00
E: DEVNAME=/dev/ttyACM0
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=Texas_Instruments_MSP-FET430UIF
E: ID_MODEL_ENC=Texas\x20Instruments\x20MSP-FET430UIF
E: ID_MODEL_FROM_DATABASE=eZ430 Development Tool
E: ID_MODEL_ID=f432
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.2:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_2_1_0
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_INTERFACE_FROM_DATABASE=EHCI
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_REVISION=0105
E: ID_SERIAL=Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX
E: ID_SERIAL_SHORT=XXX
E: ID_TYPE=generic
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Texas_Instruments
E: ID_VENDOR_ENC=Texas\x20Instruments
E: ID_VENDOR_FROM_DATABASE=Texas Instruments, Inc.
E: ID_VENDOR_ID=0451
E: MAJOR=166
E: MINOR=0
E: SUBSYSTEM=tty
E: TAGS=:systemd:
E: USEC_INITIALIZED=21528600683

No comments:

Post a Comment