If anyone can point out where I've gone wrong I'd appreciate it. Is there a way to query the pins to see if they are setup for their alternate function?
mpconfigboard.h
Code: Select all
#define MICROPY_HW_UART5_PORT (GPIOC)
#define MICROPY_HW_UART5_PINS (GPIO_PIN_12)
Code: Select all
#if defined(UART5) && defined(MICROPY_HW_UART5_PORT) && defined(MICROPY_HW_UART5_PINS)
case PYB_UART_5:
UARTx = UART5;
irqn = UART5_IRQn;
GPIO_AF_UARTx = GPIO_AF8_UART5;
GPIO_Port = MICROPY_HW_UART5_PORT;
GPIO_Pin = MICROPY_HW_UART5_PINS;
__UART5_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.Pin = GPIO_PIN_2;
//GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
//GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
//GPIO_InitStructure.Pull = GPIO_PULLUP;
GPIO_InitStructure.Alternate = GPIO_AF_UARTx;
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
break;
#endif
Code: Select all
#if defined(UART5)
} else if (uart->Instance == UART5) {
HAL_NVIC_DisableIRQ(UART5_IRQn);
__UART5_FORCE_RESET();
__UART5_RELEASE_RESET();
__UART5_CLK_DISABLE();
#endif