UART communication from Arduino to Flipsky 6.7 PRO

Hi guys,

i’m using SimpleFOC with Flipsky 6.7 PRO.

Currently, torque or speed references are sent via VSCode extension, i.e. Teleplot, from PC to Flipsky via USB Serial.

The next step is to implement a high-level control system on the Arduino. How do I modify my script on Simple FOC? Knowing the values of the RX and TX pins on Flipsky? Then using the UART.

The portion of the code is the following:
pinMode(USART3_TX, OUTPUT);
pinMode(USART3_RX, INPUT);
serial.begin(115200);
//motor.useMonitoring(Serial);
motor.useMonitoring(serial);
SimpleFOCDebug::enable(NULL);

command.add(‘M’, doCommander, (char*)“my motor”);
//canCommand.add(‘M’, doCommanderCAN, (char*)“motor”);

Hi @Mattia_Polga , welcome to SimoleFOC!

In this scenario, is SimpleFOC running on the FlipSky or on the Arduino?

On the Flipsky consider the velocity/corrent control.

Ok, understood.

So you should use the Flipsky first again with the PC, but this time using the USART and a Serial to USB adapter. In this way you can test and debug the communication much easier than via the Arduino.

Same thing for the Arduino (controller) side - first debug it on the PC.

Then when both a working join them together.

On the FlipSky, you need to figure out which Serial object is the one for your USART pins. Probably Serial is the USB serial, and maybe Serial3 is the USART3 serial?
But it can also depend on which pins you are using.

If you set it up correctly then you can use both:

Commander commander = Commander(Serial3, "\n", false);   // Commander on Serial3
Commander commander2 = Commander(Serial, "\n", true);    // Another commander for debugging on USB serial
...

void setup(){
  Serial.begin(115200); // USB serial
  Serial3.begin(115200); // USART3 serial

  SimpleFOCDebug::enable(Serial); // debug to USB serial
  motor.useMonitoring(Serial3);        // monitoring to USART serial
  ...

Do you have some links for documentation on the FlipSky? And which exact MCU type is on the FlipSky?

I did this but I found a specific error, so the problem is related to the Serial3, as you can see, but Serial3 is defined correctly in HardwareSerial.h.

The following media are the Vesc/Flipsky doc:

Ok, thanks for sharing that. Can you also share the “nrf.sch” schematic?

Which pins are you trying to use for USART?

In ArduinoIDE or Platform IO, which board definition are you using?

The nrf.sch is:

The board in platform.ini is: board = genericSTM32F405RG

For the communcation I want to use the pins TX_SCL_MOSI, 29, PB10, and the RX_SDA_NSS, 30, PB11.