I have this simple inline assembly code:
__asm__ volatile (
".equ GPIOA_ODR, 0x4001080C \n\t" //GPIOA base address is 0x40010800 and ODR offset is 0x0C
//turns on PA8
"ldr r1, =(1 << 8) \n\t"
"ldr r2, =#GPIOA_ODR \n\t"
"str r1, [r2] \n\t"
//turn off PA8
"ldr r1, =0 \n\t"
"ldr r2, =#GPIOA_ODR \n\t"
"str r1, [r2] \n\t"
);
PA8 only oscillates at 2.4MHz, I want a speed of 36MHz. I have tried using timers and reached a speed of 36MHz before but because of some limitations I want to avoid using them.
I'm not understanding why TIMER1 Channel 1 (PA8) can be configured to 36MHz switching speeds, but when I try to do the same in assembly, I only reach a speed of 2.4MHz on the same pin.
I'm also setting up the pin using PinMode(PA8, OUTPUT);
I have tried other variations of this assembly code and only reached up to a maximum of 2.8MHz on PA8. My question is: Is a higher switching speed than 2.4-2.8MHz on a GPIO pin not possible on the STM32f103C8?
(This is a followup question after Need Help Manipulating Registers in Inline Assembly (STM32F103 "BluePill"))