RollingGecko / VescUartControl

Arduino library to interface with the VESC bldc over UART.
Other
141 stars 75 forks source link

Probably does not work with modern firmware #25

Open gitcnd opened 5 years ago

gitcnd commented 5 years ago

For example - COMM_GET_VALUES in fw 3.55+ returns 65 bytes of data. This code expects 54 bytes. The crc etc will of course no longer work...

joseguerr commented 5 years ago

Could not make it work for FW 3.56. If Anyone knows a way of reading data from the new firmware let me know. I'll post here if i know how to do it. In the meantime what version of FW shoud I use?

Peemouse commented 5 years ago

Give my fork a try : https://github.com/Peemouse/VescUart It works for me with FW3.57. However, you'll have to modify the mask for requesting the data you need as I use COMM_GET_VALUES_SETUP_SELECTIVE. For calculating the mask, use the tool "VESC COMMUNICATION.xlsx" available here

joseguerr commented 5 years ago

Thanks for quick the replay @Peemouse

I tried the getFWversion, but no success.. I am using an Arduino mega and used Serial1 as well Rx1 -> 19 and Tx1 ->18. Both baud rates at 115200 and did not change the mask (I know little to nothing of c or c++ but i can learn it). Pins were correctly placed and are giving me 0.5 V for Vesc RX and 3.3V for Vesc Tx. Do you have any idea what can be the problem?

Thank you once again, José

Peemouse commented 5 years ago

Add UART.setDebugPort(&Serial); after UART.setSerialPort(&Serial1); in the example file getFWversion.ino. Load it on your Mega and open the Serial monitor.

joseguerr commented 5 years ago

It is reading! Thank you so much. Also, the ground is making a poor connection with the Arduino board and the signal gets interrutped very often. I will try to read more data from other variables. In the meantime can you indicate me what are the basics of c++ that I need to know to setup up these masks values as well the structure behind this particular code? I only have experience with matlab but with a few guidelines I can learn the basics on my own. Again, thank you so much!

Peemouse commented 5 years ago

Well, for the mask, just use the file I linked to you. I need to add the lines for deserialization so you'll only need to uncomment he ones you're requesting. Let me push it.

Peemouse commented 5 years ago

@joseguerr please update your library with the latest version I just pushed.

joseguerr commented 5 years ago

I have updated the library. When using the getVescValues the rpm and inpVolts are giving me strange values. I do not have the motor connected to the VESC atm.

vesc reading (1)

Is this a common situation? Thank you once again.

Peemouse commented 5 years ago

@joseguerr Could you open an issue on my fork for this ?

flegmatoid commented 5 years ago

I second Joseguers conclusion. v3.58 returns huge values in both idle and running cases. Something about the packet format got changed. I can see lots of integer overflow values (65535 etc.).

joseguerr commented 5 years ago

The code provided is working properly. At the time I was having issues because the grounds were not properly connected. Also, I was using Arduino Mega and one thing it worked for me was to use TX and RX 3, since 1 and 2 were not giving me any decent output. Go check Peemuse's issues, I believe that is the place where the full discussion is. Cheers