Skip to main content
Associate
June 19, 2023
Solved

How to select ADC clock source for STM32L476RG

  • June 19, 2023
  • 3 replies
  • 4813 views

I have been reading the RM0351 trying to figure out how to setup the clock source for the ADC.
The reference manual says that I could choose the system clock, PLLSAI1, or the PPLSAI2
as the asynchronous clock source for the ADC (see figure 1). It also shows that there is a mux that I presume allows the programmer to select between the three clocks. I am trying to configure the ADC at the register level (just for fun) but my problem is that I can't seem to find any information on the registers that controls the MUX to select between the 3 clocks mentioned above. I thought for sure the MUX must exist because the STM32CubeIDE even shows it in the ".ioc" GUI under clock configuration (see figure 3).

How do I select between the three clock sources mentioned above using register level manipulation?

watt_up_0-1687212849914.png

Figure 1: Reference manual stating users can choose between  system clock, PLLSAI1, or the PPLSAI2
as the asynchronous clock source for the ADC

watt_up_2-1687213287322.png

Figure 2 Refence manual showing a MUX to choose ADC clock source.

 

watt_up_3-1687213689292.png

Figure 3: STM32CudeIDE showing the MUX to select ADC clock source.

 

 


 

This topic has been closed for replies.
Best answer by AScha.3

you set it in Cube....dont trust in Cube ?

ok, set registers...RCC_CCIPR -> ADCSEL 2b

AScha3_0-1687246442704.png

 

3 replies

waclawek.jan
Super User
June 20, 2023

I don't have the RM open at the moment, but search for ADC  in the RCC registers description.

JW

watt_upAuthor
Associate
June 20, 2023

Thank you for your response. How did you know to look there?

waclawek.jan
Super User
June 20, 2023

> How did you know to look there?

The problem is, that STM32 are SoC thrown together from modules, and the "thrown together" part is poorly explained. That's what "product level" means - the ADC chapter's author does not know and does not care how will the async clock be generated.

For years I am trying to explain ST that they need to clearly, unambiguously, using uniform terminology and signals/registers naming, explain *all* internal interconnections, i.e. the Interconnections chapters in RMs (not in all, only newer STM32 RMs have it) are grossly inadequate.

So, we can call it experience, I guess.

JW

AScha.3
AScha.3Best answer
Super User
June 20, 2023

you set it in Cube....dont trust in Cube ?

ok, set registers...RCC_CCIPR -> ADCSEL 2b

AScha3_0-1687246442704.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
watt_upAuthor
Associate
June 20, 2023

Thank you its there indeed. Boy... I wasted a lot of time looking for that register. Maybe I'll use the Cube next time :)

May I ask how did you know its there?

waclawek.jan
Super User
June 20, 2023

Cube (more precisely, CubeMX) won't tell you where that register is, either. You are supposed to click and trust :)

JW