2024-12-27 12:35 PM
Dear ST Community,
I have the following issue:
I try to start a simple SPI Transmit but it seems that after a first burt of clocks which I observe on the osciloscope, the program gets stack in the Error_Handler, while it shouldn't based on .ioc configuration and the code.
I attach the respective main.c script that describes the situation:
//=====================================System's Code===================================
/* USER CODE BEGIN PTD */
#define BUFFER_SIZE 512
uint8_t txBuffer[BUFFER_SIZE*4];
/* USER CODE END PTD */
//=====================================System's Code====================================
for (uint16_t i = 0; i < BUFFER_SIZE * 4; i++) {
txBuffer[i] = i & 0xFF;
}
if (HAL_SPI_Transmit(&hspi1, txBuffer, BUFFER_SIZE*4, 5000) != HAL_OK) {
Error_Handler();
}
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
BSP_LED_Toggle(LD2);
HAL_Delay(500);
}
/* USER CODE END 3 */
}
//=====================================System's Code====================================
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1)
{
BSP_LED_Toggle(LD1);
HAL_Delay(50);
}
/* USER CODE END Error_Handler_Debug */
}
//=====================================System's Code====================================
Please let me know if you have any suggestions. Thank you!
Best Regards,
Dimitris
2024-12-27 03:08 PM
What error does the function actually return? Understand that in the context of the failure. Source for the library is provided.