Hello world stm32f0xx Cannot even toggle GPIOS
I’m new to these microcontrollers. All I need is a kickstart to know I have all libraries and compilations in order. I’ve tried toggling pins, using example programs etc. I have no errors or problems when compiling the files. However once I load the “.bin” file, nothing is happening on the board.
I need some help in pointing out what it is I am doing wrong. I’m using the “std_peripheral library”.
I attached complete source code, but in short
Output pins are defined as follows:
- define WASH_LED_PORT GPIOA
- define WASH_LED GPIO_Pin_11
- define SPIN_LED_PORT GPIOA
- define SPIN_LED GPIO_Pin_12
- define PORTA_OUTPUTS (WASH_LED | SPIN_LED)
void gpio_ConfigPortAOutputs(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
GPIO_InitStruct.GPIO_Pin = PORTA_OUTPUTS;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_ResetBits(GPIOA, PORTA_OUTPUTS);
}
//Leds are toggled as below
void gpio_LedCtrl(void)
{
static uint8_t washLedState = LED_OFF;
static uint8_t spinLedState = LED_OFF;
if (sWashLed.LedState != washLedState)
{
washLedState = sWashLed.LedState;
GPIO_WriteBit(WASH_LED_PORT, WASH_LED, sWashLed.LedState);
}
if (sSpinLed.LedState != spinLedState)
{
spinLedState = sSpinLed.LedState;
GPIO_WriteBit(SPIN_LED_PORT, SPIN_LED, sSpinLed.LedState);
}
}
I think the code is fine. I must be doing something else wrong in how I configure the IDE.
Thanks in advance