GPIO Mapping from libopencm3 to ChibiOS
Posted: Tue Jul 22, 2014 12:16 am
Hi there,
I originally had my application using lipopencm3 instead of the HAL (I am testing out using both) and am simply trying to blink an LED. I have the STM32F417IG LQFP176 and am trying to manipulate pin PA1. This works perfectly fine with libopencm3 when I reference it as (GPIOA, GPIO1), but doesn't work with the HAL when I reference it as (GPIOA, GPIO_PIN1).
And here I believe I have the correct board configuration in board.mk:
Should I not be referencing A1 as (GPIOA, GPIOA_PIN1)? Perhaps there is a different mapping? Any help appreciated.
I originally had my application using lipopencm3 instead of the HAL (I am testing out using both) and am simply trying to blink an LED. I have the STM32F417IG LQFP176 and am trying to manipulate pin PA1. This works perfectly fine with libopencm3 when I reference it as (GPIOA, GPIO1), but doesn't work with the HAL when I reference it as (GPIOA, GPIO_PIN1).
Code: Select all
static WORKING_AREA(wa_blink_thread, 128);
static msg_t blink_thread(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
while (TRUE) {
palSetPad(GPIOA, GPIOA_PIN1);
chThdSleepMilliseconds(500);
palClearPad(GPIOA, GPIOA_PIN1);
chThdSleepMilliseconds(500);
}
return 0;
}
int main(void) {
halInit();
chSysInit();
palSetPadMode(GPIOA, GPIOA_PIN1, PAL_MODE_ALTERNATE(2));
palClearPad(GPIOA, GPIOA_PIN1);
chThdCreateStatic(wa_blink_thread, sizeof(wa_blink_thread), NORMALPRIO, blink_thread, NULL);
while (TRUE) {
// do nothing
chThdSleepMilliseconds(1000);
}
}
And here I believe I have the correct board configuration in board.mk:
Code: Select all
# List of all the board related files.
BOARDSRC = ${CHIBIOS}/boards/ST_STM32F4_DISCOVERY/board.c
# Required include directories
BOARDINC = ${CHIBIOS}/boards/ST_STM32F4_DISCOVERY
Should I not be referencing A1 as (GPIOA, GPIOA_PIN1)? Perhaps there is a different mapping? Any help appreciated.