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

Are you sure on the speed?

What's your external clock? What's the AHB, APB1 and APB2 bus speeds.

Are you monitoring the two talking, or just one into the analyzer?

This looks wrong, but unrelated.

sFilterConfig.FilterMaskIdHigh=0xFFF0 << 5;

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

I am sure that the speeds are the same. It is 500kbps. My external clock is 25Mhz and the Can Bus feeds from the APB1 peripheral. APB1 peripheral is 42Mhz. I want to monitor just stm32. I send a 1 bit data from analayzer and I want to read the data on my stm32 in live expression. Here is a screenshot. You are true about the filter ı forgot the edit filters but yeah unrelated. And I attached a more simple code. The purpose of this program is receiving data from analyzer and observing in live expression. By the way, I am sure that the analyzer is working. Because I received many messages with analyzer from a device that transmit can bus message. and as I said My can bus system is working in normal mode with two stm32 boards

maZers_0-1707916035529.png

 


By the way, I am sure that the analyzer is working. Because I received many messages with analyzer from a device that transmit can bus message.

Ok.. you received messages on the analyzer with another device but did you try its transmit to another device in order to validate that its transmission is working well?

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.
SofLit
ST Employee

Also, what about termination resistors of 120 ohm?

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 cant observe that the device receive data from analyzer. The device I am talking about just transmit data It doesnt receive data. On the other hand, I can not observe the data that I transmit from stm32 to analyzer. The two board communicate successfully and I want to observe the datas that in Can Bus line with analyzer but I cant observe neither. Should I use an extra HAL function or different an algorithm ? 

maZers
Associate III

I use MCP2551 can transciever IC so I used 60 ohm termination resistor on my stm32 can transciever circuit because In according to MCP2551 datasheet , the termination resistor should be 60 ohm in the recommended connection but There is a 120ohm resistor on the analyzer 


@maZers wrote:

I use MCP2551 can transciever IC so I used 60 ohm termination resistor on my stm32 can transciever circuit because In according to MCP2551 datasheet  


Could you please share a screenshot of the part of the MCP2551 datasheet showing that the termination resistor should be at 60 Ohm? I suspect you're are referring to the Test circuit figures ..

because this is what was said in it:

SofLit_0-1707919809964.png

 

 

 

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 wrote:

I cant observe that the device receive data from analyzer. The device I am talking about just transmit data It doesnt receive data. On the other hand, I can not observe the data that I transmit from stm32 to analyzer. The two board communicate successfully and I want to observe the datas that in Can Bus line with analyzer but I cant observe neither. Should I use an extra HAL function or different an algorithm ? 


If the communication between two STM32 boards is OK, I suspect something related to the analyzer. So you need also to validate its transmission. Is it capable to send messages? also check the HW, you need termination resistors  of 120ohm on each side.

Regarding your implementation in the interrupt:

 

 

void CAN1_RX0_IRQHandler(void)
{
  /* USER CODE BEGIN CAN1_RX0_IRQn 0 */

  /* USER CODE END CAN1_RX0_IRQn 0 */
  HAL_CAN_IRQHandler(&hcan1);
  /* USER CODE BEGIN CAN1_RX0_IRQn 1 */
 for(int i=0; i<pRxHeader.DLC;i++)
  {
RxData[i];
  }
  HAL_CAN_GetRxMessage(&hcan1,CAN_RX_FIFO0,&pRxHeader,&RxData);

  /* USER CODE END CAN1_RX0_IRQn 1 */
}

 

 

This is not the way we use the HAL.

You need to use Callbacks such as: HAL_CAN_RxFifo0MsgPendingCallback() and HAL_CAN_RxFifo1MsgPendingCallback()

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

Okey I will follow your tips and get feedback thank you so much