Unable to get USB to Serial adaptor working

I am trying to deploy a Nerves project on some Raspberry Pi’s, I have tried this on both Pi4 and Pi3b boards.

I am attempting to use a USB-RS232 adaptor to talk to an external device, but I cannot get the device to show up as a serial port in Nerves. The adaptor I am using is a Plugable USB-RS232 USB Adaptor, that uses the Prolific PL-2303HXD chip. As far as I can tell, the driver for this is included in the regular Pi3/4 build images as part of the USB_SERIAL module?

The device is seen, it’s just not mapped to a serial port:

[ 4032.061149] usb 1-1.1: new full-speed USB device number 5 using xhci_hcd
[ 4032.165601] usb 1-1.1: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00
[ 4032.165616] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4032.165625] usb 1-1.1: Product: USB-Serial Controller D
[ 4032.165635] usb 1-1.1: Manufacturer: Prolific Technology Inc. 

But I don’t see the following lines that I do see on my Raspbian imaged boards.

[ 1439.746797] pl2303 1-1.1:1.0: pl2303 converter detected
[ 1439.763784] usb 1-1.1: pl2303 converter now attached to ttyUSB0

I have tested the same adaptor and boards running raspbian and they work out of the box.

This could well be me misunderstanding how to use external hardware in Nerves, as I see that usb_serial is compiled as a module in the default config rather than being added to the Kernel??

If nobody can offer any suggestions for making this adaptor work, has anyone had any luck with any other adaptors they could point me towards?

Thanks!

1 Like

I just looked and the PL2302 driver isn’t one of the USB->Serial drivers that’s included by default. I was surprised since it’s a fairly common one. The ones included are:

  • Winchiphead CH341
  • CP201x
  • FTDI

If you want to add it, you’ll need to make a custom Nerves system and add the following to the linux-5.10.defconfig file:

USB_SERIAL_PL2303=m

I went ahead and made a pull request to add it. I suspect more people have one of these than the default list these days.

Frank

2 Likes

Thanks for this, apologies as that’s actually pretty obvious now, still wrapping my head around nerves and kernel building e.t.c

I will go ahead and make a custom build for now (or try to).

Have also made a pull request against the Pi3 package.

Cheers

Gareth

Spoke to soon, I’m on an M1 MacBook Pro, so far the build process is failing for me.

I get this error at the start of the build process, guessing this is the culprit?

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

This is the eventual error I get:

>>> erlang 24.2.1 Building**** (Mix) The Nerves Docker build_runner encountered an error while building:**

**-----**

**>>> erlang 24.2.1 Building**

**PATH="/nerves/build/host/bin:/nerves/build/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" /usr/bin/make -j6 -C /nerves/build/build/erlang-24.2.1/**

**Makefile:1235: warning: overriding recipe for target 'dialyzer'**

**Makefile:510: warning: ignoring old recipe for target 'dialyzer'**

*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ***

*** ERROR: No usable Erlang/OTP system for the build machine found! Cannot**

*** cross compile without such a system.**

*****

*** Either build a bootstrap system for the build machine, or provide**

*** an Erlang/OTP-24 system in the $PATH, and try again. For more**

*** information on cross compiling Erlang/OTP-24, see the**

*** $ERL_TOP/xcomp/README file.**

*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ***

**make[2]: *** [Makefile:340: cross_check_erl] Error 1**

**make[1]: *** [package/pkg-generic.mk:295: /nerves/build/build/erlang-24.2.1/.stamp_built] Error 2**

**make: *** [Makefile:23: _all] Error 2**

**-----**

**See /Users/garethjeanne/Development/up/2022/fibre_test/custom_rpi3/build.log.**

Hi @gazzer82!

Did you find a solution for this? I’m on M1 as well, and getting the same error…

Thanks!

Hi @nandorstanko i didn’t I’m afraid, I ended up spinning up a linux VM on our ProxMox server to build it. Would very much like to that as it’s a real faff to update and deploy.