mDot with GPS on Weather Shield
Tagged: Debug Output, GPS, mDot, Serial Port, weather shield
- This topic has 23 replies, 7 voices, and was last updated 8 years, 3 months ago by daniel de kock.
-
AuthorPosts
-
May 2, 2016 at 1:16 pm #12368MichaelParticipant
I’ve successfully interfaced the SparkFun Weather Shield to a UDK2/mDot.
Now I’m trying to add the mini-GPS module to the Weather Shield.
I need to set up a serial port to the GPS and this is where I run into trouble.
1) The recommended process (according to Sparkfun) is to use the “Soft” serial interface which needs two digital data signals from the mDot that are not, as far as I can tell, actually wired to the mDot when using the UDK2.
2) The “other’ method, of course is to use the “Hard” serial interface (which, best I can tell, is a true UART) And…there’s some sample code available that appears to support this…but the instantiation seems hose up my existing USB debug connection.Any suggestions?
May 2, 2016 at 1:29 pm #12372Mike FioreBlockedMichael,
The mDot has a “hard” serial port available in addition to the USB debug port. Here’s a link to the pinout:
https://developer.mbed.org/platforms/MTS-mDot-F411/#pinout-diagram
You should be able to create a mbed Serial object with those two pins to communicate with your GPS module.
Hope this helps!
Cheers,
Mike
May 2, 2016 at 1:47 pm #12374MichaelParticipantHi Mike,
Thanks for the quick response… actually I *am* trying to use the hard interface, since, as a hardware guy, it was clear the wires just weren’t there for the “soft”.However I thought I had compatible example code, but upon further inspection it warns against an overlap with the USB pins…so…
I don’t really know how to do what you suggested (Serial object).
Can you spoon feed me just a bit more?Thanks!
May 2, 2016 at 1:55 pm #12375Mike FioreBlockedMichael,
Pins PA_9 & PA_10 are the USB debug interface. The other available UART is on pins PA_2/SERIAL_TX & PA_3/SERIAL_RX. Are you using PA_2 & PA_3? If not, please try those, e.g.
Serial gps(SERIAL_TX, SERIAL_RX);
The default baud rate of mbed Serial objects is 9600. You can change it with the Serial::baud() function.
Cheers,
Mike
May 2, 2016 at 2:05 pm #12376MichaelParticipantYes, I was already using those pins as you recommend in your post
For my debug output I’ve had all along
Serial pc(PA_9,PA_10);
and later in the code, a call to
pc.baud(115200);
That worked fine for a few weeks…Then today I tried to add GPS functionality:
SerialGPS gps(PA_3, PA_2, 4800);
orSerial gps(PA_3, PA_2); gps.baud(4800);
…and now the debug doesn’t output anything
May 2, 2016 at 2:17 pm #12381Mike FioreBlockedMichael,
Two things:
1) I don’t think 4800 baud is supported. I suggest using 9600 or faster.
2) Is SerialGPS a class you’ve defined? If you use a standard Serial object instead, does that work?
Cheers,
Mike
May 2, 2016 at 2:19 pm #12382MichaelParticipant1) I think the default for the GPS is 4800 – besides that should only screw up the GPS, not the USB debug port.
2) I tweaked my post probably while you were responding. Yes, it’s still busted with the standard.
May 2, 2016 at 2:23 pm #12384Jason ReissKeymasterHave you tried:
Serial gps(PA_2, PA_3);
The TX pin should be first.
Also you could see if any debug comes out at the mbed default 9600 if there are issues before the application is loaded.
May 2, 2016 at 2:47 pm #12387MichaelParticipant>>The TX pin should be first.
Sigh – after all my unraveling of the schematics etc I still got this wrong?
But does that affect the operation of the debug port?
May 2, 2016 at 2:51 pm #12389Jason ReissKeymasterThe app won’t start, there should be debug message
“pinmap not found for peripheral”
May 3, 2016 at 3:23 pm #12395MichaelParticipantI was able to verify, with a sniffer of sorts (TTL-to-USB), that the GPS module is beaconing at a 1Hz rate its various $G messages. The messages appear on the Weather Shield pin marked “RX” which, according to the schematic, makes it to the “D0” pin of the mDot – which should have been OK. I was not able to get the code to “get” anything however.
So after some scrutiny I found there are several jumpers on the UDK2 board, located in a cluster that’s identified as JP98. The default location of one of the jumpers disrupts GPS module’s TX output. (It appears to tie this output to another output from the 232 chip)
May 16, 2016 at 2:14 am #12502Görkem PolatParticipantHi,
#include "TinyGPS.h"Serial gpsSerial(PA_2,PA_3);
gpsSerial.baud(9600);
TinyGPS GPS;This worked fine for me, I used the TinyGPS for NMEA parsing.
I am also trying to integrate GPS module to mDot. Yet, GPS module needs 3V to 3.6V. How can it be sourced from mDot?
I am sourcing the mDot with 3.7V single cell LiPo battery, it is a bit higher for GPS module.
VOUT pin provides 3V @ 25mA which is not sufficient for GPS, it must be cabaple of at least 40 mA.
Any suggestions?
May 16, 2016 at 4:21 am #12503Andrew LindsayParticipantYou probably want to add a 3.3V voltage regulator or even just a diode and rely on the forward voltage drop to reduce the voltage to below 3.6V. Also note that even though the LiPo battery says 3.7V, it could be as high as 4.1V.
Andrew
July 6, 2016 at 7:39 pm #13717Ashu JoshiParticipantI am observing a debug output problem with SerialGPS. However I think I have narrowed it down to a combination of presence of mDot.h and SerialGPS.h – still NOT able to figure out the place of conflict but I have two starter programs – both of them do NOT interface to the LoRa radio. Both of them have code included for the Grove GPS – and I am using hte SerialGPS library. On the program that does NOT include the mDot.h – the program works fine and I am able to print the values of the GPS. However on the other program where I am setting up the mDot as well with mDot.h included in the program – the Serial output goes for a toss or locks up.
Any idea on what may be going on?
July 7, 2016 at 8:17 am #13720Mike FioreBlockedHi Ashu,
Can you explain in more detail what happens when you have mDot.h and SerialGPS.h in your application?
In your version of the application without the mDot library, is RTOS still included in the application? Aka, does anything include rtos.h?
Cheers,
Mike
July 7, 2016 at 8:32 am #13722Ashu JoshiParticipantMike,
I am glad you asked that question because yes there is another difference – I have mbed-rtos as well along with mDot. I had to include it because mDot needs rtos.h.
So this is another difference between the two code bases…
Ashu
July 7, 2016 at 8:35 am #13723Mike FioreBlockedThat’s what I suspected. Can you explain in detail what happens when your application has both libmDot (with mbed-rtos) and SerialGPS included?
July 7, 2016 at 8:44 am #13724Ashu JoshiParticipantThe short version of what happens is that at the beginning of the program before I go in a loop to read the BME280 sensor – I print out to the console the config values of mDot. This printing is erratic – sometimes it prints only 20% of the config, sometimes it gets stuck on the first line, sometimes it makes it almost to the first sensor output BUT it basically freezes – that is no more console output.
I suspect though that the system is up because I have the LED blink at the beginning and I can see the LED still blinking.
Including the header file of course does not do anything – its only when I declare the pins:
SerialGPS gps(PA_2, PA_3);
July 15, 2016 at 10:06 am #14176Ashu JoshiParticipantAny thoughts on how to resolve the issue with mbed-rtos and SerialGPS?
July 15, 2016 at 11:07 am #14179Mike FioreBlockedAshu,
Can you post your source code?
-Mike
July 15, 2016 at 4:03 pm #14184Ashu JoshiParticipantMike – I have posted the code base on mBed: https://developer.mbed.org/users/AshuJoshi/code/SensorInterface/
Note that this does NOT have of the actual GPS processing code because as from my earlier inputs – the mere inclusion & declaration causes this problem – so I did NOT move the over the code for actual GPS processing from another project where there is no libmdot, and hence I did not need mbed-rtos.
I have the deep sleep example also in there but it has problems that I have asked in another thread.
July 18, 2016 at 9:04 am #14205Mike FioreBlockedAshu,
I took a look at the code you posted and nothing jumped out at me. However, you mentioned that you didn’t include the GPS processing code which is presumably where the issue is. If you post the entire application, I’ll try to take a look at it.
Moving in a slightly different direction, MultiTech also has a mDot product called the MTDOT-BOX which might suit your needs.
http://www.multitech.com/brands/multiconnect-mdot-box
The MTDOT-BOX has onboard sensors, GPS, and an LCD screen in addition to the mDot module. We have an example application that uses all of these sensors and does LoRa communication as well.
Cheers,
Mike
July 18, 2016 at 1:53 pm #14217Ashu JoshiParticipantMike – I can send you the GPS code that I used – basically copied it from an example for SerialGPS with the Grove Kit. However the reason why there is NO code is because my serial console and also my transmit loop was either hanging or getting locked up. As mentioned before – I started removing code to find out what the issue was. The same code works and GPS module reports when I do NOT have libmdot (and mbed-rtos) in the project. In the source I sent you – to get it to hang – just UNCOMMENT the line that is declaring or rather assigning/initializing the GPS:
SerialGPS gps(PA_2, PA_3);
I am not sure what is going on – would PA_2/PA_3 conflict with something else?
July 29, 2016 at 8:16 am #14363daniel de kockParticipantI have been able to parse nmea sentences using a TinyGPS+ port ( very similar to TinyGPS – same author) by using bufferedSerial to buffer the NMEA strings so that TinyGPS can parse them in the main loop
I have these imports :
#include "TinyGPSplus.h" // can also use TinyGPS #include "BufferedSerial.h"
then I create these :
TinyGPSPlus gps; BufferedSerial uartGPS(XBEE_DOUT, XBEE_DIN,1024); // tx, rx,buffer size //
in main ( before the usual “while(1)” loop: ( “Setup()” in ArduinoLand
I set up the baudrate of the GPS interface :// set up UART to recieve GPS strings logInfo("setting up GPS serial port"); uartGPS.baud(9600);
and then in the While(1) loop ( or if you are From ArduinoLand (loop() )
// parse all the data in the serial buffer while(uartGPS.readable()>0) { // gps << uartGPS.getc(); gps.encode((char)uartGPS.getc()); }
you can then read the GPS parameters off exacly like the TinyGPS / TinyGPS+ libraries show , ie.
int altitudeGps = gps.altitude.meters();
- This reply was modified 8 years, 3 months ago by daniel de kock.
-
AuthorPosts
- You must be logged in to reply to this topic.