murraylang62 wrote on Wednesday, September 19, 2018:
I want to use multiple UARTS simultaneously. I’m currently developing for the STM32F407 Discovery board, but plan to support other platforms later, particularly LPC2468. My development environment is linux+gcc+cmake (using CLion).
I cannot currently see how the signature for the user-supplied function…
void HAL_UART_MspInit(UART_HandleTypeDef *huart);
…gives me the information I need to decide which UART resources to configure. The structure UART_HandleTypeDef doesn’t appear to contain any fields that will tell me.
I suppose I could do something like…
#define NUM_UARTS 2
UART_HandleTypeDef uarts[NUM_UARTS];
...
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{
if (huart == &uarts[0]) {
// Initialisation for first UART here
} else if (huart == &uarts[1]) {
// Initialisation for second UART here
} else if (...) {
}
// etc.
}
…but this seems half-baked to me.
What have I missed? Should I be eating more leafy greens?
EDIT:
Looking around, I see that the function I identified is just an STM32 thing. I forgot that the “HAL” was an STM32 scheme, so maybe this post doesn’t belong in a general FreeRTOS discussion. I’m actually working with the FreeRTOS Labs FreeRTOS_Plus_TCP_and_FAT_STM32F4xxx demo code. Still, maybe somebody out there has a perspective on this problem.
Cheers
Murray