USB-UART Module Kit does not work with Odroid M1 on MacOS

Post Reply
dhns
Posts: 10
Joined: Sat Jun 04, 2022 7:53 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 1 time
Contact:

USB-UART Module Kit does not work with Odroid M1 on MacOS

Post by dhns »

I bought an Odroid M1 unit which boots fine with HDMI.
And I connected an USB-UART Module Kit which is said to be compatible.
The driver installation of "CP210x Macintosh OS VCP Driver v6" on MacOS 10.14 was simple and the uart port is available at /dev/cu.SLAB_USBtoUART.

But it does not work. I get scrambled characters on the screen.

The reason seems to be that the M1 by default uses 1.5Mbps while the CP2102N on the UART module is not capable of running at this baud rate.
This is noted on https://wiki.odroid.com/accessory/devel ... b_uart_kit only for Linux.

I tested all baudrates I could set through stty speed and only the following speeds are available:
150 ok
200 ok
300 ok
600 ok
1200 ok
1800 ok
2400 ok
4800 ok
7200 ok
9600 ok
14400 ok
19200 ok
28800 ok
38000 ok
38400 ok
57000 ok
57600 ok
76800 ok
115000 ok
115200 ok
230000 ok
230400 ok
460000 ok
460800 ok
920000 ok
921000 ok
921600 ok
1840000 ok
1843200 ok

Obviously 92xx00 is too slow and 18xx00 is too fast.

And, the table differs from what "Table 4.1. Data Formats and Baud Rates" of the CP2102 data sheet (https://www.silabs.com/documents/public ... asheet.pdf) says.

And on a Linux system it appears to work setting 1.5Mbps ttyUSB0 baud rate.

So I have questions:
a) how can I make the USB-UART Module Kit run at 1.5Mbps?
b) since I assume this is a hardware limitation, how can I change the serial interface speed on the Odroid M1 µSD/eMMC image?
c) has anyone managed to run the USB-UART Module Kit on MacOS with the Odroid M1?

If it is important (e.g. diffferent versions), the sticker on the package says: "ODROID-U3 USB-UART MODULE"
Last edited by dhns on Wed Jun 08, 2022 5:25 pm, edited 1 time in total.

drolid
Posts: 15
Joined: Fri May 06, 2022 3:52 am
languages_spoken: english
ODROIDs: M1
Has thanked: 6 times
Been thanked: 6 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by drolid »

Try with picocom - https://forum.radxa.com/t/macos-pi-4-e-s-working-1-5mbps-ttl-baudrate-with-picocom
or
Virtualbox Linux - redirect the USB UART to the VM

User avatar
rooted
Posts: 9499
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 761 times
Been thanked: 486 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by rooted »

Have you disabled hardware flow on the client?

drolid
Posts: 15
Joined: Fri May 06, 2022 3:52 am
languages_spoken: english
ODROIDs: M1
Has thanked: 6 times
Been thanked: 6 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by drolid »

rooted wrote:
Mon Jun 06, 2022 4:42 am
Have you disabled hardware flow on the client?
Using native MacOS driver

Code: Select all

stty -f /dev/cu.usbserial-0001 9600   (works)

stty -f /dev/cu.usbserial-0001 1500000 
stty: tcsetattr: Invalid argument

cu --line=/dev/cu.usbserial-0001 --baud=1500000
cu: Unsupported baud rate 1500000
Using Silicon Labs CP210xVCP Driver

Code: Select all

➜  ~ sudo cu --line=/dev/cu.SLAB_USBtoUART --baud=1500000
cu: Unsupported baud rate 1500000

➜  ~ stty -f /dev/cu.SLAB_USBtoUART 1500000
stty: tcsetattr: Invalid argument
➜ ~ brew install picocom

Code: Select all

==> Downloading https://ghcr.io/v2/homebrew/core/picocom/manifests/3.1_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/picocom/blobs/sha256:bcf999f8a5
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Pouring picocom--3.1_1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/picocom/3.1_1: 7 files, 152.5KB
==> Running `brew cleanup picocom`...
➜ ~ picocom -b 1500000 -d 8 /dev/cu.SLAB_USBtoUART

Code: Select all

picocom v3.1

port is        : /dev/cu.SLAB_USBtoUART
flowcontrol    : none
baudrate is    : 1500000
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready
DDR Version V1.09 20210630
In
ddrconfig:7
LPDDR4X, 324MHz
BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=8 Size=8192MB
tdqss: cs0 dqs0: 24ps, dqs1: -96ps, dqs2: -48ps, dqs3: -144ps, 
tdqss: cs1 dqs0: 48ps, dqs1: -96ps, dqs2: -48ps, dqs3: -144ps, 

change to: 324MHz
PHY drv:clk:36,ca:36,DQ:29,odt:60
vrefinner:16%, vrefout:41%
dram drv:40,odt:0
clk skew:0x61

change to: 528MHz
PHY drv:clk:36,ca:36,DQ:29,odt:60
vrefinner:16%, vrefout:41%
dram drv:40,odt:0
clk skew:0x58

change to: 780MHz
PHY drv:clk:36,ca:36,DQ:29,odt:60
vrefinner:16%, vrefout:41%
dram drv:40,odt:0
clk skew:0x58
➜ ~ system_profiler SPUSBDataType | grep UART -A 10

Code: Select all

        CP2102N USB to UART Bridge Controller:

          Product ID: 0xea60
          Vendor ID: 0x10c4  (Silicon Laboratories, Inc.)
          Version: 1.00
          Serial Number: 0001
          Speed: Up to 12 Mb/s
          Manufacturer: Silicon Labs
          Location ID: 0x14300000 / 2
          Current Available (mA): 500
          Current Required (mA): 100

dhns
Posts: 10
Joined: Sat Jun 04, 2022 7:53 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by dhns »

drolid wrote:
Mon Jun 06, 2022 4:18 am
Try with picocom - https://forum.radxa.com/t/macos-pi-4-e-s-working-1-5mbps-ttl-baudrate-with-picocom
or
Virtualbox Linux - redirect the USB UART to the VM
It is not an issue of the terminal program but of the cp210x driver. The stty command fails.

I use femtocom (and other tools): https://git.goldelico.com/?p=letux-kern ... /rootfs-v7

Well, Virtual Linux might work but seems to be an overkill since all other devices I connect to this machine through USB-Serial adapters work without. And accessing the Virtual Linux shell from the Mac Terminal command line isn't trivial either.

The third option would be to adapt the Odroid M1 setup - but how? Which parameter in boot.scr is responsible?
Last edited by dhns on Mon Jun 06, 2022 2:58 pm, edited 3 times in total.

dhns
Posts: 10
Joined: Sat Jun 04, 2022 7:53 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by dhns »

drolid wrote:
Mon Jun 06, 2022 4:59 am
Using native MacOS driver

Code: Select all

stty -f /dev/cu.usbserial-0001 9600   (works)

stty -f /dev/cu.usbserial-0001 1500000 
stty: tcsetattr: Invalid argument

cu --line=/dev/cu.usbserial-0001 --baud=1500000
cu: Unsupported baud rate 1500000
Using Silicon Labs CP210xVCP Driver

Code: Select all

➜  ~ sudo cu --line=/dev/cu.SLAB_USBtoUART --baud=1500000
cu: Unsupported baud rate 1500000

➜  ~ stty -f /dev/cu.SLAB_USBtoUART 1500000
stty: tcsetattr: Invalid argument
Yes, that is exactly what I get. I used the last command in a loop to derive the list of the available baud rates. Try

Code: Select all

stty -f /dev/cu.SLAB_USBtoUART 1843200
So it is some bug or limitation of the CP210x driver and tcsetattr() syscall.

drolid
Posts: 15
Joined: Fri May 06, 2022 3:52 am
languages_spoken: english
ODROIDs: M1
Has thanked: 6 times
Been thanked: 6 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1 on MacOS

Post by drolid »

So it is some bug or limitation of the CP210x driver and tcsetattr() syscall.
It seems like it's a MacOS limitation.
https://apple.stackexchange.com/questio ... e-1-5mbaud

It is not an issue of the terminal program but of the cp210x driver. The stty command fails.
It's not, but it'll work on that speed correctly (as shown above) with the native or silabs driver using a terminal like picocom.

The third option would be to adapt the Odroid M1 setup - but how? Which parameter in boot.scr is responsible?
You'll have to wait for @tobetter or @odroid to answer this.
These users thanked the author drolid for the post:
dhns (Tue Jun 07, 2022 4:49 am)

dhns
Posts: 10
Joined: Sat Jun 04, 2022 7:53 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by dhns »

Ah, interesting. Indeed, it looks as if it is an IOKit limitation (maybe by wanting to be 100% POSIX compatible) by the static struct speedtab iossspeeds[] table and not really the silabs driver.

Now I wonder if picocom really works - at least if it uses an tcsetattr() syscall. Or does picocom circumvent the OS kernel or drivers?
The answer is yes by digging into the code: https://github.com/npat-efault/picocom/ ... _bsd.c#L92
And https://opensource.apple.com/source/IOS ... lTestLib.c

This means that tcsetattr() (used by stty or femtocom) does not know about the ioctl(IOSSIOSPEED) trick like picocom does.

I'll try to add that to femtocom...

Thanks!

User avatar
odroid
Site Admin
Posts: 39238
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2565 times
Been thanked: 1407 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by odroid »

Since we have no experience of using any Apple computers (except for extremely old Apple //e and iMac G3 CRT version in 20th century), it is very hard to say what's wrong in your system.

dhns
Posts: 10
Joined: Sat Jun 04, 2022 7:53 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by dhns »

odroid wrote:
Tue Jun 07, 2022 10:38 am
Since we have no experience of using any Apple computers (except for extremely old Apple //e and iMac G3 CRT version in 20th century), it is very hard to say what's wrong in your system.
Well, what is wrong (or a limitation) on MacOS is that a speed of 1.5 Mbps can not be set by standard commands (stty).
But communication has always two ends.
So what would be the proper way to change the 1.5 Mbps of the Odroid M1 to a different speed?

User avatar
odroid
Site Admin
Posts: 39238
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2565 times
Been thanked: 1407 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by odroid »

Because the default baud rate seems to be hard-coded here and there, I don't think we can find a simple way to change it probably.
petitboot, uboot, kernel parameters might need to be changed. @tobetter will be confirm that.

Anyway, can you try installing Picocom with "--build-from-source" option?
https://forum.radxa.com/t/macos-pi-4-e- ... com/8121/3

dhns
Posts: 10
Joined: Sat Jun 04, 2022 7:53 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by dhns »

odroid wrote:
Tue Jun 07, 2022 3:07 pm
Because the default baud rate seems to be hard-coded here and there, I don't think we can find a simple way to change it probably.
petitboot, uboot, kernel parameters might need to be changed. @tobetter will be confirm that.

Anyway, can you try installing Picocom with "--build-from-source" option?
https://forum.radxa.com/t/macos-pi-4-e- ... com/8121/3
I am not using picocom myself. Just femtocom and I could make it work with 1.5 Mbps. Was ca. 5 lines of code. So no need to play with other host tools.

What I want to do is to play with the Odroid M1... Hm. Is it so difficult to change baud rates?

User avatar
odroid
Site Admin
Posts: 39238
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2565 times
Been thanked: 1407 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by odroid »


User avatar
tobetter
Posts: 10043
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 640 times
Been thanked: 1714 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by tobetter »

dhns wrote:
Tue Jun 07, 2022 6:02 pm
odroid wrote:
Tue Jun 07, 2022 3:07 pm
Because the default baud rate seems to be hard-coded here and there, I don't think we can find a simple way to change it probably.
petitboot, uboot, kernel parameters might need to be changed. @tobetter will be confirm that.

Anyway, can you try installing Picocom with "--build-from-source" option?
https://forum.radxa.com/t/macos-pi-4-e- ... com/8121/3
I am not using picocom myself. Just femtocom and I could make it work with 1.5 Mbps. Was ca. 5 lines of code. So no need to play with other host tools.

What I want to do is to play with the Odroid M1... Hm. Is it so difficult to change baud rates?
Stay tuned... Instructions to set 115200bps will come soon.

User avatar
tobetter
Posts: 10043
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 640 times
Been thanked: 1714 times
Contact:

Re: USB-UART Module Kit does not work with Odroid M1

Post by tobetter »

@dhns, a new kernel package is uploaded that can support 115200bps. But please note you are still limited to capturing full logs through the UART port since 2 out of 4 booting layers cannot change their baud rate by a command.

1. SPL (Bootloader) - 1.5Mbps only (cannot be changed)
2. U-Boot - 1.5Mbps (default) or 115200bps (command)
3. Petitboot - 1.5Mbps only (cannot be changed)
2. Linux kernel - 1.5Mbps (default) or 115200bps (command)

Baudrate change for U-Boot:
In the command line of Petitboot, run fw_setenv baudrate 115200 and reboot your ODROID-M1.

Baudrate change for Linux kernel
New kernel package needs to be updated first using sudo apt update && sudo apt upgrade, so your current version is:

Code: Select all

$ dpkg -l | grep linux-image
ii  linux-image-4.19.219-odroid-arm64          4.19.219-202206071843~focal         arm64        Linux 4.19 for ODROID (64-bit ARMv8 machines)
$ uname -a
Linux server 4.19.219-odroid-arm64 #1 SMP Tue, 07 Jun 2022 09:47:14 +0000 aarch64 aarch64 aarch64 GNU/Linux
And change the file /boot/config.ini and add ttyfiq0_115200 to the line of overlays so it will be like this. The change will affect after rebooting.

Code: Select all

overlays="i2c0 i2c1 spi0 ttyfiq0_115200"
These users thanked the author tobetter for the post (total 3):
dhns (Tue Jun 07, 2022 11:05 pm) • drolid (Tue Jun 07, 2022 11:50 pm) • odroid (Wed Jun 08, 2022 8:50 am)

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 0 guests