2025-02-16 04:35 AM - last edited on 2025-02-17 06:52 AM by SofLit
HAL_UART_Transmit(&huart2, (uint8_t *)"UART OK\r\n", 9, HAL_MAX_DELAY);
filter_config();
if (HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING | CAN_IT_BUSOFF) != HAL_OK) {
HAL_UART_Transmit(&huart2, (uint8_t *)"CAN Notification Fail\r\n", 24, HAL_MAX_DELAY);
Error_Handler();
} else {
HAL_UART_Transmit(&huart2, (uint8_t *)"CAN Notification OK\r\n", 22, HAL_MAX_DELAY);
}
if(HAL_CAN_Start(&hcan1) != HAL_OK){
HAL_UART_Transmit(&huart2, (uint8_t *)"CAN NOT START", 16, HAL_MAX_DELAY);
Error_Handler();
}
else{
sprintf(msg,"Can start");
HAL_UART_Transmit(&huart2, (uint8_t *)"Can Start\r\n", 16, HAL_MAX_DELAY);
}
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_UART_Transmit(&huart2, (uint8_t *)"Can Start\r\n", 16, HAL_MAX_DELAY);
Code formatting applied - please see How to insert source code for future reference.
2025-02-16 04:36 AM
it cannot show anything in tera term
2025-02-16 06:31 AM
Likely not an issue with the code shown. Look elsewhere..
Write a subroutine to output strings.
Check the initialization code, pins, etc.
2025-02-16 07:43 AM - edited 2025-02-16 07:45 AM
> STM32F446RE
So probably the NUCLEO-F446RE board?
What pins are you using? Are they connected to what is sending data to tera term?
2025-02-17 06:51 AM
Can you get it to work without CAN - ie, a project which does purely UART, and nothing else ?