Unable to use Mini with STM32 Nucleo board on USB bus

So I’m doing some work with Nucleo STM32 and some play with the LimeSDR-Mini on Arch Linux, but can’t do both at the same time, not that it would be healthy or productive…

The STM32 development board enumerates as a serial port, usually /dev/ttyACM0, which lime confuses for something else:

$ LimeUtil --find
  * [EVB7 (/dev/ttyACM0), media=COM, module=EVB7COM, addr=/dev/ttyACM0]
  * [LimeSDR Mini, media=USB 3.0, module=FT601, addr=24607:1027, serial=1D3AC6EEA46E50]
  * [Remote, media=TCP, module=Z_Remote]

So when I try to use the device through soapy it doesn’t work:

$ ./SimpleSiggen.py --args driver=lime,serial=1D3AC6EEA46E50 --rate 7.68e6 --freq 433.92e6 --txGain 20 --waveFreq 0
[INFO] Make connection: 'EVB7 (/dev/ttyACM0) [COM] 1D3AC6EEA46E50'
[INFO] RemoteControl Listening on port: 5000

[ERROR] Read(64 bytes) failed
free(): invalid next size (fast)
Aborted (core dumped)

or

$ gqrx 
gr-osmosdr v0.1.4-127-g4d83c606 (0.1.5git) gnuradio 3.7.13.4
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy soapy redpitaya 
Resampling audio 96000 -> 48000
BookmarksFile is /home/kiril/.config/gqrx/bookmarks.csv
[INFO] [UHD] linux; GNU C++ version 8.2.1 20181127; Boost_106900; UHD_3.13.0.1-0-unknown
gr-osmosdr v0.1.4-127-g4d83c606 (0.1.5git) gnuradio 3.7.13.4
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy soapy redpitaya 
[INFO] Make connection: 'EVB7 (/dev/ttyACM0) [COM]'
[INFO] RemoteControl Listening on port: 5000

[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[INFO] Device name: UNKNOWN
[INFO] Reference: -1e-06 MHz
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
[ERROR] Read(64 bytes) failed
^C

Right, so that will be far from the only thing that enumerates as /dev/ttyACM0 and in fact I think there may be boards where the SoC console enumerates as that — which might not be possible to disable without hacking at the device tree or Linux kernel.

@IgnasJ, this is pretty annoying behaviour. Can we disable EVB7 by default and perhaps have a config parameter to specify the port (it might sometimes be e.g. /dev/ttyACM1 if there are other instances of that device class on the system).

Thankfully, devices enumerating as /dev/ttyUSBx don’t cause problems.

Maybe some extra logic for finding the device can be implemented. LimeUtil finds both the Mini and the EVB7, so soapy should be able to also see both and pick the correct one, especially having it’s serial number from the device string.