Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit ca61fa2

Browse files
author
Nathan Seidle
committed
Update Theory.md
1 parent 34a907c commit ca61fa2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Theory.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
How I2C library works
1+
How I2C (aka DDC) communication works with a uBlox module
22
===========================================================
33

44
When the user calls one of the methods the library will poll the Ublox module for new data.
@@ -10,4 +10,18 @@ When the user calls one of the methods the library will poll the Ublox module fo
1010
* Otherwise, read number of bytes and process into NMEA, UBX, or RTCM frame.
1111
* If checksum is valid, flag frame as complete.
1212

13+
This library was originally written to use the I2C interface but Serial has been implemented as well.
14+
15+
How data is processed by this library
16+
===========================================================
17+
18+
A method will call **sendCommand()**. This will begin waiting for a response with either **waitForACKResponse()** or **waitForNoACKResponse()** depending on the command we have sent (CFG commands generate an ACK where others like PVT do not).
19+
20+
Once **waitForACKResponse()** or **waitForNoACKResponse()** is called the library will start checking the ublox module for new bytes. These bytes may be part of a NMEA sentence, an RTCM sentence, or a UBX packet. The library will file each byte into the appropriate container. Once a given sentence or packet is complete, the appropriate processUBX(), processNMEA() will be called. These functions deal with specific processing for each type.
21+
22+
Note: When interfacing to a ublox module over I2C the **checkUbloxI2C()** will read all bytes currently sitting in the I2C buffer. This may pick up multiple UBX packets. For example, an ACK for a VALSET may be mixed in with an auto-PVT response. We cannot tell **checkUbloxI2C()** to stop once a give ACK is found because we run the risk of leaving bytes in the I2C buffer and loosing them. We don't have this issue with **checkUbloxSerial()**.
23+
24+
**processUBX()** will check the CRC of the UBX packet. If validated, the packet will be marked as valid. Once a packet is marked as valid then **processUBXpacket()** is called to extract the contents. This is most commonly used to get the position, velocity, and time (PVT) out of the packet but is also used to check the nature of an ACK packet.
25+
26+
Once a packet has been processed, **waitForACKResponse()/waitForNoACKResponse()** makes the appropriate decision what to do with it. If a packet satisfies the CLS/ID and characteristics of what **waitForACKResponse()/waitForNoACKResponse()** is waiting for, then it returns back to sendCommand. If the packet didn't match or was invalid then **waitForACKResponse()/waitForNoACKResponse()** will continue to wait until the correct packet is received or we time out. **sendCommand()** then returns with true/false depending on the success of **waitForACKResponse()/waitForNoACKResponse()**.
1327

0 commit comments

Comments
 (0)