AM 32 Firmware and PX4

I’ve been using Lumenier 4 in 1 ESC’s for several years now and like them for the heavy duty solder lugs. Anyway, they switched from Blheli firmware to AM32 as Blheli is no longer a viable project. Does anyone know anything about programming an AM32 ESC from a flight controller like the Holybro 6c mini?

Yes I know everything about it lol, my company has used a BetaFlight FC to flash our ESCs and/or change settings for a while. I just added the ability to reflash AM32 from PX4 directly, but it is in a private PX4 repo. It utilizes the DSHOT driver to get “esc_info” but even that needed tweaks to work on AM32. I spoke with the creator of AM32 on their discord and looked at the AM32 source code to figure out the reflash procedure. Then I disable the DSHOT so I can control the GPIO motor pin and use bit-banging to flash firmware. The firmware is pre-loaded into my PX4 firmware as an array. I am hoping to eventually get some of this into main PX4 but not yet sorry.

Using a regular FC, I know BetaFlight supports passthrough mode, which means you plug the BetaFlight FC into USB to your computer, go to am32.ca where they host the configurator, and plug in to the ESC debug/programming port, then you can change settings and reflash AM32 firmware as you please.

The main problem I have at the moment is setting the throttle end points. The ESC won’t calibrate from QGC.

If you’re using DShot, you don’t have to do any calibration.

i use PWM inputs. It’s what I originally learned and has been my default setting all along.

The problem is calibrating the throttle end points. This won’t work in either QGC or Arducopter and I don’t use Betaflight for anything. I may have a faulty ESC or it is ust plain incompatible with the flight controller and oftware I’m using.

Some ESCs don’t support calibration.

However, you can adjust the low, disarmed and high values using parameters, e.g.:

Hi Matt, I know you plan on releasing this upstream but for the meantime I would love any more detail on your implementation. This functionality would be very helpful for my research team.

Here is the PR I made ESC Flasher module for AM32 firmware flashing by MattKow-Firefly · Pull Request #25503 · PX4/PX4-Autopilot · GitHub

It was based on 1.15 and it looks like a few things have changed since then, looking at the ESC_INFO command/response. If you check out the PR I use a few state machines in EscFlasher.cpp, and DShot.cpp that work together. So the AM32 need to be put in bootloader, so you need the DShot to stop sending motor commands first, then follow the method to put each AM32 into bootloader, then switch all the DShot GPIO pins to standard GPIO outputs, and bit-bang using a UART protocol with the correct AM32 commands. You can see how I achieved this in EscFlasher.cpp with the bitbang_send_packet() function. AM32 is open-source so you can see how that bootloader operates. I think it is this GitHub - AlkaMotors/AM32_Bootloader_F051

And you need the compiled AM32 binary with whatever standard version or tweaks you are using. We built one with some custom settings so in my PR you see an array that holds the .bin file in AM32Firmware.c, please don’t use this lol! This PR is a WIP and was just meant to be viewed for now, someone who is more familiar with PX4 is working on the ESC flashing capability separately now. Once the reflashing through the AM32 bootloader is done for all 4, then command each ESC to run its firmware/app, then re-enable the DShot.cpp driver and be sure to re-initialize the GPIOs for that, then you should be done! Let me know if this helps.

@dakejahl is working on implementing dshot programming support in upstream.