Problemas para comunicar com o Baud Rate 5760

Hello,

Excuse my lack of knowledge on the subject as it is the first time I am working with BEAGLEBONE. So I’m trying to communicate with a fuel pump that has a BaudRate of 5760’m using node js in my application. However I can not even configure the serial port with this BaudRate, can anyone help me with this please.

Standard baud rates supported by most serial ports:
# 110
# 300
# 600
# 1200
# 2400
# 4800
# 9600
# 14400
# 19200
# 28800
# 38400
# 56000
# 57600
# 115200

Standard baud rates supported by some serial ports:
# 128000
# 153600
# 230400
# 256000
# 460800
# 921600

is your baud rate somewhere in this chart ?

The baud rate the fuel pump uses is 5760 and I am unable to communicate with her through my application. The same application on fuel pumps with baud rate 9600 works perfectly .

paste a link to this fuel pump

The pump has closed protocol and communicates via current loop, use a serial loop converter to communicate. I have an application that works that way with several pumps market the only problem with this is the BAUDRATE. Does anyone know how to configure the serial port to work with BAUDRATE of 5760? This is my only doubt.

Have you tried 57600?

Hello friend, there is a very big difference between 5760 and 57600, I really need to communicate at the speed of 5760.

att,

The pump has closed protocol and communicates via current loop, use a
serial loop converter to communicate. I have an application that works that
way with several pumps market the only problem with this is the BAUDRATE.
Does anyone know how to configure the serial port to work with BAUDRATE of
5760? This is my only doubt.

5760 is not standard... could it be 57600?

Otherwise there is a baudrate register that must be adjusted.

Harvey

Ok, in order to achieve 5760, you’re going to have to change the UART frequency. Change the clock source, multiplier, etc.

William,

Really need to be 5760, I saw that it is necessary to change the frequency multiplier UART etc … but that’s exactly what I can not do. Can you help me with this?

According to this: http://stackoverflow.com/questions/12646324/how-to-set-a-custom-baud-rate-on-linux

You can set custom baud rate using stty command on linux. For example, to set custom baud rate of 567890 on your serial port /dev/ttyX0 use the command

*stty -F /dev/ttyX0 567890*

This may / may not work. But possibly worth a try. The first answer may also 
work but I've never done this in linux, so could not say for sure.

When running the aforementioned command I received the following feedback

root@beaglebone:/# stty -F /dev/ttyO1 5760

stty: invalid argument `5760’

Try `stty --help’ for more information.

When running the aforementioned command I received the following feedback

root@beaglebone:/# stty -F /dev/ttyO1 5760

stty: invalid argument `5760’

Try `stty --help’ for more information.

Yes, that was mentioned on stackoverflow as a possibility. In which case, you’re going to have to find a way to set the buadrate multiplier. Short of writing an app in C ( as in answer #1 from that link ).

No idea how good your C is, but if decent it should be fairly trivial to write a middleware communications application. Again, I’ve not done this on Linux myself, so . . .

http://www.ti.com/lit/ug/spruh73l/spruh73l.pdf

The available baud rates for UART mode are shown in Table 19-25.

page 4236

seems it cannot be done

you will need to use an external UART that can do that baudrate

http://www.ti.com/lit/ug/spruh73l/spruh73l.pdf

The available baud rates for UART mode are shown in Table 19-25.

page 4236

Those baud rates are not exhaustive.

The 14-bit divisor of the UART baud rate generator allows for a baud
rate from 300bps to 3.7Mbps.

The formula for actual baud rate is:

[1] baud = uartclk / divisor / {16,13}

uartclk is the uart functional clk, and is typically 48MHz.
The Linux serial core shows the uartclk for a given UART port
at /sys/class/tty/<tty of UART>/uartclk. Eg.

peter@black:~$ sudo cat /sys/class/tty/ttyS4/uartclk
48000000

The {16,13} refers to the fixed oversampling divider.
OMAP has 2 selectable, fixed dividers, 16x or 13x. The linux
kernel driver will compute the error for both and pick the
divider with the smallest absolute error.

To compute the divisor for a given baud rate:

[2] divisor = uartclk / (baud * {16,13})

Eg. to compute the divisor for 5760 baud:

        divisor = 48000000 / (5760 * 16) = 520.833 round() => 521
                  48000000 / (5760 * 13) = 641.025 round() => 641

Substituting both divisors into formula [1] to determine the
actual baud rates,

         actual = 48000000 / 521 / 16 = 5758 with error 2
                = 48000000 / 641 / 13 = 5760 with error 0

The linux serial driver will select the 13x fixed divider and a
divisor value of 641 to obtain 5760 baud.

Using the BOTHER method of setting a custom baud rate is roughly
outlined in the stackoverflow link noted by William.

I hacked up a quick test to set this baud rate in an i/o validation
test jig and confirmed with a scope the signal period of ~173.6 us

Regards,
Peter Hurley

Hi Marlon,

On 07/09/2015 07:30 PM, Peter Hurley wrote:> Using the BOTHER method of setting a custom baud rate is roughly

outlined in the stackoverflow link noted by William.

I hacked up a quick test to set this baud rate in an i/o validation
test jig and confirmed with a scope the signal period of ~173.6 us

I understand that was probably too much information :slight_smile:
So I forked the github gist from the stackoverflow answer and cleaned it up.

Here's what you need to do to get this working. At the console prompt on your beaglebone:

$ # install compiler, include files, basic libraries, etc.
$ sudo apt-get install build-essential

$ # get source file from github for program that allows you to set any baud in linux
$ wget https://gist.githubusercontent.com/peterhurley/fbace59b55d87306a5b8/raw/220cfc2cb1f2bf03ce662fe387362c3cc21b65d7/anybaud.c

$ # compile program
$ gcc -o anybaud anybaud.c

$ # run program, but substitute your tty device name
$ ./anybaud /dev/ttyS4 5760

Regards,
Peter Hurley

+1 for community service.

+1 for K.I.S.S. code. I really like how short that bit of code wound up Peter. It is also nice to read a source file at a glance, and immediately be able to tell whats going on. Something many others could stand to work on ( writing short, and readable code ).

Peter,

Thank you or I like to thank you for your help. It worked very well and I’m communicating with the fuel pump. Once again thank you.