Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4931

ARM Cortex/STM32/"BluePill" port configuration

$
0
0
Hello All,

FIXED AND EDITED TO SHOW THE FIX....

Background:
Pin B10 is configured to turn an LED on and A8 is configured to receive input when the button/switch is pressed.

The following C code does not work:

Code (Text):
  1.  
  2.  
  3. int main(void) {
  4.  
  5.     //Setting Ports A and B as active:
  6.     RCC->APB2ENR = (0x3<<0);
  7.     Defining GPIOA as input on pin 8 by passing 1 into CNF8(2):
  8.     GPIOA->CRH = (0x1<<2);
  9.     //Defining GPIOB as an output on pin 10 by passing 10 into MODE10(8):
  10.     GPIOB->CRH =...
ARM Cortex/STM32/"BluePill" port configuration

Viewing all articles
Browse latest Browse all 4931

Latest Images

Trending Articles



Latest Images