cancel
Showing results for 
Search instead for 
Did you mean: 

I CANT RECEİVE ANY MESSAGE FROM A CAN BUS ANALYZER WİTH STM32 BOARD

maZers
Associate III

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.

maZers_1-1707850306830.png

 

 

32 REPLIES 32
maZers
Associate III

Here is my projects. I just want to see the received message on the live expression. At the same time, I want to see received message on can analyzer. The communication doesnt work between analyzer and stm32

WhatsApp Image 2024-02-16 at 12.37.50.jpeg

Have you checked with an oscilloscope to be sure there is some data activity on the CAN wires?

If you find my answers useful, click the accept button so that way others can see the solution.

Your diagram is OK.

But now regarding your code:

  1. Did you try to use callbacks instead of using the interrupt handlers as suggested previously?
  2. sFilterConfig.FilterMaskIdLow=0x000; is missing in your filter config settings!
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
maZers
Associate III

I already used callbacks in my code that I atteched and It doesnt work either. I will use an oscilloscope and check the canbus line signals. In addition, There is no sFilterConfig.FilterMaskIdLow=0x000 yes I forgot it but  does ıt really affect my project ? 

And If I write the code in Can registers and use ınstances , does the possibility of working project increase ? I mean, I  can start the CAN  with register instead of using HAL lib.

SofLit
ST Employee

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.

In your first post you said that the transmission/reception is working fine with two STM32. So I suspect something wrong on CAN Analyzer either with software configuration or HW.

Do you see any activity on CAN_Rx pin on STM32 side when you send data from the CAN analyzer?

 

 

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
maZers
Associate III

Hello,

Here is my schematic

WhatsApp Image 2024-02-21 at 16.59.50.jpeg

 I observed the can Rx pin with a multimeter. The can Rx pin voltage is 4.88V when no receiving. When I send a message with other stm32 , can rx voltage increase 4.970V and the voltage stay in that value despite I send a data again. Then, I sent a data with analyzer to stm32 , the can rx voltage decreased 2,7V. that is so weird. In addition, when I connect the analyzer in Can Bus line, the stm32 boards doesnt communicate. It breaks the communication.

My analyzer software settings is right I guess because the can bus kbps is same 500kbps.

maZers_0-1708524771792.png

 

We cannot rely on a multimeter for this kind of debug. You need an oscilloscope for this.

Meanwhile you need to remove one 120ohm on the CAN but.

You need only two 120 ohm termination resistors at the extremity of the bus. So remove the one of the CAN analyzer.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
maZers
Associate III

I removed the 120ohm on analyzer but it still doesnt work. By the way, when I observe the can bus line with oscilloscope , what should I observe exactly ? How should signals flow on can bus line or Can rx pin ?

SofLit
ST Employee

When you send data, you have to see the frame on the sender Tx pin and on the receiver Rx pin.

When the receiver acknowledges the frame, ACK is seen on the receiver Tx pin and also on the sender Rx pin.

PS: I'm not talking about CAN_H and CAN_L lines.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
maZers
Associate III

Hello, 

Lets say  I observed the signals with oscilloscope, the ACK's second bit is not 0 dominant so the receiving is failed what will I do ? 

By the way, according to this schematic before I connect analyzer to stm32 board, the stm32 program works well but when I connect the analyzer to stm32 , an unrelated program is broke like button ınterrupt. I guess, there is a problem on my hardware. You can check out my schema that ı am using and my codes.

WhatsApp Image 2024-02-16 at 14.51.07.jpeg