N
N
Noob_12017-11-02 17:01:26
css
Noob_1, 2017-11-02 17:01:26

How and where to get gpio addresses from stm32f103c8t6?

Hello! Today I decided to torment stm and copied the code from habr, adding my library to it (the code works without connecting the stm library):

//#include "stm32f10x.h"
#include "MyLibs/multitool.h"
int main(void)
{
    *((int*)0x40021018) = 0x00000010; // RCC_APB2ENR = RCC_APB2ENR_IOPCEN
    *((int*)0x40011004) = 0x00100000; // GPIOC_CRH = MODER_OUTPUT_13

    while(1)
    {
        *((volatile int*)0x4001100C) ^= 0x00002000; // GPIOC_ODR ^= BIT_13
        //int i; for (i=5000000; i>0; i--) ;
        multi_delay(1000);  
 		}	
}

But I still don’t understand where and how these addresses come from (and yes, I’ve got a datasheet and Yandex) and how it works in general. Please explain who knows. I write the code in Keil.
Don't suggest libraries! I feel bad for them with the arduino ide itself.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
profesor08, 2019-08-08
@profesor08

What needs to be added in the script.js or css file so that the animation does not move when the page is scrolled?

Write a TOR for freelance

N
n12eq3, 2017-11-02
@n12eq3

addresses can be found in the library sources themselves, in the define sections. everything will be - both registers and interrupts and everything else.
however, writing code in this format is only suitable as examples for students to study or for hobbyist enthusiasts. in practice, in real life, this results in a pseudo-effective, not modernized and unsupported feces.

A
Alexander Wolf, 2018-08-11
@mannaro

CMSIS

S
Sergey, 2018-10-06
@Sterling_Archer

It’s probably no longer relevant to you, judging by the date, but it may come in handy for others: take the addresses and 90% of the necessary information here , the remaining 10% - in the documentation for the core and apnotes from STM and ARM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question