Serial Communication with Adafruit Feather M0

I am using a Jetson Tx2 with an Arduino (adafruit Feather M0, SAMD ARM cortex M0), but can’t seem to communicate.
The configuration is:
head -n 2 /etc/nv_tegra_release

R32 (release), REVISION: 2.1, GCID: 16294929, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug 13 04:45:36 UTC 2019

I can see the device connect and ttyACM0 is there, but serial communication is not working:

dmesg |tail
[ 61.544648] cdc_acm 1-2.3.4:1.0: ttyACM0: USB ACM device
[ 457.852932] usb 1-2.3.4: USB disconnect, device number 8
[ 458.019446] usb 1-2.3: usb_suspend_both: status 0
[ 461.387435] usb 1-2.3.4: new full-speed USB device number 9 using tegra-xusb
[ 461.420098] usb 1-2.3.4: New USB device found, idVendor=239a, idProduct=800b
[ 461.420123] usb 1-2.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 461.420140] usb 1-2.3.4: Product: Feather M0
[ 461.420154] usb 1-2.3.4: Manufacturer: Adafruit
[ 461.420168] usb 1-2.3.4: SerialNumber: 152FFA7F5150484347202020FF0B0F28
[ 461.423789] cdc_acm 1-2.3.4:1.0: ttyACM0: USB ACM device

I saw some other topics detailing how the install ACM modules on older R28 versions, but do not see anything for R32.

I have another Jetson Tx2 that is copy exact, and can communicate with the M0 device on it.

I am unsure how to go about resolving this issue.

Thanks,
Ashraf

The log you have shows USB has done its part. It recognized the serial device, and provided a driver which produced “/dev/ttyACM0”. You need some software now to talk to “/dev/ttyACM0”, and you haven’t said anything about the software, nor how it fails.

I suppose if it were a permission problem, then you’d see a permission denied message, but you have not described just what does not work. Very likely if you run the command “lsmod” while this is plugged in you will see an ACM module is loaded, and this is unlikely to be the driver causing failure (you can’t load the ACM module twice and get better results since it is already there and working).

For clarification, the log line here would not be possible if the driver were not already there and working:

(ttyACM0 is a side effect of the driver working correctly and is not a real file)

Thanks.

Regarding the SW, I am using python to connect. Again, this code is working on another Jetson Tx2:
ser = serial.Serial(‘/dev/ttyACM0’,1000000,timeout=2)
ser.write(b’?\n’)
time.sleep(0.005)
x=ser.read_all()

When I run this, I get an empty string the first 2 times I try communication, then it hangs.

I read in other Arduino forum (The Linux ttyACM0 drama - more details after a lot of experimenting - Installation & Troubleshooting - Arduino Forum) that the modem manager may be interfering, so I removed it using this command:

sudo apt-get --purge remove modemmanager

I also read on the same forum that occasional problems occur when using USB3 hubs, so I tried with out it.

I also tried the lsmod command and see this:

lsmod
Module Size Used by
cdc_acm 25043 0

It looks like it is not loaded but not used.

Thanks,
Ashraf

How would I go about querying which drivers/versions are used on the working system to find the difference?

Thanks,
Ashraf

“used by” does not mean the code is not used. It means no other module is depending on this. If you were to rmmod a module, then it can only be removed if no other process is dependent upon this. It is quite different to say no other modules use this code (cdc_acm) versus saying the code is not functioning.

Your “/dev/ttyACM0” exists, and so the problems are not due to driver failure, nor to lack of driver. The driver is doing as expected.

I know nothing about your Python code, nor do I know anything about the hardware you are communicating with. However, the topic of modem management is conceivably related, but not necessarily. Old time modems used a serial UART, which is what ttyACM0 is. However, on top of this, modems have “AT” command sets which are just key words to set up the modem. If you have an application for serial communications, and you’ve accidentally enabled sending some sort of modem init string, and if the device you are talking to can be confused by this, then it might get in the way. However, I doubt you’d need to remove “modem manager” software.

I couldn’t tell you exactly what the problem is, but one possibility is that you have not sent the right serial UART setup (such as speed 115200, 8 bits, no stop bits, and 1 parity bit…the default), and one side of the serial connection is set to something different than the other side. If it turns out that you are communicating at speeds over 115200, then it is perhaps due to not using 2 stop bits.

Thanks. That was very helpful. you made me focus on the Arduino itself.
I am able to communicate now with the Arduino. For some reason, when I connect it to a mac, it worked, but when I connect it to the Jetson, the FW on the Arduino will hang. I am not sure why yet, but I can make it work with a slight modification on my side.

If you really want to know what is going on, then you probably need a serial protocol analyzer. Then you could watch the bytes on the Mac and on the Jetson and see how they differ. Serial is usually one of the cheaper analyzer types, but it would still be somewhat expensive if you are just using it once.