Skip to main content
SMein.1
Associate II
March 17, 2021
Solved

no write access to ADC12_CCR registers of STM32G473QE

  • March 17, 2021
  • 3 replies
  • 1234 views

Hello,

my problem is that i can't get access to the ADC12_CCR register. I activated the corresponding Clock in the RCC_AHB2ENR register. In addition I compare the addresses of the register from the library with the data of the reference manual, they are the same. I tried the same with the ADC345_CCR register, that access succeeded.

My minimal code is very simple without HAL or LL Library, so it's very clearly to understand.

PS: I also tried it with the HAL library, but the HAL Library also don't get access to this register.

#include "stm32g473xx.h"

void main(void)

{

RCC->AHB2ENR|=RCC_AHB2ENR_ADC12EN;

  ADC12_COMMON->CCR=0x1C0000;

}

This CODE above don't work.

But the following code below is working...

#include "stm32g473xx.h"

void main(void)

{

RCC->AHB2ENR|=RCC_AHB2ENR_ADC345EN;

  ADC345_COMMON->CCR=0x1C0000;

}

I don't no, it's a mysterium. I don't found a reason for a defect in the errata sheet.

Do i have miss some important information from the reference manual? Maybe is the address of the ADC12_CCR register (0x50000208) wrong?

Is there some clock I have to activate in addition?

On further try was with direct addressing of the register

#include "stm32g473xx.h"

void main(void)

{

RCC->AHB2ENR|=RCC_AHB2ENR_ADC12EN;

  *((uint32_t*)0x50000208)=0x1C0000;

}

This topic has been closed for replies.
Best answer by SMein.1

Ok, i find the fault. The address in the STM32G473xx_Peripherals.xml line was wrong.

And with direct addressing in my last minimal code, i also use the wrong address.

in this file #include "stm32g473xx.h" the address is correct and equal to the information given in the Reference Manual.

The .xml File which is used by the debugger from CrossStudio located in C:\Users\"your username"\AppData\Local\Rowley Associates Limited\CrossWorks for ARM\v4\packages\targets\STM32\include\STM32G473xx_Peripherals.xml has the wrong address. I update the address see below and now it works!

Line9728  <RegisterGroup name="ADC12_Common" start="0x50000200" description="Analog-to-Digital Converter"> is wrong

Line9728  <RegisterGroup name="ADC12_Common" start="0x50000300" description="Analog-to-Digital Converter"> is correct

3 replies

SMein.1
SMein.1AuthorBest answer
Associate II
March 19, 2021

Ok, i find the fault. The address in the STM32G473xx_Peripherals.xml line was wrong.

And with direct addressing in my last minimal code, i also use the wrong address.

in this file #include "stm32g473xx.h" the address is correct and equal to the information given in the Reference Manual.

The .xml File which is used by the debugger from CrossStudio located in C:\Users\"your username"\AppData\Local\Rowley Associates Limited\CrossWorks for ARM\v4\packages\targets\STM32\include\STM32G473xx_Peripherals.xml has the wrong address. I update the address see below and now it works!

Line9728  <RegisterGroup name="ADC12_Common" start="0x50000200" description="Analog-to-Digital Converter"> is wrong

Line9728  <RegisterGroup name="ADC12_Common" start="0x50000300" description="Analog-to-Digital Converter"> is correct

waclawek.jan
Super User
March 24, 2021

Thanks for sharing the solution.

You may perhaps want to let Rowley know, too.

JW

ST Technical Moderator
March 26, 2021

Hello @SMein.1​ and welcome to the STM32 Community =)

Thanks for bringing this error to our attention.

I have passed this along to our development team for fix.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks