Skip to content
Open
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
5 changes: 5 additions & 0 deletions .github/workflows/stm32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- STMicroelectronics:stm32:Disco:pnum=B_G431B_ESC1 # B-G431-ESC1
- STMicroelectronics:stm32:Nucleo_144:pnum=NUCLEO_H723ZG # stm32h7
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_G431RB # stm32g4
- STMicroelectronics:stm32:GenG0:pnum=GENERIC_G030C8TX # stm32g0

include:
- arduino-boards-fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 # bluepill - hs examples
Expand Down Expand Up @@ -61,6 +62,10 @@ jobs:
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
sketch-names: single_full_control_example.ino, stm32_spi_alt_example.ino, double_full_control_example.ino, stm32_current_control_low_side.ino, custom_motion_control.ino

- arduino-boards-fqbn: STMicroelectronics:stm32:GenG0:pnum=GENERIC_G030C8TX # stm32g0 compile regression
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
sketch-names: step_dir_listener_simple.ino

# Do not cancel all jobs / architectures if one job fails
fail-fast: false
steps:
Expand Down
9 changes: 5 additions & 4 deletions src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ ADC_TypeDef* _findBestADCForInjectedPins(int numPins, int pins[], ADC_HandleType
SimpleFOCDebug::print(i+1);
SimpleFOCDebug::print(" pins: ");
SimpleFOCDebug::println(pins_at_adc[i]);
#if defined(LL_ADC_INJ_TRIG_SOFTWARE)
if (adc_handles[i].Instance != NP) {
// check if ADC injeted is already in use
if(!LL_ADC_INJ_IsTriggerSourceSWStart(adc_handles[i].Instance)) {
Expand All @@ -194,15 +195,18 @@ ADC_TypeDef* _findBestADCForInjectedPins(int numPins, int pins[], ADC_HandleType
SimpleFOCDebug::println(" already in use for injected channels!");
}
}
#endif
}
#endif

// now take the first ADC that has all pins connected
for (int i = 0; i < ADC_COUNT; i++) {
#if defined(LL_ADC_INJ_TRIG_SOFTWARE)
if (adc_handles[i].Instance != NP) {
if (!LL_ADC_INJ_IsTriggerSourceSWStart(adc_handles[i].Instance))
continue; // ADC already in use for injected
}
#endif
if (pins_at_adc[i] == no_pins) {
return _indexToADC(i);
}
Expand Down Expand Up @@ -670,9 +674,6 @@ float _readRegularADCVoltage(const int pin){
#ifdef ADC_OFFSET_NONE
sConfig.OffsetNumber = ADC_OFFSET_NONE;
#endif
#ifndef STM32F1xx
sConfig.Offset = 0;
#endif

if (HAL_ADC_ConfigChannel(&hadc[adc_index], &sConfig) != HAL_OK) {
#ifdef SIMPLEFOC_STM32_DEBUG
Expand Down Expand Up @@ -715,4 +716,4 @@ float _readRegularADCVoltage(const int pin){
return -1.0f;
}

#endif
#endif
Loading