thanks alot, but libmaple seems obsolete (according even to their own github readme..). has anyone another clear example of mixed low and higher level timer register settings? It would be much appreciated!
Related to the the forum.
For me, ST core have very easy register access with CMSIS.
For example, sketch from timer example https://github.com/stm32duino/STM32Exam ... etPWM.ino can be edited by:
Code: Select all
is just changing AutoReloadRegister (ARR)
Code: Select all
You can find what registers there are (for example stm32f10xb) at https://github.com/stm32duino/Arduino_C ... #L474-L500
Bit positions in register is in same file, https://github.com/stm32duino/Arduino_C ... xb.h#L3799
All devices have their unique names, https://github.com/stm32duino/Arduino_C ... #L648-L688
Hard part is knowing what registers/bits need to be set to do what you want to do, but that's bare metal way..
well this thread is about bare metal stm programming isn't it, so besides libmaple there is always RM0008alfrond wrote: ↑Thu Nov 26, 2020 4:38 pmthanks alot, but libmaple seems obsolete (according even to their own github readme..). has anyone another clear example of mixed low and higher level timer register settings? It would be much appreciated!
libmaple is nearly as bare (metal) as it can be, u'd need to code the rest yourself
the syntax in libmaple code and official core codes (in particular within HAL) are the examples of how to access registers.
they aren't simply examples, they actually work, the rest takes trial & error to learn them, e.g. try to blink the led from registers, not too difficult an example would be to do a code review of digitalWrite() dig down into the function calls till you see how the registers are accessed,
an IDE helps with this, e.g. doing reference jumps from function to function, eclipse, vscode etc has that
the other thing to get into 'bare metal' programming is get an st-link v2
learn to debug on a live processor
there are lots of blogs and webs about mcu programming e.g.
there is this eclipse plugin i tried
https://mcuoneclipse.com/2017/07/26/emb ... nd-oxygen/
https://sourceforge.net/projects/embsys ... iew/0.2.6/
debugging in eclipse with the plugin added gives a 'pro' view of what happens every instruction, you can step every line of C/C++ code and even the assembly instructions, and embsysregview literally lays out the whole suite of nicely labelled peripheral registers and their realtime values
it is invaluable for troubleshooting and learning stm32
it is possible to do the same with command line gdb and openocd, just more tedious and you won't get that everything on the panel look & feel