I’m trying to repurpose the RSSI_IN port on my Pixhawk 6C Mini to be a general purpose ADC input. However the sampling rate is too low to accomplish what I’m trying to do. However I’m having some issues getting this to work.
Researching around, I’ve identified the steps that’s needed to get this working:
Update ./libraries/AP_IOMCU/iofirmware/analog.cpp:adc_init() to use a lower sample time, I.e. ADC_SAMPLE_13P5
Build the IO processor firmware using ./Tools/scripts/build_iofirmware.py
Flash the IO processor with bin/iofirmware_lowpolh
Is there a way to up the sampling rate, without needing to modify the firmware?
Is there a way to flash the IO processor without the need for an external SWD debugger?
(The Pixhawk6C Mini IO debugger is exposed via testpoints on the PCB, rather then a dedicated JST port)
Are there any other pins on the flight controller that can be repurposed to read in a 3.3V ADC signal?
Can anyone confirm if this is the (only) line within analog.cpp that needs to be changed?
I can’t remap the ADC_1 lines, as those are currently used to monitor the battery.
However for the ADC_3 line, I think its only used internally or something, as I can’t find any [documentation]( Pixhawk 6C Mini Ports - Holybro Docs) that links them to an exposed port.
I’m migrating away from the Pixhawk 2.4.8 flight controller, which has two dedicated ADC port that samples at 10 ms.
Attached to the ADC port is a variable resistor that measures the angle at which the motor is currently positioned at. Given the high RPM of the motor, and the precision I need to monitor it at, I would like to bring the sampling rate down to 10 ms, as to limit the changes needed when migrating.