Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MCU monitoring through ADC3 for H750 and H730 based boards #23599

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions libraries/AP_HAL_ChibiOS/AnalogIn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ const AnalogIn::pin_info AnalogIn::pin_config[] = { HAL_ANALOG_PINS };
#if defined(HAL_ANALOG3_PINS) || HAL_WITH_MCU_MONITORING
#if HAL_WITH_MCU_MONITORING
// internal ADC channels (from H7 reference manual)
#define ADC3_VSENSE_CHAN 18
#define ADC3_VREFINT_CHAN 19
#define ADC3_VBAT4_CHAN 17
#ifndef ADC3_VSENSE_CHAN
#define ADC3_VSENSE_CHAN 18
#endif
#ifndef ADC3_VREFINT_CHAN
#define ADC3_VREFINT_CHAN 19
#endif
#ifndef ADC3_VBAT4_CHAN
#define ADC3_VBAT4_CHAN 17
#endif
#define HAL_MCU_MONITORING_PINS {ADC3_VBAT4_CHAN, 252, 3.30/4096}, {ADC3_VSENSE_CHAN, 253, 3.30/4096}, {ADC3_VREFINT_CHAN, 254, 3.30/4096}
#else
#define HAL_MCU_MONITORING_PINS
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/common/stm32h7_type2_mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@
#ifndef STM32_ADC_SAMPLES_SIZE
#define STM32_ADC_SAMPLES_SIZE 16
#endif
#ifndef STM32_ADC_USE_ADC3
#define STM32_ADC_USE_ADC3 TRUE
#endif
#define STM32_ADC_COMPACT_SAMPLES FALSE
#define STM32_ADC_USE_ADC12 TRUE
#define STM32_ADC_ADC12_DMA_PRIORITY 2
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H730xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@

'DEFINES' : {
'HAL_HAVE_HARDWARE_DOUBLE' : '1',
'HAL_WITH_MCU_MONITORING' : '1',
'ADC3_VSENSE_CHAN' : 17,
'ADC3_VREFINT_CHAN' : 18,
'ADC3_VBAT4_CHAN' : 16,
'STM32H7' : '1',
},

Expand Down
1 change: 1 addition & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H750xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

'DEFINES' : {
'HAL_HAVE_HARDWARE_DOUBLE' : '1',
'HAL_WITH_MCU_MONITORING' : '1',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are correct for the H730 not the H750 which is essentially the same as the H743

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, should we add a separate python script for H730?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyp1per feel free to push changes to this branch. I think you have the hardware where you can test this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 @bugobliterator there is a separate python script fro H730

don't think I can push to this branch, but will try

'STM32H7' : '1',
},

Expand Down