Problemas para comunicar com o Baud Rate 5760

417 views
Skip to first unread message

marlon.p...@gmail.com

unread,
Jul 8, 2015, 1:12:48 PM7/8/15
to beagl...@googlegroups.com
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.

evilwulfie

unread,
Jul 8, 2015, 1:23:33 PM7/8/15
to beagl...@googlegroups.com
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 ?




On 7/8/2015 7:20 AM, marlon.p...@gmail.com wrote:
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.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marlon Cesar Pilonetto

unread,
Jul 9, 2015, 10:57:41 AM7/9/15
to beagl...@googlegroups.com
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 .

evilwulfie

unread,
Jul 9, 2015, 11:13:15 AM7/9/15
to beagl...@googlegroups.com
paste a link to this fuel pump

Marlon Cesar Pilonetto

unread,
Jul 9, 2015, 12:39:28 PM7/9/15
to beagl...@googlegroups.com
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.

Jerônimo Lopes

unread,
Jul 9, 2015, 12:57:17 PM7/9/15
to beagl...@googlegroups.com
Have you tried 57600?

Marlon Cesar Pilonetto

unread,
Jul 9, 2015, 1:03:58 PM7/9/15
to beagl...@googlegroups.com
Hello friend, there is a very big difference between 5760 and 57600, I really need to communicate at the speed of 5760.

att,

Harvey White

unread,
Jul 9, 2015, 1:23:01 PM7/9/15
to beagl...@googlegroups.com
On Thu, 9 Jul 2015 09:39:28 -0700 (PDT), you wrote:

>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
>> email to beagleboard...@googlegroups.com <javascript:>.

William Hermans

unread,
Jul 9, 2015, 1:23:17 PM7/9/15
to beagl...@googlegroups.com
Ok, in order to achieve 5760, you're going to have to change the UART frequency. Change the clock source, multiplier, etc.

Marlon Cesar Pilonetto

unread,
Jul 9, 2015, 1:27:42 PM7/9/15
to beagl...@googlegroups.com
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?

William Hermans

unread,
Jul 9, 2015, 1:38:24 PM7/9/15
to beagl...@googlegroups.com
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.

Marlon Cesar Pilonetto

unread,
Jul 9, 2015, 1:51:31 PM7/9/15
to beagl...@googlegroups.com
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.

William Hermans

unread,
Jul 9, 2015, 2:13:41 PM7/9/15
to beagl...@googlegroups.com
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 . . . 

evilwulfie

unread,
Jul 9, 2015, 2:49:20 PM7/9/15
to beagl...@googlegroups.com
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







Peter Hurley

unread,
Jul 9, 2015, 7:30:17 PM7/9/15
to beagl...@googlegroups.com
On 07/09/2015 02:49 PM, evilwulfie wrote:
> 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


> seems it cannot be done
>
> you will need to use an external UART that can do that baudrate
>
>
>
>
>
>
>
>> /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 . . .
>>
>> On Thu, Jul 9, 2015 at 10:51 AM, Marlon Cesar Pilonetto <marlon.p...@gmail.com <mailto:marlon.p...@gmail.com>> wrote:
>>
>> 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.
>>
>>
>> Em quinta-feira, 9 de julho de 2015 14:38:24 UTC-3, William Hermans escreveu:
>>
>> 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/|

Peter Hurley

unread,
Jul 10, 2015, 10:07:29 AM7/10/15
to beagl...@googlegroups.com
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 :)
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

g...@novadsp.com

unread,
Jul 10, 2015, 10:25:51 AM7/10/15
to beagl...@googlegroups.com
+1 for community service.

William Hermans

unread,
Jul 10, 2015, 12:25:01 PM7/10/15
to beagl...@googlegroups.com
+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 ).

Marlon Cesar Pilonetto

unread,
Jul 10, 2015, 4:25:17 PM7/10/15
to beagl...@googlegroups.com
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.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/GC0rKe6rM0g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------------------------------------------------------------
Marlon Cesar Pilonetto
(46) 9112-4963
Pato Branco - PR
-------------------------------------------------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages