Anr018 Gnss I2c Communication
Total Page:16
File Type:pdf, Size:1020Kb
ANR018 GNSS I2C COMMUNICATION VERSION 1.2 JUNE 2, 2021 Revision history Manual Notes Date version 1.0 • Initial version June 2020 1.1 • Figure 7 and 8 updated July 2020 1.2 • Updated Chapter 3 June 2021 ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 1 Abbreviations and abstract Abbreviation Description ASCII American Standard Code for Information Interchange CTS Clear to send I2C Inter-IC bus GND Ground GNSS Global Navigation Satellite System HIGH Digital (logic) high level IC Integrated Circuit IDC Insulation Displacement Contact LOW Digital (logic) low level µC Microcontroller NMEA National Marine Electronics Association OSP One Socket Protocol PC Personal Computer RTS Request to send SCL Serial Clock SDA Serial Data USB Universal Serial Bus ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 2 Contents 1 Introduction5 2 I2C Digital interface6 2.1 General characteristics..............................6 2.2 SDA and SCL logic levels............................6 2.3 Communication phase..............................6 2.3.1 Idle state.................................6 2.3.2 START(S) and STOP(P) condition...................7 2.3.3 Data validity...............................7 2.3.4 Data format...............................8 2.3.5 Acknowledge and No-Acknowledge..................8 2.3.6 Addressing the GNSS module.....................8 2.3.7 GNSS communication protocol....................9 2.4 I2C timing parameters..............................9 3 Hardware Setup 10 3.1 Hardware Setup - 1.8V.............................. 10 3.2 Evaluation Board Modification - 1.8V...................... 11 3.3 Hardware Setup - Erinome-I........................... 13 3.4 Evaluation Board Modification - Erinome-I................... 14 4 Application Example 16 4.1 Total Phase Aardvark host adapter....................... 16 4.2 Generic Microcontroller............................. 23 5 Troubleshooting 25 6 Important notes 26 6.1 General customer responsibility......................... 26 6.2 Customer responsibility related to specific, in particular safety-relevant ap- plications..................................... 26 6.3 Best care and attention............................. 26 6.4 Customer support for product specifications.................. 26 6.5 Product improvements.............................. 27 6.6 Product life cycle................................. 27 6.7 Property rights.................................. 27 6.8 General terms and conditions.......................... 27 7 Legal notice 28 7.1 Exclusion of liability................................ 28 7.2 Suitability in customer applications....................... 28 7.3 Trademarks.................................... 28 7.4 Usage restriction................................. 28 8 License terms 30 8.1 Limited license.................................. 30 8.2 Usage and obligations.............................. 30 8.3 Ownership..................................... 31 8.4 Firmware update(s)................................ 31 8.5 Disclaimer of warranty.............................. 31 ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 3 8.6 Limitation of liability................................ 31 8.7 Applicable law and jurisdiction.......................... 32 8.8 Severability clause................................ 32 8.9 Miscellaneous................................... 32 ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 4 1 Introduction This application note aims to support the use of the I2C interface on Elara and Erinome GNSS modules. I2C interface is available in these modules as an alternative to UART. The GNSS module functions as Multi-Master. The first part of the document describes the basics of I2C communication. This technical background information helps to understand the rest of the document. It includes under- standing the different roles and phases in the communication, addressing of the bus sub- scriber and data structure. The recommended I2C communication hardware setup is described in detail in Chapter ??. The same setup can be used for Elara-I, Elara-II, and Erinome-II modules, operating with 1.8 V power supply. A slightly different setup is required for Erinome-I, operating with 3.3 V power supply. After some simple modifications, the evaluation board can be used to test I2C communica- tion with the GNSS module. The modifications are also explained in detail in chapter ??. Chapter 4 presents a specific application example, where the GNSS evaluation board com- municates via I2C with the Aardvark I2C/SPI host adapter from Total Phase 1. This chapter guides the user through the software and hardware configuration to successfully establish I2C communication with the GNSS module. The application note is concluded by a trou- bleshooting section which helps the user to debug the process. Module Article number Power supply Input logic level Output logic level Elara-I 2613011037000 1.8V 3.3V 1.8V Elara-II 2613021137000 1.8V 3.3V 1.8V Erinome-I 2614011037000 3.3V 3.3V 1.8V Erinome-II 2614021137000 1.8V 3.3V 1.8V Table 1: GNSS module power supply and logic levels 1 https://www.totalphase.com/products/aardvark-i2cspi/ . ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 5 2 I2C Digital interface The GNSS module supports standard I2C (Inter-IC) bus interface as an alternative to the recommended UART interface. Further information of the I2C interface can be found at https://www.nxp.com/docs/en/user-guide/UM10204.pdf .I2C is a serial 8-bit protocol with two-wire interface, which supports communication between different ICs. For example be- tween the µC and other peripheral devices such as a GNSS module or sensors. 2.1 General characteristics A serial data line (SDA) and a serial clock line (SCL) are required for the communication between the devices connected via I2C bus. Both SDA and SCL lines are bidirectional. The output stages of devices connected to the bus must have an open-drain or open-collector. Hence, the SDA and SCL lines shall be connected to a positive supply voltage using pull-up resistors. In the I2C protocol, the communication is realized through master-slave principle. The mas- ter device generates the clock pulses, a start command and a stop command for the data transfer. Each connected device on the bus is addressable via a unique address. Master and slave can act as a transmitter or a receiver depending upon whether the data needs to be transmitted or received. The GNSS module supports the role of I2C multi-master which means it will act as a I2C master and send data to a specific slave address whenever it has data available and the bus is idle. In case the GNSS module has no data to send, it will switch into the I2C slave role to be able to receive data from another master that addresses the GNSS module via the bus. 2.2 SDA and SCL logic levels Logic level is the positive supply voltage to which SDA and SCL lines are to be pulled up (through internal or external pull-up resistors). The GNSS modules support specified logic levels (product specific, e.g. 1.8V) which must be either used by every device on the I2C bus or a logic level conversion must be implement- ed in-between the GNSS module and the other bus participants. This conversion IC must be selected in a manner that it supports the requirements of I2C set by the GNSS module, i.e. open-drain / open-collector and at least 400kHz clock speed. 2.3 Communication phase 2.3.1 Idle state During the idle state, the bus is free and both SDA and SCL lines are in logic high ’1’ state. No master has requested the bus by sending START(S). ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 6 2.3.2 START(S) and STOP(P) condition Data transfer on the bus starts with a START command, which is generated by the active master. A start condition is defined as a high-to-low transition on the SDA line while the SCL line is held high. The bus is considered busy after the start condition, so no other master may access it. Slaves are not allowed to perform any bus activity unless addressed by a read access from a master. START STOP Condition Condition SDA SCL 1...7 8 9 1...8 9 1...8 9 7-bit Read/ ACK Data ACK Data NACK Address Write Figure 1: Data transfer from GNSS to slave Data transfer on the bus is terminated with a STOP command, which is also generated by the active master. A low-to-high transition on the SDA line, while the SCL line being high is defined as a STOP condition. After the stop condition, the bus is again considered free and is in idle state. Figure2 shows the I2C bus START and STOP conditions. 2.3.3 Data validity After the START condition, one data bit is transmitted with each clock pulse. The transmitted data is only valid when the SDA line data is stable (HIGH or LOW) during the high period of the clock pulse. HIGH or LOW state of the data line can only change when the clock pulse is in low state. ANR018 GNSS I2C Communication version 1.2 © June 2021 www.we-online.com/wireless-connectivity 7 START Valid Valid change STOP Condition data of data Condition SDA SCL Figure 2: Data validity, START and STOP condition 2.3.4 Data format Data transmission on the SDA line is always done in bytes, with each byte being 8-bits long. Data is transmitted with the most significant bit (MSB) first. If the slave cannot receive or transmit another complete byte of data, it can force the master into a wait state by holding SCL LOW. Data transfer continues when the slave is ready which is indicated by releasing the SCL pin. 2.3.5 Acknowledge and No-Acknowledge Each byte transmitted on the data line must be followed by an acknowledge bit (ACK). The receiver of the data (master or slave) generates an acknowledge signal to indicate that the data byte was received successfully and the receiver is ready to receive next data byte.