This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
university:courses:electronics:m2k-i2c-debug [02 Apr 2019 14:54] – Antoniu Miclaus | university:courses:electronics:m2k-i2c-debug [03 Jan 2021 22:12] (current) – fix links Robin Getz | ||
---|---|---|---|
Line 5: | Line 5: | ||
The objective of this tutorial is to use the Logic Analyzer instrument provided by the [[adi> | The objective of this tutorial is to use the Logic Analyzer instrument provided by the [[adi> | ||
- | The [[resources: | + | The [[resources: |
The Demo application includes a function that reads and displays the temperature data from the ADT7420 and one that reads and displays the ID register data for ADT7420. | The Demo application includes a function that reads and displays the temperature data from the ADT7420 and one that reads and displays the ID register data for ADT7420. | ||
Line 11: | Line 11: | ||
===== Background ==== | ===== Background ==== | ||
- | I2C is a serial protocol for two-wire interface to connect | + | I2C is a serial protocol for connecting |
- | With I2C, you can connect | + | I2C supports |
<WRAP centeralign> | <WRAP centeralign> | ||
<WRAP centeralign> | <WRAP centeralign> | ||
- | Transmission lines: | + | I2C physical layer signals: |
- | * **SDA (Serial Data)** – line for the master and slave to send and receive data | + | * **SDA (Serial Data)** – bidirectional data line for the master and slave to send and receive data |
- | * **SCL (Serial Clock)** – line that carries the clock signal | + | * **SCL (Serial Clock)** – line that carries the clock signal, driven by the master |
- | Being a serial communication protocol, | + | Being a serial communication protocol, |
- | I2C is synchronous, | + | Data is transferred in transactions |
- | + | ||
- | The data is transferred in messages | + | |
<WRAP centeralign> | <WRAP centeralign> | ||
- | <WRAP centeralign> | + | <WRAP centeralign> |
- | Message | + | Transaction |
- | * **Start** - SDA line switches | + | * **Start** - SDA line transitions |
- | * **Address Frame** - master indicates the slave to which the message | + | * **Address Frame** - master indicates the slave to which the transaction |
* **Read/ | * **Read/ | ||
* **Data Frame** - 8-bit data passed from master to slave or vice versa, starting with the most significant bit first (MSB) | * **Data Frame** - 8-bit data passed from master to slave or vice versa, starting with the most significant bit first (MSB) | ||
- | * **ACK/NACK Bit** - the ACK bit is returned from the receiving device if an address frame or data frame is successfully | + | * **ACK/NACK Bit** - the ACK bit is returned from the receiving device if an address frame or data frame is received. |
+ | * **Stop** - SDA line transitions from a low logic level to a high logic level while the SCL line is high. | ||
===== Hardware Configuration ==== | ===== Hardware Configuration ==== | ||
Line 44: | Line 43: | ||
<WRAP centeralign> | <WRAP centeralign> | ||
- | <WRAP centeralign> | + | <WRAP centeralign> |
The I2C pins are available for monitoring at port PWMH of the EVAL-ADICUP360. | The I2C pins are available for monitoring at port PWMH of the EVAL-ADICUP360. | ||
Line 65: | Line 64: | ||
* GND - DGND | * GND - DGND | ||
+ | ===== Scopy Logic Analyzer Configuration ==== | ||
+ | |||
+ | Open the Logic Analyzer instrument, select DIO0-DIO1 lines and press the “Group with selected” button. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | Select the channel group formed and apply the I2C decoder. While the group is selected, open settings menu by pressing the {{: | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | The Logic Analyzer must be set up to " | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | =====I2C Transfer Example===== | ||
+ | |||
+ | This example verifies that for a given software command, the correct transactions are transferred over I2C between master (EVAL-ADICUP360) and slave (EVAL-ADT7420-PMDZ). | ||
+ | |||
+ | The default I2C device address for EVAL-ADT7420-PMDZ is 0x48. | ||
+ | |||
+ | ===Read ID Register=== | ||
+ | |||
+ | Set the Time Base of the Logic Analyzer instrument to 50us and the Trigger Position at 200us and run a Single sweep. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | The Logic Analyzer will wait for the falling edge of the SDA signal to be triggered. | ||
+ | |||
+ | Run the " | ||
+ | |||
+ | The result is presented in Figure 7. | ||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | Analyzing the plot, the fist half of the transaction contains a write sequence composed of the device address (0x48) with the R/W bit set low (write) followed by the address of the ID register. The master then issues a repeat-start condition for the second half of the transaction - the device address is re-sent with the R/W bit set high(read), and the byte of data containing the contents of the ID register (0xCB) is read out. | ||
+ | |||
+ | ===Read Temperature=== | ||
+ | |||
+ | Set the Time Base of the Logic Analyzer instrument to 75us and the Trigger Position at 250us and run a Single sweep. | ||
+ | |||
+ | The Logic Analyzer will wait for the falling edge of the SDA signal to be triggered. | ||
+ | |||
+ | Run the " | ||
+ | |||
+ | The result is presented in Figure 8. | ||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | Analyzing the plot, the fist half of the transaction contains a write sequence composed of the device address (0x48) with the R/W bit set low (write) followed by the address of the temperature value MSB register. The master then issues a repeat-start condition for the second half of the transaction - the device address is re-sent with the R/W bit set high(read), and two bytes of data representing content of the temperature value most significant byte (0x0E) and temperature value least significant byte (0xE8). This illustrates the fact that the address pointer in the ADT7420 automatically increments as the master reads out data bytes. | ||
+ | |||
+ | ===== Conclusion ==== | ||
+ | |||
+ | In addition to I2C, the application includes a set of decoders covering a large number of communication protocols such as SPI, I2S, UART, JTAG, and others, making ADALM2000 a powerful tool for analyzing and debugging digital signals. | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ==== Further Reading: ==== | ||
+ | |||
+ | |||
+ | * [[https:// | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[resources: | ||
+ | * [[university: | ||
+ | * [[university: | ||
+ | * [[resources: | ||
+ | * [[adi> |