Learning Ardupilot, starting with ESP32

What kind of connections has your Here+ V2. I just read some information on a CUBE forum, that the on board ICM20948 is not directly connected to the external I2C but internal via SPI to an internal STM32F3 micro. Only the compass is emulated as AK09916 for backward compatibility on I2C. So it seems the problem is not on the ESP32 (FC) side but on the Here+ side.
So I think that I cannot solve this.

i will have a look to see if i can find another gps module.

Did you tried again your HGLRC? Is this working with autoconfig on the matek H743. I had somewhere read that it only work upto 115200 Baud. Maybe thats the problem.
In the meantime I have here a version with MPU6050 and AK09916:

the hglrc 5883 works with the matek h743 without issue

the latest firmware you posted looks like the here+ works, i will test it properly tomorrow.


image

Regarding the HGLRC my question is more the GPS itself.
How works it on MATEK H743. Is it auto detected and configured or which are the settings for the SERIAL port?

It was just default settings. I just put a fresh install on it before testing.

Which are the default settings of the Matek H743, I don’t have one?
SERIALx_BAUD for GPS-serial port ?
GPS_AUTO_CONFIG = 1 ?
With my default settings
SERIAL3_BAUD = 115;
SERIAL3_PROTOCOL = 5;
GPS_AUTO_CONFIG = 1;
the ESP32 FC detects my Holybro M10 and changed baudrate to 230400 as expected

Regarding the compass on the HGLRC I am little confused
The linked doc shows type QMC5883P while your picture from MATEK H743 shows QMC5883L
Ardupilot supports both but with different drivers.
So now I have prepared a new firmware which is looking for
IMU MPU6000 series
COMPASS QMC5883L, QMC5883P, AK09916, IST8310

5883 compass is working now but gps is still not detected, its one of the fake ublox modules so i dont know if that is the reason as my genuine M8p works right away.

But the MATEK FC works with the GPS and the ESP doesn’t know anything about GPS handling. It only handles serial and we know it handles the M8p.

What happens if you set
GPS_AUTO_CONFIG = 0;
and try different Baudrates

The here+ module on esp32 and h743 works both AK09916 compass and the genuine ublox m8p GPS is auto detected.

im not bothered about the HGLRC module as it was just the first one that I had for testing, i can use the here+, thinking back I might have had it connected to 3.3v and not 5v, that would explain why the GPS wouldn’t work.

I have the SD card wired in now, and the esp32 and gyro are mounted inside a waterproof box to go in my next rover. I am waiting for more esp32 boards to arrive before i can finish wiring it.

what is the state of the outputs is it PWM only or does IO like relays and buttons work?

Hey Francis,
this sounds good. But I am still interested to solve also the HGLRC problem.
Did you tried to connect the HGLRC via a Serial TTL to USB converter to a PC.
With an normal terminal like TeraTerm you can see if the HGLRC is sending messages and on which baudrate. Than we can try to see the same with a ESP32 GPS Monitor app. If this works the problem is within the ESP32 FC setting or Firmware.
I think a small module like our HGLRC consumes less power than the HERE+ .
Regarding the IOs, at the moment only PWM is enabled. If and how also normal GPIO functions will work I have to evaluate first as I didn’t used this before. I can next week look at this as I am out for the weekend.

Some good news @geofrancis. I just tested my platform by just switching one SERVO_OUT to GPIO (-1) and assign a RELAY to the assigned ESP32 GPIO pinnumber. For example SERVO2_OUT is assigned to Pin 27. With the mission planner SERVO/RELAY tab I was able to switch now the pin verified by an oszilloscope.
And the best part is that this works not only with the pre-assigned PWM outputs but with any ESP GPIO that isn’t otherwise in use.
For example, I was able to successfully demonstrate this using GPIO 2 as RELAY_PIN 2.

that is good news, what about lua??

I only tried lua sometime ago with no success.

There is a pull request which kinda works with lua on ESP32: AP_HAL_ESP32: enable flash scripting on StampFly by muramura · Pull Request #33996 · ArduPilot/ardupilot · GitHub

Thanks for the info. But if I understand the discussion of the PR correct the first approach with flash filesystem wasn’t the best. But in my case a real SD with FAT is available so it might be possible to use this.
I have to experiment a little with this but it is not my main focus at the moment.

Some good news @Vabe @geofrancis. In principle lua scripts are running on ESP32 FC from SDcard.
But I don’t know why but the AP_Scripting/lua_scripts.cpp needs to be modified. On SD card I have folder and file APM/scripts/hello.lua but lua_scripts.cpp get “load script : /SDCARD/APM/scripts/HELLO.LUA” and than runs to a error as upper case “.LUA” is not accepted.

I think the PR I mentioned also changed something regarding the upper and lower case formatting…

Edit: Maybe this is the required change in lua_scripts.cpp:

if ((de->d_name[0] == ‘.’) || strncmp(&de->d_name[length-4], “.lua”, 4)) {

to:

if ((de->d_name[0] == ‘.’) || strncasecmp(&de->d_name[length-4], “.lua”, 4)) {

Yes, you are right, this line needed to be modified.
But the question is why it is necessary on ESP based FC but not on all the other FC.

Can any one give me firmware for esp 32 devkit v1 30 pin connected with MPU 6050 and BMP280 on scl 22 sda 21 and int of MPU is at 14 and ppm input is at 35 along with 4 brushed motor output at 4 , 32,33,25 respectively

i will be glad if i get this i tried but i am always getting error