cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to run my ADC according to RM0399. In the first steps when I enable the ADC voltage regulator (ADVREGEN in ADC_CR) and check its status through the LDORDY bit in ADC_ISR register the LDORDY bit is never set. Why is that? Did I miss a step?

HTess.1
Associate III

13 REPLIES 13
Piranha
Chief II
SYSCFG->PMCR
*SYSCFG_PMCR

Such redefining has no advantage at all, but has a disadvantage - one can forget the * (pointer dereferencing) somewhere.

uint32_t ISR = *ADC_ISR;

Typically constants are named all upper-case, not variables. At least call the variable, for example, rISR, so that the first lower-case letter tells it's a variable and "r" semantically tells that it holds register data.

Defining globally names like CCR, RES, CONT, CFGR etc. will have many conflicts with other peripherals.

Seriously, why not use CMSIS defined peripheral structures and bit field macros?

Note that I am not saying the following is a valid reason,

I started programming the STM32H7 as a part of the PortentaH7 on Arduino IDE and I found no libraries which were not, at some point, conflicting with Arduino. So since I am lazy I found a random way to define what I needed and I kept it since then.

Still, I take your comment into account and will change my code accordingly (all I need to know about CMSIS is in the programming manual right?)

Read my comment about the same thing in this topic:

https://community.st.com/s/question/0D53W00001VaobUSAR/cant-disable-backup-domain-write-protection-in-pwrcr1

Here is a link for H7:

https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Drivers/CMSIS/Device/ST/STM32H7xx/Include

But Arduino does not redefine registers. They use the same ST's files:

https://github.com/arduino/ArduinoCore-mbed/tree/master/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS

You just had to not invent anything and just use the already provided definitions... ;)

I am grateful for the tips about CMSIS (as a matter of fact I made the beginner mistake described in your post...), I'll take my time reading about it and using it in my code (it might solve some issues linked to my register definitions).

Thanks a lot for your help and time