IOT on Wheels Design Challenge - Smart Drive - Project Index
Connecting Nucleo STM32L476RG USART3 Serial Port with GPS Receiver
In one of my previous blog posts I've described how to connect GPS receiver to the Nucleo board using STM32CubeMX tool and STM32Cube libraries.But I've realized that STM32CubeMX is not aware of Nucleo Expansion Boards. As result, I switched back to MBed platform. I was not sure if USART3 TX and RX still going to work with my Nucleo board connected to two expansion boards at the same time. I've ported again UBX GPS MultipleMessages code this time to MBed and configured Nucleo STM32L476RG Nucleo Morfio pins PC_10 and PC_11 as USART3 TX and RX ports.
Serial gps(PC_10, PC_11); //USART3 tx, rx
This time I've used MBed serial callback instead of STM32Cube interrupts to process serial input from GPS receiver.
gps.attach(&gps_msg_callback, Serial::RxIrq);
Then I've connected the board with GPS receiver serial ports.
I've tried by connecting pins Nucleo STM32L476RG Nucleo ST morfo connector pins PC_10 and PC_11 to GPS receiver serial ports.
Callback Lesson
I was not very optimistic that it will work right away. And it was not working at first as I've added as well printf function in my serial callback processing for debug purposes. But after some googling I found that the code in callback function should be very fast and shouldn't use any expensive I/Os. After removing printf debug code the code for GPS serial output processing start start working.
Test
The following screenshot provides a view on content of variables populated by processing GPS data. I'm using U-Blox UBX protocol NAV-POSLLH message to get location and NAV-STATUS to get details if my GPS readings are valid.
Summary
At this point all major components are in place, connected and functioning as expected. So I'm very happy about it. But there are still a lot of work left in the few remaining days before the end of the contest on November 13th.