2

I'm trying to access registers but I keep getting the "was not declared in this scope" error message. I'm currently using the STM32F1xx boards from http://dan.drown.org/stm32duino/package_STM32duino_index.json

The board package does not seam to recognize any of the registers from the reference manual, mostly trying to access the ADC registers such as 'ADC_CR2'. Does anyone know where I can find the register names which works in the Arduino IDE?

4
  • You probably have to include some special header. No idea what, as it's not anything related to Arduino. – Majenko Sep 28 '20 at 21:15
  • @Majenko I'm using the "stm32duino" boards, I thought it was connected to Arduino? :S – Beacon of Wierd Sep 28 '20 at 21:19
  • stm32duino is a third party package made by Roger Clark. Nothing to do with Ardiuno. Roger's the guy you need to speak to about that core - maybe through github issues if it's hosted there, or find its own forum if there is one. – Majenko Sep 28 '20 at 21:35
  • stm32duino.com – Juraj Sep 29 '20 at 5:34
0

you need to use something like this:

ADC1->CR2 = ... ;

note 2 things:

  • you need to use ADC1, ADC2 ... to access the registers. not just ADC.
  • you need to use arrow (->) operator to access the registers

and you may need to include the header file, something like this :

#include <stm32f030x6.h>

find the proper header file for your MCU. (it's not the same as stm32f1xx, but if proper definitions are made somewhere, it may also work)

1
  • For anyone else having this problem, the registers were called, surprise surprise, ”regs”, so ADC1->regs->CR2. I still would want to know if theres any easy way to see what a struct contains though, for future problems :) – Beacon of Wierd Sep 29 '20 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.