IOT on Wheels Design Challenge - Smart Drive - Project Index
Using STM32CubeMX to configure USART3
My GPS module only supports serial communication. So I've again used STM32CubeMX to configure serial ports. I've configured STM32L476RG pins PC11 and PC12 as USART3_RX and USART3_TX As well I configured USART3 to use interrupts. And then I've generated the code template. It was quite straightforward.
Porting Arduino UBX GPS MultipleMessages code
I've ported GPS module configuration and parser from Arduino. The original Arduino code and UBX messages has been explained in UBX GPS MultipleMessages video https://www.youtube.com/watch?v=ylxwOg2pXrc . UBX is an alternative to NMEA protocol developed by u-Blox.
The configuration ensures that I only receive messages that I'm interested in, like position and status of connection with satellites (how reliable is information about position). One of the challenges during the port was to migrate from polling serial port in Arduino to use of interrupts with STM32. STM32 interrupts works great. But the challenge was that UBX messages have a variable length. So I was forced to use interrupts after receiving each byte. The next day after I've completed my code I've receive an article from STMicroelectronics Community "Efficiently use DMA with UART RX on STM32" https://community.st.com/thread/42689-efficiently-use-dma-with-uart-rx-on-stm32 . They describe a better approach to handling this situation. As I'm running out of time with my project I'll delay the change for another time.
Connecting hardware components
I've connected serial ports from GPS module with Morfio pins of STM32L476RG Nucleo board. In addition I've monitored serial communication using USB to RS232 serial adapter, which was connected to my PC.
Running tests
This test I executed inside the house. So GPS module was not able identify latitude and longitude. But it was sending messages as expected and parser was able to go over this messages without any issues.
STM32CubeMX and Nucleo expansion boards
STM32CubeMX accelerated and simplified parts of low level coding. I've start looking how to use it with my sensors and WiFi Nucleo expansion boards.I was surprised to find out that
it is not aware of Nucleo expansion boards at all at this time.