3

I am working on VTOL aircraft and currently I am looking for some good board as flight controller (FC). I could made it by myself, but it requests lot of time. I was thinking about one of fpv drone FC (I have avaiable this one:

https://www.banggood.com/cs/Original-Airbot-Omnibus-F4-Pro-V3-Flight-controller-SD-5V-3A-BEC-OSD-Current-Sensor-LC-Filter-p-1319177.html?gmcCountry=CZ&currency=CZK&createTmp=1&utm_source=googleshopping&utm_medium=cpc_bgs&utm_content=lijing&utm_campaign=ssc-cz-cs-all-newcustom-ncv80-1118&gclid=CjwKCAjwqJ_1BRBZEiwAv73uwEgBJQ1B3dcKvZJZy2lR5-wN-XC150Ybn0kZObpUQbgkbvKiN_fY5BoCCVEQAvD_BwE&cur_warehouse=CN

This board has very small dimensions and it has already everything I need. The problem is that it is made for softwares like betaflight etc. It uses STM32 F405 so I tried to add STM 32 support for arduino (https://github.com/stm32duino/Arduino_Core_STM32) and upload arduino code in it.

I had to install stm32 cube programmer and because this board is not one of arduino boards I have to build the code for different board with same processor (FEATHER_F405). Because of it I have to change board pinout in this file (C:\Users\\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\variants\FEATHER_F405). I checked if are those pins correct (in code I command to those pins to be High and then Low while I was measuring them with multimeter). So all the pins are correct. I was able to blik the onboard LED and beep the buzzer. The only problem I have is serial communication. I tried to send some Strings to computer via serial port, but I didnt received any data. Here is sample code that I used:

#include <SoftwareSerial.h>

#define LED 4 //PB_5   //Inverted (High => LED ON)
#define BUZZ 3 //PB_4

#define _RX1 D0 //PA_10
#define _TX1 D1 //PA_9

//#define D_P 35 //PA_11  
//#define D_M 36 //PA_12

//SoftwareSerial mySerial(_RX1, _TX1); // RX, TX
HardwareSerial  hwSerial_1(_RX1, _TX1);   // RX, TX

void setup() {

  hwSerial_1.begin(9600);   
 //mySerial.begin(9600);


  pinMode(LED,OUTPUT);
  pinMode(BUZZ,OUTPUT);

  //pinMode(_RX1,OUTPUT);
  //pinMode(_TX1,OUTPUT);

  //pinMode(D_P,OUTPUT);
  //pinMode(D_M,OUTPUT);
}


void loop() {

  digitalWrite(LED, HIGH);
  /*
  digitalWrite(_RX1, HIGH);
  digitalWrite(_TX1, HIGH);
  digitalWrite(D_P, HIGH);
  digitalWrite(D_M, HIGH);*/

  delay(1000);

  digitalWrite(LED, LOW);
  /*
  digitalWrite(_RX1, LOW);
  digitalWrite(_TX1, LOW);
  digitalWrite(D_P, LOW);
  digitalWrite(D_M, LOW);*/

  delay(1000);

  digitalWrite(BUZZ, HIGH);
  delay(100);
  digitalWrite(BUZZ, LOW);
  delay(1000);

  hwSerial_1.println("HelloWorld");
  //mySerial.println("HelloWorld");

}

I tried to run serial communication via USB and via UART1 (I used USB/ TTL conventer -> FT232), but non of these works. I also tried to use software serial and hardware serial library, but it didnt helped.

Do you have any advices how to make serial communication work?

LucasN
  • 71
  • 4

1 Answers1

3

Sorry for answering this late to this problem but I stumbled on the very same issue. After many hours of debugging, here is what I've found:

  • The default serial (e.g. the serial that you will use through the object Serial) is actually what is labelled RX3 and TX3 on the board and is mapped like so:
    • RX3 -> PB_11
    • TX3 -> PB_10
  • Serial6 is connected through an inverter (5v becomes 0v and vice versa) and can be used as an SBUS line. Serial 6 is mapped like so:
    • RX6 -> PC_7
    • TX6 -> PC_6
  • Serial1 is mapped like so:
    • RX1 -> PA_10
    • TX1 -> PA_9
    • however, PA_10 and PA_11 are not used as UARTs on the FEATHER board. In order to enable them, you can edit the file hardware/stm32/2.3.0/variants/STM32F4xx/F405RGT_F415RGT/PeripheralPins_FEATHER_F405.c.
      • In the array PinMap_UART_TX (line 178), uncomment the line regarding the pin PA_9 and comment the line regarding the pin PB_6.
      • In the array PinMap_UART_RX (line 193), uncomment the line regarding the pin PA_10 and comment the line regarding the pin PB_7.
  • However, if you try to read from this uart you will probably receive garbage data because the Feather F405 board uses a 12MHz external oscillator, when the omnibus F4 uses a 8MHz clock. To fix this, you can go to the files that define the Feather F405 : hardware/stm32/2.3.0/variants/STM32F4xx/F405RGT_F415RGT/variant_FEATHER_F405.h line 178 you will read : #define HSE_VALUE 12000000U. This has to be changed into : #define HSE_VALUE 8000000U.