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);
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.