cancel
Showing results for 
Search instead for 
Did you mean: 

does stm32f103c6tx support external loopback?

ssharrafi
Associate

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 discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

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.

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.

View solution in original post

3 REPLIES 3

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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ƎALLEm
ST Employee

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.

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.