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. Commented Sep 28, 2020 at 21:15
  • @Majenko I'm using the "stm32duino" boards, I thought it was connected to Arduino? :S Commented Sep 28, 2020 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. Commented Sep 28, 2020 at 21:35
  • stm32duino.com Commented Sep 29, 2020 at 5:34

1 Answer 1

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 :) Commented Sep 29, 2020 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.