In my umbrella project I used gps module. After start device turn on gps module and waiting for geographic position . Latitude and longitude values are used in weather forecast algorithm.
If user dont have gps module, then he can turn off gps positioning function in umbrella code (c/c++ compiler -> options -> proprocessor -> defined symbols ,,, and remove GPS_IN_USE ). After that user must set name of city where umbrella is located (definition in configure.h file). When gps module is turn off, weather forecast alghoritm working using city name.
In project I used Quectell L80 GPS module with an embedded patch antena, but umbrella software is compatible with every gps module working in NMEA 0183 standard.
L80 is very good module based on MTK chipset. L80 is „low power” small and combines with many advanced features including EASY, AIC, LOCUS, AlwaysLocate and Antenna Advisor. These features are beneficial to accelerate TTFF, improve sensitivity, save consumption and detect antenna status for GPS system. The module supports various location, navigation and industrial applications including autonomous GPS, SBAS (including WAAS, EGNOS, MSAS, and GAGAN), QZSS, and AGPS.
http://www.quectel.com/product/prodetail.aspx?id=62
CC3200 communicate with L80 via UART (9600bps, 8N1).
The L80 module supports 2 protocols:
- NMEA – positioning data ( output )
- PMTK – gps module configuration ( input )
In umbrella project I dont use PMTK protocol. L80 working with default configuration.
On the L80 NMEA output are avalible GPRMC, GPVTG, GPGSA, GPGSV, GPGLL GPTXT commands. In umbrella software I analize only one command: GPRMC.
I wrote simple state machine. In am checking L80 output NMEA chars and I am wait for „$GPRMC” string. If I found this string I am checking gps state (A-active, V-inactive). If gps position is active ( A state) then I am waiting form end of gprmc command. Then I check command CRC. If CRC code is corected then I finishign gps positioning procedure and I read latiotude and longitude values.
uInt8 GpsRmcFrame() { uInt8 l_byte; l_byte = UartA0Get(); switch(g_level) { case 0: if(l_byte == '$') { g_level = 1; g_index = 0; g_buffor[g_index++] = l_byte; } break; case 1: g_level = 0; if(l_byte == 'G') { g_crc = l_byte; g_level = 2; g_buffor[g_index ++] = l_byte; } break; case 2: g_level = 0; if(l_byte == 'P') { g_crc ^= l_byte; g_level = 3; g_buffor[g_index ++] = l_byte; } break; case 3: g_level = 0; if(l_byte == 'R') { g_crc ^= l_byte; g_level = 4; g_buffor[g_index ++] = l_byte; } break; case 4: g_level = 0; if(l_byte == 'M') { g_crc ^= l_byte; g_level = 5; g_buffor[g_index ++] = l_byte; } break; case 5: g_level = 0; if(l_byte == 'C') { g_crc ^= l_byte; g_level = 6; g_buffor[g_index ++] = l_byte; } break; case 6: g_crc ^= l_byte; g_buffor[g_index ++] = l_byte; if(g_index == 19) { if(l_byte == 'A') g_level = 7; else g_level = 0; } break; case 7: g_crc ^= l_byte; g_buffor[g_index ++] = l_byte; if(g_index == 82) g_level = 0; if(l_byte == '*') g_level = 8; break; case 8: g_level = 0; g_crc ^= '*'; g_buffor[g_index ++] = l_byte; if(l_byte >= 'A' && l_byte <= 'F') l_byte = l_byte - 'A' + 10; if(l_byte >= '0' && l_byte <= '9') l_byte = l_byte - '0'; if( (g_crc >> 4) == l_byte ) g_level = 9; break; case 9: g_level = 0; g_buffor[g_index ++] = l_byte; if(l_byte >= 'A' && l_byte <= 'F') l_byte = l_byte - 'A' + 10; if(l_byte >= '0' && l_byte <= '9') l_byte = l_byte - '0'; if( (g_crc &= 0x0f) == l_byte ) g_level = 10; break; case 10: g_level = 0; g_buffor[g_index ++] = l_byte; if(l_byte == 0x0D) g_level = 11; break; case 11: g_level = 0; g_buffor[g_index ++] = l_byte; if(l_byte == 0x0A) { return 1; // is complete rmc frame } break; default: g_level = 0; break; } return 0; }
sechematic:
final:
b.r.
Lukasz, Poland