2024-02-13 10:55 AM - edited 2024-02-13 10:56 AM
Hello,
I am using stm32F407VGT board and I am trying to receive data from a can analyzer with stm32 board. I transmit a data to stm32 boards but ı cant receive the messages. I can work on normal mode with two stm32 boards succesfully. The messages are received and transmitted. At the same time, I want to transmit data to can analyzer and I want to observe communication. I attached my main and interrupt source files and I am using USB-CAN analyzerV8 device. The can bps values are the same 500kbps. The modes are same as Normal Mode and I dont define a filter so ı can read every data that ı sent from can analyzer in live expression on debug screen.
Summarize,
All my purpose, I want to see data that ı sent from can analyzer in my live expression part. I am sending one message fisrtly so there is a one Id.
2024-02-14 8:29 AM
By the way, If my can transciever circuit mcp2551 is wrong, How can I communicate with two stm32 board ? Could you show me an example transciever circuit with MCP2551 ? I will use that
2024-02-14 8:37 AM
See this thread the picture shared by the community member on his first post.
2024-02-14 8:56 AM
Thank you
I changed the terminal resistor with 120ohm on my can circuit and It still doesnt work. I cant understand my boards can communicate but why the analyzer can't ? I attached my can transciever circuit . I changed 60 ohm with 120ohm
2024-02-14 9:03 AM - edited 2024-02-14 9:42 AM
It seems you used "Test circuit" description for your project while this is not the right config:
So is that possible to:
2024-02-14 9:53 AM
I tried but it still doesnt work :( I dont know where is the problem. I removed the capacitors except connected +5V one and I connect 120 ohm terminal resistor
I attached my code again. I used callback funcitons this time.
My software purpose's is the received message writed in rcount variable and this data is 1 bit.
2024-02-14 2:28 PM
You should check for HAL status when HAL_CAN_Start, HAL_CAN_ActivateNotification and
In the Error_Handler you can turn on an LED to indicate any of those 3 calls did not return HAL_OK.
if (HAL_CAN_ConfigFilter(&CanHandle, &sFilterConfig) != HAL_OK)
{
/* Filter configuration Error */
Error_Handler();
}
/*##-3- Start the CAN peripheral ###########################################*/
if (HAL_CAN_Start(&CanHandle) != HAL_OK)
{
/* Start Error */
Error_Handler();
}
/*##-4- Activate CAN RX notification #######################################*/
if (HAL_CAN_ActivateNotification(&CanHandle, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)
{
/* Notification Error */
Error_Handler();
}
2024-02-14 2:38 PM
thank you for reply
I will try this codes but I have a question
If I change my can transciever IC MCP2551 with TJA1051, Can it be better?
Which can transciever IC do you suggest?
2024-02-15 12:45 AM
Hello,
If I want to suggest a transceiver, I would choose either a transceiver with 3.3V supply like the ones used on our boards Ex: SN65HVD230.
Or a transceiver having Vio pin like TJA1051T/3 or TJA51TK/3 versions.
The transceivers TJA1051 and TJA1051T/E versions are not suitable for you because VIHmin = 0.7xVCC = 3.5V (if VCC=5V). So TX pin needs at least 3.5V > STM32 IO voltage (@3.3V).
MCP2551 still not bad because VIHmin = 2V < 3.3V
2024-02-15 9:48 AM
Hello again,
I readjusted my mcp2551 can transciever circuit and my codes. I attached them. But It still doenst work guys. The prgoram is not getting in canrxfifo ınterrupt function or I cant transmit data to analyzer. Maybe, the analyzer sends hex codes not decimal so can I read hex code data in my live expression panel ? I mean, should I decode the data in my codes ?
2024-02-15 11:55 AM
Attach your project. Draw up a diagram on how you've connected the MCP2551 to the STM32. How you've connected the CAN analyzer to the MCP2551, including power supply, USB connector(s) and grounds.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.