Hi,
I am trying to use the STM32F401VE MCU with Mbed studio, which already has OS 5 support for STM32F401RE, the difference being that 401VE has a larger ic package and more pins. I’ve added the extra pins (PD and PE) to the PinNames.h for the F401RE, and they do work after that as DigitalIn or DigitalOut pins.
… …
PD_0 = 0x30,
PD_1 = 0x31,
PD_2 = 0x32,
… …
The problem comes when I try to use them as anything else but GPIO pins. For example, as UARTs like Serial pc(PD_5, PD_6). I’ve checked the alternative functions from the datasheet:
And added the alternative functions to the PeripheralPins.c
MBED_WEAK const PinMap PinMap_UART_TX = {
{PA_2, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, // Connected to STDIO_UART_TX
{PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PA_11, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{PB_6, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PD_5, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{NC, NC, 0}
};MBED_WEAK const PinMap PinMap_UART_RX = {
{PA_3, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, // Connected to STDIO_UART_RX
{PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PA_12, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{PB_7, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PC_7, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{PD_6, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{NC, NC, 0}
};
When I try to run the code where I use these alternative functions, the code stops when it reaches an object that is using the PD or PE pins as anything else than DigitalOut or DigitalIn. For example, DigitalOut test(PD_5) works fine, but the Serial test(PD_5, PD_6) will stop the execution.
Is there some other file that I should be configuring as well, or is this the completely wrong approach to this?
Best, Samuli