cancel
Showing results for 
Search instead for 
Did you mean: 

I2C LOOP BACK TEST

Harathi
Associate

Hi,

I would like to inquire whether it is possible to perform internal I2C and SPI loopback tests on the STM32F767ZI board.

Regards,

Mounika

1 ACCEPTED SOLUTION

Accepted Solutions

SPI is full-duplex, so you can loop back MOSI to MISO.

However, I2C is half-duplex, so you can't loop back within one I2C device. You can loop back one I2C device onto another one on the same STM32, though; .

JW

View solution in original post

2 REPLIES 2
Danish1
Lead II

 

I2C: No. An I2C peripheral cannot act simultaneously as Master and Slave.

SPI: Internal loopback? No. External loopback (i.e. you connect specific links) Yes. You'd just need to link MISO and MOSI.

The question then is: How useful are such tests.

The peripheral is embedded inside the stm32 and is unlikely to be damaged. On the other hand, the peripheral talks to the outside world through GPIO pins (mapped through alternate function settings). The GPIO pins can be damaged e.g. by ESD, excessive current, going outside the Vss to Vdd range by more than a diode-drop. So a simpler test might be some way to verify correct GPIO operation.

For I2C you could check that you can drive each line low, but when you are not driving it the line returns high. But addressing a device on the I2C bus is a more-complete test.

For SPI this is harder because you can't tell if the pins are driving the appropriate lines. Again talking to a device on the bus e.g. reading back device ID (where present) is more-complete therefore better.

The only time I have been aware of loopback tests is with interfaces where other devices are unlikely to be on the same pcb e.g. CAN or Ethernet.

SPI is full-duplex, so you can loop back MOSI to MISO.

However, I2C is half-duplex, so you can't loop back within one I2C device. You can loop back one I2C device onto another one on the same STM32, though; .

JW