We are trying to connect a USB device over serial to a carrier board for the Verdin IMX8M.
We can see that the device is mounted, and it seems that we can write successfully to eat, but when we read from the device, the buffer is empty.
Is there some documentation we should read to better understand how to configure these ports for communications with peripheral devices? In the past it just worked, so we haven’t had to think about it.
We have a wireless base station that collects instrument data and transmits it to the Toradex carrier board over USB. ttyACM0. We wrote a C program to collect data from this device. On other IoT boards we use this has worked without any issue.
One peculiarity we have seen across all of the Toradex based devices so far is that the system requires a reboot to mount anything over USB. Maybe this is related.
With this Toradex board we have had success connecting modbus rs485 converters over USB, but this device is not working, and it is not working in an unusual way, given that it mounts. I have attached a screenshot showing write success but no reading response.
Ok so this USB device then is a USB modem of sorts it sounds like? Or is it something else entirely?
One peculiarity we have seen across all of the Toradex based devices so far is that the system requires a reboot to mount anything over USB. Maybe this is related.
This sounds strange to me. So you’re saying when you plug in this device or any USB device it doesn’t get enumerated in /dev/* until after you reboot the system? If so that doesn’t sound right to me. USB devices should be initialized shortly after being plugged in, assuming there’s an appropriate driver for that class of device available. Does this phenomenon even happen with a simple USB storage drive?
Also what version of our OS is your software based off of here?
Ok something is definitely abnormal here with the USB enumeration on your system. I just did a test using a Verdin i.MX8M Mini and our Dahlia carrier board. I used the same version of software as you stated for my test.
While the system was running I attached a ttyUSB device to the carrier board’s USB port. Without having to reboot the system I can see an entry for /dev/ttyUSB0. I remove and re-attached the device several times without rebooting the system and every time it was enumerated properly.
As you said previously, perhaps this behavior is related somehow to your reading/buffer issue. I assume you’re using a non-Toradex carrier board yes? If possible do you have a Toradex carrier board available to test to see if your device gets mounted immediately without rebooting.
We are using a non-Toradex board, correct. Unfortunately, we don’t have a Toradex board available for testing.
Devices listed as /dev/ttyUSB0 require a reboot to be recognized but then they work properly.
The problematic device is listed as /dev/ttyACM0; this one appears to be recognized after reboot but still doesn’t work.
Perhaps, there is a difference between these two types of devices that we are not aware of? What shall we look for in the configuration of the carrier board?
It looks increasingly like the root problem has to do with the linux kernel packaging of Torizon Core. There seem to be lots of other posts on these forums that point in this direction. Maybe bounce this off of some of your colleagues as the problem seems known.
There seem to be lots of other posts on these forums that point in this direction.
@LBeaudry Could you please provide links to these other posts that you are referring to. So that I can get an idea of the issue and communicate it internally if needed.
The post you linked has a workaround described in it. Can you try this workaround and see if it fixes the issue you have with reading from your USB device. This will answer whether this USB detection issue is related or a separate issue entirely.
I checked the workaround in that link. Unfortunately we are not able to build the kernel and test it as many boards were already shipped to the fields. I also saw them applying new image and it worked. Now that we are unable to burn image locally, I wonder if we can apply a remote OTA to make an upgrade? We are currently running Torizon Core 5.7.0-build.17.
I also saw them applying new image and it worked. Now that we are unable to burn image locally, I wonder if we can apply a remote OTA to make an upgrade? We are currently running Torizon Core 5.7.0-build.17.
Well apparently the issue described in that other post was fixed in our 6.X.Y OS versions. However, it’s not currently possible to update from 5.7.0 to 6.X.Y. You could create a custom image with the workaround based on 5.7.0 then OTA update to that, to test.
As for your root problem with the read issue. I did have another idea, so on TorizonCore we have ModemManager enabled by default. ModemManager has the annoying affect of interacting with tty/serial devices that it suspects to be a modem device. This can interfere if you are trying to interact with this device in parallel. You can try disabling or stopping the ModemManager service, with something like sudo systemctl stop ModemManager.service. Then see if this improves your situation to read/write to the device.
Unfortunately we can’t really provide much more advice on this. We have no knowledge or experience with this specific USB device you are working with, so it’s hard for us to say what could be the issue here. Also there’s no information on this readACM9 application you are using to read and write to your device. There’s also many factors involved with this so it’s hard to narrow down what could be the issue without more specific information that we don’t have.
Stopping ModemManager.service works like a charm. Actually we applied sudo systemctl disable ModemManager.service as we never want it to block the device. The devices not recognized issue is still there, but I guess we can live with that for now. Those two problems are unrelated I think. Thanks for the hint.
Good to hear that it was just simply ModemManager interfering. I guess it was only interfering with reads and not your writes. As you said I guess the USB detection issue is then a separate issue.