Skip to main content
Graduate
March 17, 2024
Solved

HAL_CAN_AddTxMessage() contains problems

  • March 17, 2024
  • 1 reply
  • 2699 views

Hi

 

I am using CAN in STM32F303RDT6.

I am using HAL_CAN_AddTxMessage for CAN transmission.

This function will send the data and return HAL_OK if the sending mailbox is free.

However, although HAL_CAN_AddTxMessage returns HAL_OK, no message may actually be output on the CAN bus.

I am using CANoe to monitor a CAN bus.

 

My application has a queue that stores outgoing messages that I create. The application writes outgoing data to the queue at any time.

The data retrieved from the queue is input to HAL_CAN_AddTxMessage. When HAL_OK is returned, it is assumed that the data has been sent and the next queue data is retrieved.

 

However, even though HAL_OK is returned, there are times when it is not output to the CAN bus. This is a problem.

Please tell me any countermeasures.

 

Help Me.....

 

 

 

    This topic has been closed for replies.
    Best answer by Ukazu

    Hi

     

    The problem was resolved by setting bit 4 of the CAN_MCR register to 0.

    I think that if you are using CAN, the initial value of bit4 should be "0".

    1 reply

    UkazuAuthorAnswer
    Graduate
    March 18, 2024

    Hi

     

    The problem was resolved by setting bit 4 of the CAN_MCR register to 0.

    I think that if you are using CAN, the initial value of bit4 should be "0".

    Explorer
    December 23, 2024

    Hi UKAZU

    I need your help same I am trying to send two different CAN ID ,.

    Can you help me ?

    B.R

    Ashish