iMX8M set serial baudrate in Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX8M set serial baudrate in Linux

2,014 Views
gavinl
Contributor I

We would like to take advantage of the high baudrate that iMX8M supports in Linux. What I found out is the stty can only set baudrate to 921600 (stty -F /dev/ttymxc0 921600), it can't set any baudrate higher than it.
I tried to use devmem to directly set /dev/ttymxc0, but the write value doesn't match the read back value. Please help give me a clue. Thanks

echo "devmem write/read to verify"
devmem 0x30860080 32 1
devmem 0x30860084 32 0x4127
devmem 0x3086008c 32 0x7c00
devmem 0x30860090 32 0xa9e
devmem 0x308600a4 32 3
devmem 0x308600a8 32 4
devmem 0x30860080 32 0x2001
devmem 0x308600b8 32 0xa50b
echo "----------"
devmem 0x30860080
devmem 0x30860084
devmem 0x3086008c
devmem 0x30860090
devmem 0x308600a4
devmem 0x308600a8
devmem 0x30860080
devmem 0x308600b8

0 Kudos
4 Replies

1,981 Views
nxf63675
NXP TechSupport
NXP TechSupport

Hi Gavinl,


Modify the baud rate from userspace is not possible, this need to be modifying on the kernel from the core code, you may find helpful the next post:

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Building-Linux-Kernel/ta-p/1110576#toc-h...


Hope this helps you.

Regards,

Israel.

0 Kudos

1,976 Views
gavinl
Contributor I

I know I can change it in kernel space, but don't understand why can't I modified NXP registers in userspace, I can do it in the ARM production from other companies. What makes NXP products can't be modified in userspace?

0 Kudos

2,001 Views
gavinl
Contributor I

Found the supported baudrate in drivers/tty/tty_baudrate.c

static const speed_t baud_table[] = {
	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400,
	4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800,
#ifdef __sparc__
	76800, 153600, 307200, 614400, 921600, 500000, 576000,
	1000000, 1152000, 1500000, 2000000
#else
	500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000,
	2500000, 3000000, 3500000, 4000000
#endif
};

But still don't understand why devmem can't write to memory mapped registers

0 Kudos

2,009 Views
gavinl
Contributor I

with stty -F /dev/ttymxc0 the_baudrate, I can use devmem to verify the UBIR and UBMR registers are programmed.
Don't know why devmem can't write to those registers, I even write a Linux user side program to write memory mapped registers and I can't write to those registers also.
Is there anyone know the reason? I have my program attached.

0 Kudos