2024-08-09 10:57 AM
I have a project on a H563ZI Nucleo board, and noticed an issue when I enable both the Board Support Package (BSP) options and ThreadX.
The MX-generated code in main.c places the BSP initialisation after the call to MX_ThreadX_Init() - see snippet below. This means the BSP code is unreachable and the components are not initialised.
The workaround is simple (copy the BSP code into the USER CODE 2 section), but it should probably be looked at.
Snippet of automatically MX-generated code from main.c:
/* USER CODE END 2 */
MX_ThreadX_Init();
/* Initialize leds */
BSP_LED_Init(LED_GREEN);
BSP_LED_Init(LED_YELLOW);
BSP_LED_Init(LED_RED);
/* Initialize USER push-button, will be used to trigger an interrupt each time it's pressed.*/
BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI);
/* Initialize COM1 port (115200, 8 bits (7-bit data + 1 stop bit), no parity */
BspCOMInit.BaudRate = 115200;
BspCOMInit.WordLength = COM_WORDLENGTH_8B;
BspCOMInit.StopBits = COM_STOPBITS_1;
BspCOMInit.Parity = COM_PARITY_NONE;
BspCOMInit.HwFlowCtl = COM_HWCONTROL_NONE;
if (BSP_COM_Init(COM1, &BspCOMInit) != BSP_ERROR_NONE)
{
Error_Handler();
}
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
2024-08-12 03:42 AM - edited 2024-11-13 06:11 AM
Hello @nicgreenway
Thank you for bringing this issue to our attention. An internal ticket has been escalated internally (196203 for internal follow-up) and it will be fixed as soon as possible.
Thx
Souhaib