Skip to main content
SCook.1
Associate III
May 31, 2022
Solved

What registers on the STM32G4 correspond to CR1 and CR2 on the STM32F1 ADC?

I'm trying to convert 'baremetal' code from the STM32F103 to the STM32G431. I've managed to sort out the GPIO and EXTI stuff, but the ADC is confusing! To start off, what registers on the G4 correspond to CR1 and CR2 on the F1 ADC?

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
May 31, 2022

ADC is the peripheral which varies the most between STM32 families. Given 'F1xx and 'G4xx are on the opposing ends of some 12 years of development, with a dozen of steps in between, I am afraid there's no straighforward mapping between the registers.

In other words, you are probably at or close to the starting point with the 'G4 ADC.

JW

PS. There's a 'G4-ADC-specific appnote out there AN5346 but it deals with the hardware aspects, not software/registers.

3 replies

waclawek.jan
waclawek.janBest answer
Super User
May 31, 2022

ADC is the peripheral which varies the most between STM32 families. Given 'F1xx and 'G4xx are on the opposing ends of some 12 years of development, with a dozen of steps in between, I am afraid there's no straighforward mapping between the registers.

In other words, you are probably at or close to the starting point with the 'G4 ADC.

JW

PS. There's a 'G4-ADC-specific appnote out there AN5346 but it deals with the hardware aspects, not software/registers.

SCook.1
SCook.1Author
Associate III
June 1, 2022

Thank you for your answer, even if it wasn't what I was hoping to hear :) I've decided to try using CubeMX to generate the ADC initialisation code and see if I can work it out from there.

waclawek.jan
Super User
June 3, 2022

I personally prefer reading the RM first, hacking through the cubisms as last resort. ADC used to be described quite concisely in the RMs, even if they are incredibly complex and certainly have their quirks.

JW