# /dev/ttymxc2 serial port name not supported?

**URL:** <https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358>\
**Category:** General\
**Tags:** docker\
**Created:** [8 April 2023 07:39 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358 "2023-04-08T07:39:38Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![GGG](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GGG](https://discourse.nodered.org/u/GGG)\
**Post date:** [8 April 2023 07:39 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/1 "2023-04-08T07:39:38Z")

</div>

I'm using torizon imx7 som module with docker and Noder-Red: I can use gpio but if use serial port, node-red crash. With nxp serial port are named /dev/ttymxc\* :do you know if node’s serialport module not supporting the naming scheme NXP uses for their serial/UART devices?  
I went through the serialport utilities in node and found this:

> <https://github.com/serialport/bindings-cpp/blob/main/lib/linux-list.ts#L6>

My typescript and node knowledge isn’t the best so I may also be interpreting this wrong. But it leads me to believe node may not have support for `ttymxc*` devices.  
thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 April 2023 07:53 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/2 "2023-04-08T07:53:53Z")

</div>

Welcome to the forum @GGG.

Please start node-red in a command window, and post the startup log here, up to the error you see. When posting use the `</>` button at the top of the forum entry window to stop the forum interpretting it as markdown.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [8 April 2023 08:56 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/3 "2023-04-08T08:56:21Z")

</div>

It looks like it does not accept `mxc` pattern. Have you tried to manually add it? Is there a reason why you are not using [node-red-node-serialport](https://flows.nodered.org/node/node-red-node-serialport)?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 April 2023 11:14 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/4 "2023-04-08T11:14:18Z")

</div>

I think they are - the Node-RED node just pulls in the underlying serial port library from npm - so if they don't support it then neither will we.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 April 2023 12:28 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/5 "2023-04-08T12:28:51Z")

</div>

Well node-red-node-serialport connects ok to device addresses such as `/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0` so that suggests that it is not applying any particular tests to the validity.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [9 April 2023 17:15 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/6 "2023-04-09T17:15:27Z")

</div>

Yes, I can confirm this. The marked function in the OP is most likely regarding `list()`. So if you use list, it won't list `ttymxc*` devices. However, you can still connect. I tried this with a symlink.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [9 April 2023 18:06 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/7 "2023-04-09T18:06:06Z")

</div>

If this is docker, then you should be able to rename it to anything you want when you mount it into the container. e.g. `-v /dev/ttymxc2:/dev/ttyUSB0` which should be picked up.

---

<div class="post-metadata">

**Author:** ![GGG](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GGG](https://discourse.nodered.org/u/GGG)\
**Post date:** [10 April 2023 10:33 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/8 "2023-04-10T10:33:19Z")

</div>

thanks to all for the support, I add some information:  
I'm using Node-red 3.02 and node-red-node-serialport 1.03 with docher.  
this is my docker command:

```auto
docker run -d --privileged --group-add dialout --user=root -it -p 1880:1880 -v node_red_data:/data --name mynodered2 --volume /sys:/sys --device /dev/ttymxc2:/dev/ttymxc2 --device /dev/gpiochip0:/dev/gpiochip0 --device /dev/gpiochip1:/dev/gpiochip1 --device /dev/gpiochip2:/dev/gpiochip2 --device /dev/gpiochip3:/dev/gpiochip3 --device /dev/gpiochip4:/dev/gpiochip4 --device /dev/gpiochip5:/dev/gpiochip5 --device /dev/gpiochip6:/dev/gpiochip6 nodered/node-red:latest

```

if I insert a serial port that doesn't exist rightly I have the message in the debug window "/dev/ttymxc9" which doesn't exist I have on debug windows the message "[serialconfig:50974d4a50d9d1ef] serial port /dev/ttymxc9 error: Error: Error: No such file or directory, cannot open /dev/ttymxc9"  
But if I set "\dev\ttymxc2" I have no message in debug window so I think it find it but then node-red crash, this is the log file

```auto
10 Apr 10:30:46 - [info] 

Welcome to Node-RED
===================

10 Apr 10:30:47 - [info] Node-RED version: v3.0.2
10 Apr 10:30:47 - [info] Node.js version: v16.16.0
10 Apr 10:30:47 - [info] Linux 5.4.193-5.7.0+git.f5d73fd6e9f8 arm LE
10 Apr 10:30:54 - [info] Loading palette nodes
10 Apr 10:31:14 - [info] Settings file : /data/settings.js
10 Apr 10:31:14 - [info] Context store : 'default' [module=memory]
10 Apr 10:31:14 - [info] User directory : /data
10 Apr 10:31:14 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Apr 10:31:14 - [info] Flows file : /data/flows.json
10 Apr 10:31:15 - [info] Server now running at http://127.0.0.1:1880/
10 Apr 10:31:15 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

10 Apr 10:31:15 - [info] Starting flows
./entrypoint.sh: line 14: 6 Segmentation fault /usr/local/bin/node $NODEOPTIONS node_modules/node-red/red.js --userDir /data $FLOWS

```

thanks

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [10 April 2023 11:27 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/9 "2023-04-10T11:27:08Z")

</div>

I am really no docker expert. Can you confirm that the error is caused by the serial port?  
Have you tried to access the port outside of the docker, for example with a simple:

```auto
const { SerialPort } = require('serialport')
const port = new SerialPort({path: '/dev/ttymxc2', baudRate: 9600})
console.log(port)

```

---

<div class="post-metadata">

**Author:** ![GGG](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GGG](https://discourse.nodered.org/u/GGG)\
**Post date:** [10 April 2023 13:19 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/10 "2023-04-10T13:19:44Z")

</div>

I tried to acces the port from console, outside docker, with:

stty -F /dev/ttymxc2 9600  
echo Test \> /dev/ttymxc2

and serial port work fine.

inside docker, from container console I tried to put you code inside the file test.js

```auto
const { SerialPort } = require('serialport')
const port = new SerialPort({path: '/dev/ttymxc2', baudRate: 9600})
console.log(port)

```

but I have also segmentation fault:

```auto
bash-5.1# node test.js
Segmentation fault

```

thanks

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [10 April 2023 13:32 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/11 "2023-04-10T13:32:55Z")

</div>

I suggest you run the `test.js` outside of your docker first. Maybe something went wrong during cross-compiling? You are running this on a freescale CPU?

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [11 April 2023 21:13 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/12 "2023-04-11T21:13:49Z")

</div>

Ahh, just noticed this is 32bit ARM, the pre-compiled binaries shipped by the serial-port node (not the Node-RED one, the underlying npm module), you need to manually rebuild them to get them to work.

> <https://github.com/serialport/node-serialport/issues/2438>
>
> \### SerialPort Version
> 
> 10.3.0
> 
> \### Node Version
> 
> v14.19.0
> 
> \### Electron Version…
> 
> \_No response\_
> 
> \### Platform
> 
> Linux raspberrypi 5.10.92-v7+ #1514 SMP Mon Jan 17 17:36:39 GMT 2022 armv7l GNU/Linux
> 
> \### Architecture
> 
> ARM
> 
> \### Hardware or chipset of serialport
> 
> QinHeng Electronics CH340
> 
> \### What steps will reproduce the bug?
> 
> I've created a repository at https://github.com/avakarev/serialport-docker-rpi to reproduce the issue.
> 
> Clone it and then:
> 
> \`make run-v9 # v9.2.8 on rpi\`
> 
> Using serialport ^9.2.8
> serialport/stream opening path: /dev/ttyUSB0 +0ms
> serialport/binding-abstract open +0ms
> serialport/bindings/poller Creating poller +0ms
> serialport/stream opened path: /dev/ttyUSB0 +10ms
> port successfully opened
> 
> \`make docker-run-v9 # v9.2.8 on rpi in docker container\`
> 
> Using serialport ^9.2.8
> 2022-02-23T17:19:07.255Z serialport/stream opening path: /dev/ttyUSB0
> 2022-02-23T17:19:07.256Z serialport/binding-abstract open
> 2022-02-23T17:19:07.266Z serialport/bindings/poller Creating poller
> 2022-02-23T17:19:07.267Z serialport/stream opened path: /dev/ttyUSB0
> port successfully opened
> 
> \`make run-v10 # v10.3.0 on rpi\`
> 
> Using serialport ^10.3.0
> serialport/stream opening path: /dev/ttyUSB0 +0ms
> serialport/bindings-cpp open +0ms
> serialport/bindings-cpp/poller Creating poller +0ms
> serialport/stream opened path: /dev/ttyUSB0 +11ms
> port successfully opened
> 
> \`make docker-run-v10 # v10.3.0 on rpi in docker container\`
> 
> Using serialport ^10.3.0
> 2022-02-23T17:20:48.142Z serialport/stream opening path: /dev/ttyUSB0
> 2022-02-23T17:20:48.144Z serialport/bindings-cpp open
> make\[1\]: \*\*\* \[Makefile:8: \_docker\_run\] Error 139
> 
> \### What happens?
> 
> \`serialport\` exits with 139 and have no stacktrace despite \`DEBUG=serialport\*\`
> 
> \### What should have happened?
> 
> \`serialport\` should successfully open given port
> 
> \### Additional information
> 
> The alpine base image v12 used in demo repo is kinda outdated, but same behavior is met with alpine v14 and v15
> 
> Original discussion started at https://github.com/Koenkk/zigbee2mqtt/issues/11545

We have asked the project to delete the broken binaries so they get built on install (which does work) but they have never answered.

The work around is to run `npm rebuild --build-from-source` in the `/data` directory inside the container.

You can use `-e NODE_RED_SAFE_MODE=true` to get Node-RED to start up in safe mode, it will then not start the flows until the "Deploy" button is clicked. This should give you enough time to run `docker exec -it [container name] /bin/sh` to get a shell in the container.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 June 2023 21:14 UTC](https://discourse.nodered.org/t/dev-ttymxc2-serial-port-name-not-supported/77358/13 "2023-06-10T21:14:23Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
