2024-12-14 11:08 PM - edited 2024-12-18 07:37 PM
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.
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
2025-01-02 12:51 AM
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
2025-01-03 06:27 PM
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 ?
2025-01-06 12:22 AM
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
2025-01-23 08:28 AM - edited 2025-01-23 08:30 AM
Hello @AM
Checked the board again. Connected an 120 Ohm resistor between CAN-H and L. Nothing else is connected to the CAN BUS. Checked with a multimeter this 120 Ohm all the other CAN bus connection to the transceiver and the V3MOD. VIO of the CAN transceiver measures 3.3V. VCC to the transceiver measures 5V. When the V3MOD is idle (no Bridge transactions), CAN_L and CAN_H are 3.3V and the TJA1051-T3 outputs are both 2.397V. When the code of the initialization starts CAN_L and CAN_H signals are changing as well those on the CAN Bus. it does not seems to be a hardware issue. Reading back the CAN bus status after initialization gives a final baud-rate of 125000 (same as requested). Must a target be present on the bus ? Attached code snippet.
2025-01-27 12:19 AM
Hello,
Yes a target must be present on the CAN bus to receive and acknowledge the sent CAN messages. If you have no CAN target connected to the STLINK and you just want to see how the STLINK CAN API is working, you may use CAN_MODE_LOOPBACK to receive back the sent messages on the CAN bus. In that case you need to configure the STLINK CAN reception (filter/ message reception) accordingly.
Best regards
2025-01-29 04:01 AM
Hello,
As an additional comment, if you want code example you may check the new STLINK-V3-BRIDGE package (v1.2.0 https://www.st.com/en/development-tools/stlink-v3-bridge.html). It contains some basic test/code on how to exercise the Bridge CAN API, in CAN_MODE_LOOPBACK , with a CAN bus but without any target connected on the bus. This code is available in STLINK-V3-BRIDGE\src\project\apiBridgeProject\main_example.cpp file (see cBrgExample::CanTest()) .
Best regards