2025-05-20 2:52 AM
I wrote a code for this microcontroller to test the CAN protocol, and it worked successfully in loopback test mode—data was transmitted and received correctly without using any external CAN transceiver. Then, I switched the CAN mode from loopback to normal mode and physically connected the TX and RX pins together using a wire. However, with the same code (only changing the test mode), I noticed that in Live Watch, the TX pin shows activity (data being transmitted), but the RX pin shows nothing—no data being received. I even checked the signals on an oscilloscope, and the waveforms on TX and RX were identical, confirming that the signal is physically present on both lines. Yet, according to the software, no data is received. This led me to wonder: since some microcontrollers support external loopback modes while others do not, could it be that this microcontroller does not support external loopback in normal mode by simply wiring TX and RX together? Is that correct?
Solved! Go to Solution.
2025-05-20 3:31 AM - edited 2025-05-20 3:34 AM
Hello,
1-
@ssharrafi wrote:
Then, I switched the CAN mode from loopback to normal mode and physically connected the TX and RX pins together using a wire. However, with the same code (only changing the test mode), I noticed that in Live Watch, the TX pin shows activity (data being transmitted), but the RX pin shows nothing
You cannot do that with CAN: connecting Tx and Rx externally in normal mode. In fact you brake the acknowledgement mechanism. You need a complete CAN bus with two CAN nodes with two terminating resistors.
From the reference manual of the product:
This is how the loopback mode works. Tx signal is already externalized.
2- From this thread, you are using a Blue pill board as we are not committed to ensuring that clones/fakes products as indicated in that thread.
This thread will be closed.
2025-05-20 3:04 AM - edited 2025-05-20 3:37 AM
Probably not.
The internal loop back also means it does not need a response/acknowledgement from a second node.
USB and CAN don't work together on this MCU.
Keil has a paper on a simple bus topology for CAN.
2025-05-20 3:18 AM
thanks for replying at first but i didn't get what do you mean can you explain more?
btw i use IAR for coding not keil...
2025-05-20 3:31 AM - edited 2025-05-20 3:34 AM
Hello,
1-
@ssharrafi wrote:
Then, I switched the CAN mode from loopback to normal mode and physically connected the TX and RX pins together using a wire. However, with the same code (only changing the test mode), I noticed that in Live Watch, the TX pin shows activity (data being transmitted), but the RX pin shows nothing
You cannot do that with CAN: connecting Tx and Rx externally in normal mode. In fact you brake the acknowledgement mechanism. You need a complete CAN bus with two CAN nodes with two terminating resistors.
From the reference manual of the product:
This is how the loopback mode works. Tx signal is already externalized.
2- From this thread, you are using a Blue pill board as we are not committed to ensuring that clones/fakes products as indicated in that thread.
This thread will be closed.