Download Print this page
Infineon I2C Read Ext Device 1 Manual

Infineon I2C Read Ext Device 1 Manual

Read external device mac address via i2c, aurix tc2xx microcontroller training

Advertisement

Quick Links

I2C_Read_Ext_Device_1
Read external device MAC address via I2C
AURIX™ TC2xx Microcontroller Training
V1.0.0
Please read the Important Notice and Warnings at the end of this document

Advertisement

loading

Summary of Contents for Infineon I2C Read Ext Device 1

  • Page 1 I2C_Read_Ext_Device_1 Read external device MAC address via I2C AURIX™ TC2xx Microcontroller Training V1.0.0 Please read the Important Notice and Warnings at the end of this document...
  • Page 2 An I2C module configured as I2C master is used to read the MAC address stored in MCP79411, a Real-Time-Clock device mounted on the board KIT_AURIX_TC297_TFT_BC-Step. The AURIX™ device reads the MAC address through the I2C module and stores it into a global variable. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 3 A specific slave can be addressed by the master via a 7- or 10-bit address. Afterwards the master starts the communication. – Data can flow in either direction and can be set via a data direction bit, which is transmitted by the master. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 4: Hardware Setup

    The used data lines are connected to the positive power supply via two pull-up resistors. The MCP79411 is a battery-backed I2C Real-Time Clock/Calendar (RTCC) device with SRAM, EEPROM and protected EEPROM. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 5 The initialization of every device that is connected to the I C module (in this case, the MCP79411 chip) by initializing an instance of the IfxI2c_I2c_deviceConfig structure for each device 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 6 The function IfxI2c_I2c_initModule() initializes and activates the I2C module with the user configuration in master mode. The functions above are provided by the iLLD header IfxI2c_I2c.h. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 7 The function IfxI2c_I2c_initDevice() finalizes the I C initialization by connecting the device configuration with the preconfigured I C module. The functions above are provided by the iLLD header IfxI2c_I2c.h. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 8 MAC address of MCP79411 is 0xF2). This is done using the IfxI2c_I2c_write() function. › Then, the reading of the MAC address is started with the function IfxI2c_I2c_read(). Both the write and read functions are defined in the iLLD header IfxI2c_I2c.h. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 9 After code compilation and flashing the device, perform the following steps: › Use the debugger to watch the hexadecimal value of the global array g_macAddr. The MAC address is unique for each board. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 10 Run and Test › A second test can be performed with an oscilloscope. Two oscilloscope probes can be connected to SDA and SCL pins to observe the generated and received signals. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 11 › Third data section: device address byte and six bytes of data (Please refer to the next slide for more details about the data sections) 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 12 Reading process is started by transmitting the device address (0x57) and setting Read/Write bit to „read“: six bytes from the RTCC device, containing the MAC address, are then received. 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 13 More code examples can be found on the GIT repository: › https://github.com/Infineon/AURIX_code_examples › For additional trainings, visit our webpage: › https://www.infineon.com/aurix-expert-training › For questions and support, use the AURIX™ Forum: › https://www.infineonforums.com/forums/13-Aurix-Forum 2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
  • Page 14 Infineon Technologies in in personal injury. customer’s applications. The data contained in this document is exclusively intended for technically trained staff.