VESC Arduino UART Stuck in WOT

Support for creating custom user applications on the VESC.
Posts: 2
Joined: 14 May 2018, 01:54

VESC Arduino UART Stuck in WOT

Postby ZFreaky » 14 May 2018, 02:16

Hey guys,

I've got an issue where my VESC stays in Wide Open Throttle if left at WOT for more than a second with the nunchuck set command. It appears that the UART connection locks up as the rpm read stays at one place but the BLDC tool shows it fluctuating. If I swing the throttle back and forth it sometimes breaks out of the lock, but the minimum time it stays in the lock is unacceptable. Now apparently if I limit the rpm in the BLDC tool to before the battery can't push the motor any faster, the issues stops, so it appears to only happen when the motor can't spin to the software rpm limit, could be the VESC breaking itself out of the lock. The throttle indicator in the nunchuck setup screen also locks up, but the mega I'm using as the commanding UART is still responsive, no idea what's causing it, any help would be appreciated.

Code: Select all

#include <SPI.h>
//Using the nRF34 library from
#include <nRF24L01.h>
#include "RF24.h"
#include "printf.h"

//Library for VESC UART
//#define DEBUG
#include "Config.h"
#include "VescUart.h"
#include "datatypes.h"
#include "local_datatypes.h"

RF24 radio(7,8);

//Define variables for remote
struct remotePackage remPack;
bool recOK = true;
uint32_t lastTimeReceived = 0;

uint32_t t1 = 0;
uint32_t t2 = 0;

struct bldcMeasure VescMeasuredValues;

byte counter = 1;

const uint64_t pipes[2] = { 0xABCDABCD71LL, 0x544d52687CLL };
int8_t persXJoy = 0;

void setup() {
  // put your setup code here, to run once:
  //SEtup debug port
  radio.setAutoAck(1);                    // Ensure autoACK is enabled
  radio.enableAckPayload();               // Allow optional ack payloads
  radio.setRetries(0,15);                 // Smallest time between retries, max no. of retries
  radio.setPALevel(RF24_PA_MAX);              // Here we are sending 1-byte payloads to test the call-response speed
  radio.openWritingPipe(pipes[0]);        // Both radios listen on the same pipes by default, and switch when writing

  remPack.valXJoy     = 512; //middle Position
  remPack.valYJoy     = 512;
  remPack.valLowerButton  = 0;
  remPack.valLowerButton  = 0;
  //Serial.println("setup done");

void loop() {
  // put your main code here, to run repeatedly:
//  Serial.println((millis() - t2));
//  if ((millis() - t2) > 10) {
//    VescUartGetValue(VescMeasuredValues);
//    t2 = millis();
//    Serial.println("read");
//  }
  //radio.writeAckPayload(pipes[0], &VescMeasuredValues, sizeof(VescMeasuredValues));
  //byte pipeNo;
  //Get data from TX                                    // Dump the payloads until we've gotten everything
  while ( radio.available(pipes[1])) {, sizeof(remPack));
    radio.writeAckPayload(pipes[0], &VescMeasuredValues, sizeof(VescMeasuredValues));
    recOK = true;

  uint32_t now = millis();

  if (recOK == true)
    lastTimeReceived = millis();

    recOK = false;
  //Check if package were received within timeout
  else if ((now - lastTimeReceived) > 500)
    remPack.valXJoy = 128; //middle Position
    remPack.valYJoy = 128;
    remPack.valUpperButton = false;
    remPack.valLowerButton = false;


Return to “Custom Applications”

Who is online

Users browsing this forum: No registered users and 0 guests