cancel
Showing results for 
Search instead for 
Did you mean: 

STLINK-V3MODS - CAN write error BRG_TARGET_CMD_TIMEOUT

debugging
Lead

Using he STLINKV3MOD, I2C, UARTs,  GPIO and using ti for SWD are all working fine without without errors for over a month and quite intensive use

The CAN code follows the same settings in  the example code:

InitCAN is successful.

WriteMsgCAN(&canTxMsg, dataTx, size); fails  with error 0x14 
BRG_TARGET_CMD_TIMEOUT  = Timeout error during Bridge communication
 
Which conditions can cause this error ? 
 
References:
Ubuntu Linux
Bridge 0 PID: 0X3753 SN:00240041343151093739.....

Selected Bridge STLink serial nmber:0024004134315109......

Bridge voltage: 3.274617 V

Bridge Firmware: v3 B5

Test Clock Command...

SPI input CLK: 48000 KHz, ST-Link HCLK: 192000 KHz

I2C input CLK: 192000 KHz, ST-Link HCLK: 192000 KHz

CAN input CLK: 48000 KHz, ST-Link HCLK: 192000 KHz

GPIO input CLK: 192000 KHz, ST-Link HCLK: 192000 KHz

PIO Test OK
Test CAN...
CAN prescaler initialized
CAN initialized and message reception succeeded
CAN filter initialization succeeded
CAN loopback test loop 1 with size 1
CAN Write Message error (Tx ID: 0x12345678)
Timeout error during Bridge communication

 
 
3 REPLIES 3
AM
ST Employee

Hello

You may need to check the CAN bus connections and the CAN target you are connected to.  It seems you are failing at the first trial of CAN communication on the bus after CAN and filters initialization: the sent CAN message seems not received by your target (probably the command timeout in receiving the target ACK). On STLINK-V3MODS side, verify that the CAN baud rate configured in  Brg_CanInitT  from STLINK-V3-BRIDGE API (in function InitCAN() GetCANbaudratePrescal()) are matching the configuration used on your CAN target side. You may also verify on the target side if initialization and filters are correctly set to receive the message you are sending using the STLINK-V3MODS.

For CAN debug you may also have a look to this article Troubleshooting bxCAN issues in Loop Back mode on STM32 MCUs

Best regards

debugging
Lead

Many thanks. Thus "Timeout error during Bridge communication" means a problem on the CAN bus. The description  looked more like an error communication error between the Host and the STV3MOD USB connection, so I stopped analyzing this from there.. A more verbose explanation for possible causes of these bridge errors would help.

Bottom line, there  should be activity visible on the CAN bus & Rx/Tx pins, even with this error, correct ?

 

 

Hello,

 BRG_TARGET_CMD_TIMEOUT  is the error when a timeout occurs while the STLINK is waiting for the answer of the target to a Bridge command (generic error for all Bridge interfaces). It is difficult to be more precise in describing the error because the root cause of this issue can be due to various factors (bridge hardware connection issues, target code, mismatch between STLINK and target configuration ...) .

Yes you should be able to see the STLINK CAN Tx activity on  the CAN bus & Rx/Tx pins.

Best regards