hitachii wrote: Tue Apr 26, 2022 5:48 am
...
Using the following code from the next linked page, I tried to do the same for the STM32 but I got a flag that PORTB has no member named "regs" (I get the same for PORTA).
Code: Select all
PORTA->regs->CRL = (PORTA->regs->CRL & 0x00F00F00) | 0x88000080 |0x00033003;
https://gist.github.com/iwalpola/6c36c9 ... 0a118571ca
So now I'm a little stuck. Any suggestions for libraries, code, or reading PORTB is welcome. Thank you.
I think you have two problems there.
Firstly, I guess you are using the official ST core (good choice), while what you found there was was written for core derived from Libmaple (the "Roger" core and cousins). In other cores they did their own thing to define the processor registers. So, for example for the GPIO input data register you would need something like PORTA->IDR instead of GPIOA->regs->IDR as shown on the page you found.
Secondly, when you are working at that level, you are exposed to differences between the different STM32 processor families. As far as I know, STM32F4 processors don't have CRL/CRH registers for GPIO, but instead have other registers which hold the equivalent settings.