Custom Baud rate 5787 on Beaglebone black

Hello Everyone,
I have been reading on this topic, regarding setting a non -standard baud rate on beaglebone black. I’m using a waveshare industrial RS-485 to USB converter , product link Industrial USB to RS485 Converter, Original FT232RL and SP485EEN connected via a USB hub.
I’m using node-red to apply custom baud to serial port(5787 bits per second). The application works fine, but after a while the nodes are stuck, can’t be modified and on reset the serial port does not open.
Do we have to configure any scaler related to clock to run custom baud rate? If yes where should we apply the setting or file to?

i don’t think it’s related to the custom baud rate…

Just make sure your doing it thru: stty…

stty -F /dev/ttyX0 567890


Seems like stty is not accepting non-standard baud rates.

debian@beaglebone:~$ stty -F /dev/ttyS2
speed 19200 baud; line = 0;
-brkint -imaxbel
debian@beaglebone:~$ stty -F /dev/ttyS2 9600
debian@beaglebone:~$ stty -F /dev/ttyS2 5787
stty: invalid argument ‘5787’
Try 'stty --help' for more information.

When I set serial node to any standard baud rate

debian@beaglebone:~$ stty -F /dev/ttyUSB0
speed 115200 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

when i set my serial node to non-standard baud rate

debian@beaglebone:~$ stty -F /dev/ttyUSB0
speed 0 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

Oh fun, so it looks like that driver doesn’t really support odd baud rates…

I’d personally check the latest version of the linux driver to see if work has been done with that module…

use lsmod to help figure out which module is used…


usbserial is used in my case.

debian@beaglebone:~$ lsmod
Module                  Size  Used by
pru_rproc              28672  0
irq_pruss_intc         20480  1 pru_rproc
pruss                  16384  1 pru_rproc
pm33xx                 16384  0
wkup_m3_ipc            16384  1 pm33xx
wkup_m3_rproc          16384  1
remoteproc             57344  3 pru_rproc,wkup_m3_rproc,wkup_m3_ipc
virtio                 16384  1 remoteproc
virtio_ring            28672  1 remoteproc
pvrsrvkm              421888  0
pruss_soc_bus          16384  0
rndis_wlan             61440  0
rndis_host             16384  1 rndis_wlan
cdc_ether              16384  1 rndis_host
cfg80211              675840  1 rndis_wlan
option                 45056  0
usb_wwan               20480  1 option
ch341                  16384  0
usbserial              49152  3 option,ch341,usb_wwan
usb_f_acm              16384  2
u_serial               20480  3 usb_f_acm
usb_f_ncm              28672  2
uio_pdrv_genirq        16384  0
usb_f_mass_storage     53248  2
uio                    20480  1 uio_pdrv_genirq
usb_f_rndis            32768  4
u_ether                20480  2 usb_f_ncm,usb_f_rndis
libcomposite           65536  18 usb_f_acm,usb_f_ncm,usb_f_mass_storage,usb_f_rndis
spidev                 20480  0
debian@beaglebone:~$ modinfo usbserial | grep -i version
vermagic:       4.19.94-ti-r73 SMP preempt mod_unload modversions ARMv7 p2v8

Also got to look at the package used by Node-red on Beaglebone Black , it uses serialport(based on javascript)

# SerialPort

Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!

> Go to to learn more, find guides and api documentation.

## Quick Links
- [**Guides**](
- [**API Docs**](
- [The `serialport` package api docs](

### Serialport
- [`serialport`]( Chances are you're looking for the `serialport` package which provides a good set of defaults for
 most projects. However it is quite easy to mix and match the parts of serialport you need.

rather confused, since I’m using Node-red as a service for programming, but the underlying modules are usbserial(Linux module) and (javascript module) serialport

Hi @akhileshthorat so Node-RED and SeriaPort are just nodejs based applications that use the linux kernel driver interfaces… In this case, /dev/ttyUSB0 is:

ch341                  16384  0
usbserial              49152  3 option,ch341,usb_wwan

So it’s the ch341 driver, which is specificaly:

Since your on: 4.19.94-ti-r73

I’d first try to see if this was fixed in later versions. In Debian Buster (10.x) or Bullseye (11.x) i’ve made it easy to test a newer version…

Just run:

sudo apt update
sudo apt install
sudo reboot

and then we can see if the ch341 was fixed…

If you end up needig to go back to the previous kernel, just open /boot/uEnv.txt and change uname_r back to “4.19.94-ti-r73” and reboot… Then run to clean it out…

sudo apt remove --purge

Edit, this looks interesteing… kernel/git/torvalds/linux.git - Linux kernel source tree

It was merged in v5.9.x… Yeah, i’d expect to for v5.10.x to work much better after that specific commit for random baud rates…


After experimenting I realized it’s better to use inbuilt UART of AM335x rather than serial TTL over USB connection.
AM335x allows to set divisors which can give desired baud rate. I found this discussion in TI forum E2E-AM335-Baud-5787

UART baud rate configuration is described in sections and of the AM335x TRM Rev. Q. For 5787bps, if you use 13x oversampling you will get a divisor value of 638 decimal. Then 48MHz / 13 / 638 = 5 787.3bps, which will give a 0.005% baud rate error. This is perfectly acceptable in almost all use cases.

Which file needs to be edited in Beaglebone Black which will set the UART divisor as desired?

How do we access UART registers on Beaglebone Black?