This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/MSP432P401R: How to connect /dev/ttyACM0 on restart

Part Number: MSP432P401R

Tool/software: Linux

I have been using a MSP432 connected to the USB /dev/ttyACM0 port at 57600 baud.

The question I have is how to get Ubuntu 16.04 to open the device with out having to unplug and plug it back in after restart?

It looks like Ubuntu is sending commands to the interface.  This process takes about 30 seconds.  It appears to be sending AT commands.

How would I emulate this apparent handshake within in my UART code.

  • Hi Kenneth,

    I am not familiar with MSP432, but more of a Linux and USB guy. Please bear with me that I need some clarification to understand what you try to solve.

    Is it MSP432 USB is enumerated as /dev/ttyACM0 on your Ubuntu 16.04?

    Kenneth Lindsay said:
    The question I have is how to get Ubuntu 16.04 to open the device with out having to unplug and plug it back in after restart?

    After restart the MSP432 board? If so, do you have to manually run any code on MSP432 to enable its USB?

    What application on Ubuntu do you use to open /dev/ttyACM0 currently?

    Kenneth Lindsay said:

    It looks like Ubuntu is sending commands to the interface.  This process takes about 30 seconds.  It appears to be sending AT commands.

    How would I emulate this apparent handshake within in my UART code.

    We will come back on this later once I understood the first few questions.

  • 1. Is it MSP432 USB is enumerated as /dev/ttyACM0 on your Ubuntu 16.04?  Yes

    2.  After restart the MSP432 board? If so, do you have to manually run any code on MSP432 to enable its USB? No, I have to un-plug the USB cable from the PC and plug it back in.

    It's USB is enabled by plugging the board into a USB port.  Two ports are opened on the board.  One is for the XDS110-ET debug probe, which is assigned /dev/ttyACM1.  The other port /dev/ttyACM0 gets opened as a back channel UART through the USB to a PC.  During the initial plugging in of the board their appears to be the initialization sequence with the PC (Ubuntu 16.04) for about 30 seconds.  After the initialization has completed I can open up a putty app that can use the /dev/ttyACM0 port.  I can't connect with putty until the apparent initialization had completed.

    These are the results of issuing a "dmesg" command, after restart, then after removing and plugging the MSP432 Launchpad back in.

    xxxx@laptop-pc:~ $ dmesg | grep tty
    [ 0.000000] console [tty0] enabled

    xxxx@laptop-pc:~ $ dmesg | grep tty
    [ 0.000000] console [tty0] enabled
    [ 142.053885] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
    [ 142.055533] cdc_acm 2-1.2:1.3: ttyACM1: USB ACM device

    xxxx@laptop-pc:~ $

    3. What application on Ubuntu do you use to open /dev/ttyACM0 currently? I assume it is cdc_acm, see syslog results.

    Jul 31 10:48:04 laptop-pc kernel: [ 141.945557] usb 2-1.2: new full-speed USB device number 9 using ehci-pci
    Jul 31 10:48:04 laptop-pc kernel: [ 142.039434] usb 2-1.2: New USB device found, idVendor=0451, idProduct=bef3
    Jul 31 10:48:04 laptop-pc kernel: [ 142.039441] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Jul 31 10:48:04 laptop-pc kernel: [ 142.039447] usb 2-1.2: Product: XDS110 (02.03.00.14) Embed with CMSIS-DAP
    Jul 31 10:48:04 laptop-pc kernel: [ 142.039451] usb 2-1.2: Manufacturer: Texas Instruments
    Jul 31 10:48:04 laptop-pc kernel: [ 142.039456] usb 2-1.2: SerialNumber: M4321005
    Jul 31 10:48:04 laptop-pc kernel: [ 142.041335] hid-generic 0003:0451:BEF3.0003: hiddev0,hidraw2: USB HID v1.11 Device [Texas Instruments XDS110 (02.03.00.14) Embed with CMSIS-DAP] on usb-0000:00:1d.0-1.2/input5
    Jul 31 10:48:04 laptop-pc mtp-probe: checking bus 2, device 9: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2"
    Jul 31 10:48:04 laptop-pc mtp-probe: bus: 2, device: 9 was not an MTP device
    Jul 31 10:48:04 laptop-pc kernel: [ 142.053885] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
    Jul 31 10:48:04 laptop-pc kernel: [ 142.055533] cdc_acm 2-1.2:1.3: ttyACM1: USB ACM device
    Jul 31 10:48:04 laptop-pc kernel: [ 142.058657] usbcore: registered new interface driver cdc_acm
    Jul 31 10:48:04 laptop-pc kernel: [ 142.058661] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
    Jul 31 10:48:13 laptop-pc gnome-session[1611]: 1820
    Jul 31 10:48:19 laptop-pc systemd[1]: Started Daemon for generating UUIDs.
    Jul 31 10:48:25 laptop-pc ModemManager[833]: <info> Creating modem with plugin 'Generic' and '2' ports
    Jul 31 10:48:25 laptop-pc ModemManager[833]: <warn> Could not grab port (tty/ttyACM0): 'Cannot add port 'tty/ttyACM0', unhandled serial type'
    Jul 31 10:48:25 laptop-pc ModemManager[833]: <warn> Could not grab port (tty/ttyACM1): 'Cannot add port 'tty/ttyACM1', unhandled serial type'
    Jul 31 10:48:25 laptop-pc ModemManager[833]: <warn> Couldn't create modem for device at '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2': Failed to find primary AT port

  • Kenneth,

    Thanks for the kernel log, it helps.

    You seem to have two issues, not sure if there are related though.
    1. The 30-sec init process;
    2. have to re-plug MSP432 after restart to be able to open ttyACM0 with putty;

    Let's try to solve the first one then look at the second.

    The 30-sec init process comes from the Ubuntu Modem Manager, which fails because /dev/ttyACM0 is not a modem. One way to solve it is to disable Modem Manager in Ubuntu. While googling I found the following command:

    $ sudo systemctl disable ModemManager.service

    Please try it on your PC and let me if it solves the first issue and you still have the second problem.
  • This resolved the 30 second issue but still no /dev/ttyACM0 device after startup
    New "dmesg" result

    xxxx@laptop-pc:~ $ dmesg | grep tty
    [ 0.000000] console [tty0] enabled
    [ 0.976827] tty ttyS10: hash matches
    xxxx@laptop-pc:~ $ dmesg | grep tty
    [ 0.000000] console [tty0] enabled
    [ 0.976827] tty ttyS10: hash matches
    [ 126.442011] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
    [ 126.442541] cdc_acm 2-1.2:1.3: ttyACM1: USB ACM device
    xxxx@laptop-pc:~ $
  • Additional information:
    I have a Digitrax USB device that uses the ACMx serial ports. It opens the /dev/ttyACM0 OK. System log excerpt is below before I disabled the modem manager:

    Jul 31 11:51:36 laptop-pc ModemManager[848]: <info> Creating modem with plugin 'Generic' and '1' ports
    Jul 31 11:51:36 laptop-pc ModemManager[848]: <warn> Could not grab port (tty/ttyACM0): 'Cannot add port 'tty/ttyACM0', unhandled serial type'
    Jul 31 11:51:36 laptop-pc ModemManager[848]: <warn> Couldn't create modem for device at '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2': Failed to find primary AT port
  • Kenneth Lindsay said:
    [ 126.442011] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
    [ 126.442541] cdc_acm 2-1.2:1.3: ttyACM1: USB ACM device

    Do you mean after rebooted your MSP432 board, Ubuntu kernel enumerates its ACM devices, but /dev/ttyACM0 is not created?

    If so do you have putty opening the previous /dev/ttyACM0 node at the time rebooting your MSP432 board? If so, does 'ls /dev/ttyACM*' command show any extra ttyACM device node?

  • Kenneth Lindsay said:
    I have a Digitrax USB device that uses the ACMx serial ports. It opens the /dev/ttyACM0 OK.

    I don't understand this. What is the "Digitrax USB device"? Is the /dev/ttyACM0 the node created for your MSP432 board before rebooting it? Can you close it before rebooting the MSP432 board?

  • The Digitrax device is not connect during the power up and power down sequences. I provided that piece of information which indicates to me that it is possible to get the MSP432 to respond the same way at power up.
  • Sorry for the confusion.

    After disabling the Modem Manager and powering the laptop down which also supply's power to the MSP432 and restarting the ACM0 device it is not enabled. Not sure what you mean by enumerated.

    xxxx@laptop-pc:~ $ ls /dev/ttyACM*
    ls: cannot access '/dev/ttyACM*': No such file or directory
    xxxx@laptop-pc:~ $
  • Let us first clarify the current issue - The MSP432 board is connected to the Ubuntu host, then is the PC or the MSP432 board got rebooted which causes /dev/ttyACM0 not created on Ubuntu?
  • Yes, not created.

    The MSP432 board is always connected to the Ubuntu host. The MSP432 board receives it's power from the Ubuntu Host. When the Ubuntu host is powered off and then powered on (restarted) the /dev/ttyACM0 is not created. Since power is coming from the Ubuntu Host the MSP432 is rebooted within a few microseconds before Ubuntu is even started.

    Hope this clarify's, thanks.
  • Yes, it does. Thanks.

    We first need to check if the Ubuntu kernel sees the MSP432 usb device or not after rebooted.
    'lsusb' command on Ubuntu shows all the usb devices which are enumerated. Can you please check if the MSP432 is in the output list of 'lsusb' command after rebooted?

  • NoI

    xxxx@laptop-pc:~ $ lsusb

    Bus 002 Device 008: ID 8086:0188 Intel Corp. WiMAX Connection 2400m
    Bus 002 Device 007: ID 046d:c52f Logitech, Inc. Unifying Receiver
    Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 003: ID 0c45:6480 Microdia Sonix 1.3 MP Laptop Integrated Webcam
    Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  • Thanks for the log.

    It seems the issue is on the MSP432 board, which failed to present its existence after the VBUS power is on. It should enable the DP/DM pullup after VBUS is valid until the USB host starts the enumeration process.

    I am not in the MSP team and not familiar with the device. I will ping the team internally to let them help you looking at the issue.
  • The DP/DM pin goes into a IC on the MSP432 Launchpad board where I can't see what the device is doing with the pin.
    As a result I ran a similar Power Off/On test with my Desktop PC running ubuntu 16.04. That PC seems to work OK this is the result after power cycling.

    xxxx@Home-PC:~ $ lsusb

    Bus 002 Device 004: ID 046d:c318 Logitech, Inc. Illuminated Keyboard
    Bus 002 Device 003: ID 04a9:10dc Canon, Inc.
    Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 003: ID 0451:bef3 Texas Instruments, Inc.
    Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    xxxx@Home-PC:~ $ ls /dev/ttyACM*
    /dev/ttyACM0 /dev/ttyACM1
  • Kenneth Lindsay said:
    As a result I ran a similar Power Off/On test with my Desktop PC running ubuntu 16.04. That PC seems to work OK this is the result after power cycling.
    ......
    xxxx@Home-PC:~ $ ls /dev/ttyACM*
    /dev/ttyACM0 /dev/ttyACM1

    Is the test different from that in your initial report? It looks the same to me - power cycle the PC. But now the MSP432 usb port is enumerated as /dev/ttyACM*.

  • The test is the same power off then on.  Their is a difference though, it is another MSP432 Launchpad with a different cable.  I will test this morning that MSP and cable on my laptop.

    I am still interested in what electrically is happening with the DP/DM pin on the USB port within the MSP432 board.  On the schematic I don't see any pullup, the DP/DM connection goes into some IC.

  • Kenneth,

    I am not familiar with MSP432, but typically the DP/DM pullup is inside the SoC and controlled by its USB module. There is normally no external pullup on DP/DM.

    Here is how the USB host knows there is a USB device attached, based on the USB Spec:
    - When there is no any usb device on the USB bus, the bus is in the idle state;
    - When a USB device is attached to the bus, the device detects the 5V on VBUS line (VBUS valid), then it enables DP or DM pullup (based on the speed the device supports).
    - The USB host then detects the pullup, knows a USB device is attached, it initiates the enumeration process;
    - The USB device disables the pullup, so that the bus can transmit USB packets.
  • The test on the laptop with different board and cable failed the same way as before. I am suspicious of some kind of race between the MSP432 and the laptop. My Desktop is a considerably faster machine.

    Is their a console command that I can issue to the kernel to specifically open up the ports I need?
  • Kenneth Lindsay said:
    The test on the laptop with different board and cable failed the same way as before. I am suspicious of some kind of race between the MSP432 and the laptop. My Desktop is a considerably faster machine.

    Is that both MSP432 boards work fine with your desktop but have the power cycle issue with your laptop? If so it does sound like the laptop usb port timing problem. I had usb host port issue on laptops in the past.

    Kenneth Lindsay said:
    Is their a console command that I can issue to the kernel to specifically open up the ports I need?

    One way to workaround the issue is to manually disable then enable the laptop usb host port (bus).

    First you need to figure out which usb bus the MSP432 board is attached to from the laptop dmesg log. Following is the log you posted.

    [ 126.442011] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
    [ 126.442541] cdc_acm 2-1.2:1.3: ttyACM1: USB ACM device

    Which tells the MSP432 board is attached to bus #2. Now on your laptop:

    $ sudo -s
    # cd /sys/bus/usb/drivers/usb
    # echo usb2 > unbind
    # echo usb2 > bind
    # exit

    Let me know if now the /dev/ttyACM0 nodes are generated.

  • This workaround doesn't work on my Linux PC though.

    # echo usb2 > bind

    kernel dmesg shows:
    usb usb2: can't set config #1, error -22

    If it fails on you too, please try to add a self powered USB hub between your laptop and the MSP432 board.
  • Bind and unbind commands don't work.
  • Probably need a self powered hub anyway. May take a week to get one ordered and received. We will let you know if that works.
  • The hub I used solved the problem.  The MSP432 Launchpad is plugged into the USB port used for charging.  Will test to see if this makes a difference.

  • Kenneth,

    Glad to see all the issues are solved. Thanks for the update.

**Attention** This is a public forum