Skip to main content
Visitor II
May 20, 2025
Solved

does stm32f103c6tx support external loopback?

  • May 20, 2025
  • 2 replies
  • 430 views

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?

    This topic has been closed for replies.
    Best answer by mƎALLEm

    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:

    mALLEm_0-1747737202136.png

    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.

    2 replies

    Graduate II
    May 20, 2025

    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.

    ssharrafiAuthor
    Visitor II
    May 20, 2025

    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...

    mƎALLEmAnswer
    Technical Moderator
    May 20, 2025

    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:

    mALLEm_0-1747737202136.png

    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.