UART data transfer rate

General topics and discussions about the VESC and its development.
boback
Posts: 3
Joined: 05 Jul 2017, 23:09

UART data transfer rate

Postby boback » 09 Jul 2017, 00:04

Hi,

I want to get the state of the vesc (ie COMM_GET_VALUES) over UART using a raspberry pi 3 at a fast rate. Presently, I'm able to get data at most at 15Hz on the RasPi. If I go faster than 15Hz, the data gets corrupted. The VESC firmware is version 2.18. My serial connection settings are this:

Code: Select all

   SerialConfig sc = new SerialConfig();
        sc.device("/dev/ttyAMA0")
                .baud(Baud._230400)
                .dataBits(DataBits._8)
                .parity(Parity.NONE)
                .stopBits(StopBits._1)
                .flowControl(FlowControl.HARDWARE);


Is there a way to query for the VESC values at fast rates, like 50Hz and greater, over UART?

Thanks.

rew
Posts: 924
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: UART data transfer rate

Postby rew » 10 Jul 2017, 07:09

PI3? The broadcom chip has a "lousy" uart and one "even worse". On pi3 it is the lousy one that they used for bluetooth, so the GPIO connector got stuck with the "even worse" one. Add:
dtoverlay=pi3-disable-bt
to /boot/config.txt to get the slightly better one.

boback
Posts: 3
Joined: 05 Jul 2017, 23:09

Re: UART data transfer rate

Postby boback » 11 Jul 2017, 20:08

I did make the swap on the RPI 3 to use the hardware UART on the GPIO pins. I am still only able to achieve a reliable data rate of 15Hz across UART. I was not aware of the limitations of the broadcom chip's UART, which sucks. I am using the PI 3 to do some data processing while the board is moving.

Thanks.

rew
Posts: 924
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: UART data transfer rate

Postby rew » 12 Jul 2017, 05:49

WAIT!
If you have a pi3, you have USB. Why not use USB?

amund7
Posts: 10
Joined: 10 Jul 2017, 08:05
Location: Oslo, Norway
Contact:

Re: UART data transfer rate

Postby amund7 » 12 Jul 2017, 21:01

rew wrote:WAIT!
If you have a pi3, you have USB. Why not use USB?


Exactly. I use PI3, USB, some code I found in github (https://github.com/sphereinabox/bldc-tool/tree/serial-debug), that by default polls around 50 hz, no corruption.

I am going to build a nice GUI on top of it, but first I am going to make it log to CSV, so I can debug my low-RPM low current issues, as well as some torque oscillation issues (need fast logging for that).

boback
Posts: 3
Joined: 05 Jul 2017, 23:09

Re: UART data transfer rate

Postby boback » 13 Jul 2017, 02:17

Awesome that usb on pi 3 gives much better data transfer rates! I'll look into using the usb. Thanks.


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests