This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | university:courses:electronics:m2k-i2c-debug [02 Apr 2019 15:22] – [Scopy Logic Analyzer Configuration] Antoniu Miclaus | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Debugging I2C with the ADALM2000 ====== | ||
+ | |||
+ | ===== Objective ===== | ||
+ | |||
+ | The objective of this tutorial is to use the Logic Analyzer instrument provided by the [[adi> | ||
+ | |||
+ | 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. | ||
+ | |||
+ | ===== Background ==== | ||
+ | |||
+ | I2C is a serial protocol for two-wire interface to connect low-speed peripheral integrated circuits like EEPROMs, A/D and D/A converters and other similar peripherals in embedded systems to processors and microcontrollers in short-distance (intra-board communication). | ||
+ | |||
+ | With I2C, you can connect multiple slaves to a single master and you can have multiple masters controlling single, or multiple slaves. This is really useful, for example, when you want to have more than one microcontroller writing data to a single memory card. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | Transmission lines: | ||
+ | * **SDA (Serial Data)** – line for the master and slave to send and receive data | ||
+ | * **SCL (Serial Clock)** – line that carries the clock signal | ||
+ | |||
+ | Being a serial communication protocol, the data is transferred bit by bit along a single wire (the SDA line). | ||
+ | |||
+ | I2C is synchronous, | ||
+ | |||
+ | The data is transferred in messages composed of multiple frames. Each message has an address frame that contains the binary address of the slave, and one or more data frames. The message also includes start and stop conditions, read/write bits, and ACK/NACK bits between each data frame as presented in Figure 2. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | <WRAP centeralign> | ||
+ | |||
+ | Message components: | ||
+ | * **Start** - SDA line switches from a high voltage level to a low voltage level before the SCL line switches from high to low. | ||
+ | * **Address Frame** - master indicates the slave to which the message is being sent | ||
+ | * **Read/ | ||
+ | * **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 received. | ||
+ | |||
+ | ===== Hardware Configuration ==== | ||
+ | |||
+ | Figure 3. shows the hardware connection between M2K board and EVAL-ADICUP360 + EVAL-ADT7420-PMDZ. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | The I2C pins are available for monitoring at port PWMH of the EVAL-ADICUP360. | ||
+ | |||
+ | **EVAL-ADICUP360 I2C pin configuration: | ||
+ | Port PWMH: | ||
+ | * Pin9 - SDA | ||
+ | * Pin10 - SCL | ||
+ | |||
+ | Port POWER: | ||
+ | * Pin6 - DGND | ||
+ | |||
+ | **M2K I2C pin configuration: | ||
+ | * DIO0 - SCL | ||
+ | * DIO1 - SDA | ||
+ | |||
+ | Connect the M2K pins to the EVAL-ADICUP360 as follows: | ||
+ | * Pin9 - DIO1 | ||
+ | * Pin10 - DIO0 | ||
+ | * 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> | ||
+ | |||