cancel
Showing results for 
Search instead for 
Did you mean: 

CAN AND UART STM32F446RE

Yakry
Associate II

 

 

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.

6 REPLIES 6
Yakry
Associate II

it cannot show anything in tera term

 

Likely not an issue with the code shown. Look elsewhere..

Write a subroutine to output strings.

Check the initialization code, pins, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

> STM32F446RE

So probably the NUCLEO-F446RE board?

What pins are you using? Are they connected to what is sending data to tera term?

TDK_1-1739720700535.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Can you get it to work without CAN - ie, a project which does purely UART, and nothing else ?

i check it, the clock is mistaken

, thanks

Yakry
Associate II

clock is the problem

 

and thanks for your reply