8 years, 7 months ago.

Where are register definitions of micro

Hello. I'm working on a STM32F411 Nucleo board. I've been looking for a library to do QEI encoder hardware, but none of the found are suitable to me (I do not want normal interrupts, I want specific encoder hardware interrupts). I found one for hardware QEI, but it was for LPC, not for STM32. I will try to make my own library, but I need to know how to access the internal micro registers. I've searched in the handbook most of .h files (I only see .h files but non .c file, don't know if it is normal) but found nothing. In "mbed library internals" it points to CMSIS-CORE, but it is for a LPC again. Where is that file for a STM32?

Can someone point me to the right direction?

Question relating to:

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Thanks for the links, both are interesting.

posted by Vicent Colomar 23 Sep 2015

3 Answers

8 years, 7 months ago.

Try here: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/c9b73cd93427/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/stm32f4xx.h

This file: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/c9b73cd93427/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/system_stm32f4xx.c Does a lot of the system setup to give you an example of how they are used in most of the mbed code.

For what the registers actually do you'll need to refer to the manual for the F411. Click on the design resources link near the top of this page and then scroll down to the reference manual section: http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1877/PF260526#

The names defined in the mbed headers will match the names in the manual.

(For stuff like this it is all in header files rather than.c files but it's generally easier to look in mbed-src when you want to dig into the internals rather than the compiled library version.)

Accepted Answer

Thank you Andy. I revised stm32f4xx.h again, as you suggested, and found it. I was confused because it does the definition in a three step way. It first defines an struct with bitfields, later defines the memory base addres, and finally defines the register with the base addres and the struct.

posted by Vicent Colomar 23 Sep 2015
8 years, 7 months ago.

I don't own/use the Nucleo series of boards - but this thread may help it is for the 'F401 board [if it follows the NXP numbering series - then it should work for the 'F411] https://developer.mbed.org/forum/platform-34-ST-Nucleo-F401RE-community/topic/4963/?page=1#comment-26870 ' also here is a google search for 'F411 qei interrupts document from Microchip http://ww1.microchip.com/downloads/en/DeviceDoc/70063D.pdf ' I do believe there is some information in the /HAL folder for the board, when you import mbed-src into you project. HTH get you down the path - Gary

8 years, 7 months ago.

It looks STMicro does not use "QEI" word, but "TIM Encoder".
Please visit following page....
https://developer.mbed.org/users/mbed_official/code/mbed/file/4f6c30876dfa/TARGET_NUCLEO_F411RE/stm32f4xx_hal_tim.h

Then, search a word "encoder" there.

You are right, I am used to QEI because of Microchip uses that word, but in ARM it is more common Encoder. In Microchip it is an specific peripheral but in ARM the same function is tied to a timer. Thanks for pointing.

posted by Vicent Colomar 23 Sep 2015