ADC dual mode check incorrect in STM32H7 Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
User avatar
piers
Posts: 42
Joined: Fri Apr 06, 2012 1:02 am
Been thanked: 15 times

ADC dual mode check incorrect in STM32H7

Post by piers »

The check in os/hal/ports/STM32/LLD/ADCv4$ code hal_adc_lld.h line 293 is incorrect (STM32_ADC_USE_ADC1 doesn't exist), and seems superfluous, the same is checked at line 258.

Thanks again for this great project!
User avatar
piers
Posts: 42
Joined: Fri Apr 06, 2012 1:02 am
Been thanked: 15 times

Re: ADC dual mode check incorrect in STM32H7

Post by piers »

Ah, I see now there's more missing from the dual mode implementation.

Here's a patch with some changes to make it at least compile, not tested. Would be nice to add a dual mode test in testhal too.

For the stm32f4 I hacked together a separate multi mode adc driver (adc_multi.c/h in https://github.com/striso/striso-control-firmware), so I'm happy to see on the h7 the support is in ChibiOS itself.
Attachments
patch.zip
(1.32 KiB) Downloaded 442 times
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ADC dual mode check incorrect in STM32H7

Post by Giovanni »

Hi,

Patch applied.

Fixed as bug #1089 however I could not test it.

Giovanni
User avatar
stertingen
Posts: 21
Joined: Mon Jan 13, 2020 10:55 pm
Has thanked: 7 times
Been thanked: 7 times

Re: ADC dual mode check incorrect in STM32H7

Post by stertingen »

Sorry to necrobump this, but the commit containing said fix (dda9f7b8d4 on GitHub) seems to do more that the patch submitted by piers and breaks the build.

To be concrete, the file now uses the defines ADC_ISR_ADRDY instead of ADC_ISR_ADRD, ADC_IER_OVRIE instead of ADC_IER_OVR and ADC_IER_AWD1IE instead of ADC_IER_AWD1. However, the header file os/common/ext/ST/STM32H7xx/stm32h743xx.h defines the previous macros, not the new ones, so the compiler now complains about undeclared identifiers.

I have not checked other MCU headers for their defines, so I'm assuming that the new defines have fixed the build for another MCU.

As a workaround, I currently build with -DADC_ISR_ADRDY=ADC_ISR_ADRD -DADC_IER_OVRIE=ADC_IER_OVR -DADC_IER_AWD1IE=ADC_IER_AWD1.

Edit: This seems to be related to this: https://github.com/ChibiOS/ChibiOS/comm ... 83b60f6689. ChibiOS 19 uses the old ST headers while the ST headers were updated for ChibiOS 20. So the regression fix for the new ST headers somehow slipped back to ChibiOS 19.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ADC dual mode check incorrect in STM32H7

Post by Giovanni »

I could update the headers but there is the risk to break something else, this will need a full test-compile.

Giovanni
User avatar
stertingen
Posts: 21
Joined: Mon Jan 13, 2020 10:55 pm
Has thanked: 7 times
Been thanked: 7 times

Re: ADC dual mode check incorrect in STM32H7

Post by stertingen »

Giovanni wrote:I could update the headers but there is the risk to break something else.

Giovanni


I think it would be easier to revert the regression fix that somehow slipped back to ChibiOS 19. (https://github.com/ChibiOS/ChibiOS/comm ... 83b60f6689)
User avatar
stertingen
Posts: 21
Joined: Mon Jan 13, 2020 10:55 pm
Has thanked: 7 times
Been thanked: 7 times

Re: ADC dual mode check incorrect in STM32H7

Post by stertingen »

Any updates on this?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ADC dual mode check incorrect in STM32H7

Post by Giovanni »

Hi,

It should be fine now.

Giovanni
Post Reply