cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN transmission problems

CTabo.1
Senior

Hello,
I am using for the first time the FDCAN peripheral.

I have configured it in classic CAN 2.0 mode and I have problems with transmission.
In particular, when I start a transmission, nothing is output on the tx pin, and the TRP field in the FDCAN_TXBRP register remains stuck at 1.

The FDCAN tx/rx pins are connnected to a well terminated bus, where is present another CAN node.
It can't be a bus arbitration problem, because the other CAN node doesn't send messages on the bus by its own.

Any help is really appreciated. 

Below is the code snippet that doesn't work.

 

 

 

uint8_t txData[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};

fdcan.Instance = FDCAN2;
fdcan.Init.ClockDivider = FDCAN_CLOCK_DIV1;
fdcan.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
fdcan.Init.Mode = FDCAN_MODE_NORMAL;
fdcan.Init.AutoRetransmission = ENABLE;
fdcan.Init.TransmitPause = ENABLE;
fdcan.Init.ProtocolException = DISABLE;
fdcan.Init.NominalPrescaler = 12;
fdcan.Init.NominalSyncJumpWidth = 1;
fdcan.Init.NominalTimeSeg1 = 13;
fdcan.Init.NominalTimeSeg2 = 2;
fdcan.Init.DataPrescaler = 1;
fdcan.Init.DataSyncJumpWidth = 1;
fdcan.Init.DataTimeSeg1 = 1;
fdcan.Init.DataTimeSeg2 = 1;
fdcan.Init.StdFiltersNbr = 1;
fdcan.Init.ExtFiltersNbr = 0;
fdcan.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
HAL_FDCAN_Init(&fdcan);
HAL_FDCAN_Start(&fdcan);

txHeader.Identifier = 0x581;
txHeader.IdType = FDCAN_STANDARD_ID;
txHeader.TxFrameType = FDCAN_DATA_FRAME;
txHeader.DataLength = 8;
txHeader.ErrorStateIndicator = 0;
txHeader.BitRateSwitch = 0;
txHeader.FDFormat = FDCAN_CLASSIC_CAN;
txHeader.TxEventFifoControl = FDCAN_NO_TX_EVENTS;
txHeader.MessageMarker = 0;
HAL_FDCAN_AddMessageToTxFifoQ(&fdcan, &txHeader, &txData[0]);

 

 

 

Regards,
Carlo

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,
the problem was that I have multiplexed FDCAN_TX / FDCAN_RX to the wrong pins.

Indeed FDCAN_TX / FDCAN_RX can be multiplexed to different pin pairs and when I have activated the FDCAN2 peripheral on CubeMX, it automatically selected the pins pairs multiplexed on FDCAN_TX / FDCAN_RX.

I apologize for not having recognized my mistake before.

Regards,
Carlo

View solution in original post

2 REPLIES 2
SofLit
ST Employee

Hello,


The FDCAN tx/rx pins are connnected to a well terminated bus, where is present another CAN node.


Not sure I understood this statement. What do you mean by "The FDCAN tx/rx pins are connnected to a well terminated bus" ?

Do you mean you did connect FDCAN_TX/FDCAN_RX pins to a termination resistor? Or did you use a CAN transceiver for that? CAN bus is constituted by two wires CAN_HIGH and CAN_LOW transmitting data in differential mode. 

Please provide more details about your HW/CAN bus configuration.

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.

Hello,
the problem was that I have multiplexed FDCAN_TX / FDCAN_RX to the wrong pins.

Indeed FDCAN_TX / FDCAN_RX can be multiplexed to different pin pairs and when I have activated the FDCAN2 peripheral on CubeMX, it automatically selected the pins pairs multiplexed on FDCAN_TX / FDCAN_RX.

I apologize for not having recognized my mistake before.

Regards,
Carlo