|
TM STM32Fxxx HAL Libraries
v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle
|
GPS NMEA standard data parser for STM32Fxxx devices - http://stm32f4-discovery.net/2016/07/hal-library-35-gps-parser-stm32fxxx/. More...
Modules | |
| TM_GPS_Macros | |
| Library private defines without any sense for USER. | |
| TM_GPS_Typedefs | |
| Library Typedefs. | |
| TM_GPS_Functions | |
| Library Functions. | |
GPS NMEA standard data parser for STM32Fxxx devices - http://stm32f4-discovery.net/2016/07/hal-library-35-gps-parser-stm32fxxx/.
This library parses response from GPS module, in NMEA statements format.
For more, how GPS returns data, look at link below:
There is a lot of possible sentences, which can be returned from GPS. This library uses only 4. But some GPS don't returns all of this 4 sentences, so I made a possibility to disable them.
By default, these statements are in use and supported:
By default, each of this data has to be detected in order to get "VALID" data. If your GPS does not return any of this statement, you can disable option. If you disable any of statements, then you will loose data, corresponding to statement.
Add lines below in your defines.h file and uncomment your settings
To communicate with GPS, USART is commonly used. By default, my library uses USART1, but if you want your own USARTx, add lines below in your defines.h file:
With default pinout:
STM32F4xx TX = PB6
STM32F4xx RX = PB7
GPS library is based on USART library, which uses internal buffers to store data which are received but not read.
GPS receiver will send a lot of data at a time and if you are doing other stuff that time, it might happen that you will not so quickly update GPS data and buffer will overflow. Default buffer size is for my USART lib 32 bytes.
I recommend that you increase that memory. For further instructions how to do that, look at TM_USART module.
Distance between 2 points can not be provided from GPS receiver, so we have to calculate it. This is useful, if you have let’s say quadcopter and you want to know, how far you are from quad. First coordinate will be quad’s current position from GPS and second point will be set before you start with your flight.
If you want to make let’s say “Return home” function on quadcopter, bearing comes to be very useful. GPS module tells you your direction (included in library) where you are currently moving. Still, first coordinate is from quad’s GPS receiver, and second is where quad started with flight. When you activate “Return home” function, quad will know how far he is from “home” and in which direction (bearing) he has to move according to the north. Then, you just have to compare your calculated bearing with actual direction provided from GPS. And you will know, if he needs to go more left, right, etc. You can tune PID then according to values.
Library supports by default 4 statements. It assumes that every GPS module should output these 4 statements. It may happen, that your module outputs data that you need, but are not available with my library by default.
Here is why custom GPS statements come handy. It is possible to define custom statements which will be parsed as strings from GPS receiver directly to user.
For example, let’s say that your module outputs $GPRMB sentence (navigation). From that statement, you want to get “Steering value”, which can be “L” or “R” for Left or Right. Steering value is part 3 inside GPRMB sentence. If you want to include this into your output, you can do this:
This statement is now added into main GPS_Data structure and also, pointer to small GPRMB.3 structure is returned.
Version 1.0 - First release
- STM32Fxxx HAL - defines.h - TM USART - TM GPIO - defines.h - math.h