Explaining different types of loopbacks in SCI module.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Primarily we can do two different types of loopbacks using SCI module.
1. Loopback using 16th bit of SCIGCR1 (LOOP BACK)
2. Loop Back using IODFTCTR register (IODFTENA & LPB ENA)
The key difference is the loopback using 16th bit of SCIGCR1 is like a safe loopback. That means this loopback can be done even if SCI connected with other SCI device, without affecting the actual communication.
1. Loopback using 16th bit of SCIGCR1 (LOOP BACK):
In this loopback SCITX internally connected with SCIRX, but externally SCITX pin will be in logic-High and SCIRX will be in open impedance until again this loopback is disabled.
So, until this loopback test completes the other end SCI device receiving pin will reads logic-High only. And other end device cannot send any data to this device as its SCIRX pin is in high impedance mode.
2. Loop Back using IODFTCTR register (IODFTENA & LPB ENA):
This loopback is further divided into two sub loopbacks:
Digital Loopback and Analog Loopback.
The main difference between these two loopbacks is in analog loopback mode the complete communication path through the I/O's can be tested, whereas in digital loopback mode the I/O buffers are excluded from this path. That means in digital loopback I/O buffers will get disabled, so no data will be transmitted to output or Tx line. Whereas in analog loopback the complete path will be tested, so the data can be seen at Tx line as well and this data get looped to Rx line automatically.
This loopback will be encouraged to do only before connecting to other SCI device. I mean this loopback will not be encouraged to do in the middle of communication. Because especially the analog loopback mode in this testing will be affected by another device or it can also affect the other device. I mean the loopback testing data will pass to the other SCI device or the loopback data will get affected by other end SCI device.
For better understanding i did some testing with different combinations and here are results:
1. Only IODFTCTRL analog loopback enabled:
As you can see in above code i just disabled the SCIGCR1 loopback and enabled only IODFTCTRL analog loopback.
In this testing i can see the data in the RD register that means data was loop backed and i also received my data on the serial terminal that means I/O buffers not disabled in this mode.
2. Only IODFTCTRL digital loopback enabled:
As you can see in above code i just disabled the SCIGCR1 loopback and enabled only IODFTCTRL digital loopback.
In this testing i can see the data in the RD register that means data was loop backed but i didn't received any data on the serial terminal that means I/O buffers are disabled and loopback happened internally only.
3. Loopback using only 16th bit of SCIGCR1:
As you can see in above code i just enabled the SCIGCR1 loopback and disabled the IODFTCTRL loopback.
In this testing also i can see the data in the RD register that means data was loop backed but i didn't received any data on the serial terminal that means this loopback also happened internally. The main difference between this loopback and digital loopback is, in this loopback the Tx pin output will becomes High and Rx pin will be in open drain state, that will not happen in the digital loopback, in digital loopback only I/O buffers will get disabled.
4. Loopback using both 16th bit of SCIGCR1 and IODFTCTRL analog loopback:
As you can see in above code i enabled the SCIGCR1 loopback and also the IODFTCTRL analog loopback.
In this testing also i can see the data in the RD register that means data was loop backed but i didn't received any data on the serial terminal. This is similar behavior of SCIGCR1 loopback, because this loopback will internally connect the Tx and Rx pins, and Tx pin will be in High and Rx pin will be High impedance state.