Hello!

I am trying to get ArduIMU+ V2 (with V1.7 firmware) to work with LS20031 GPS (http://www.sparkfun.com/commerce/product_info.php?products_id=8975).

I wired GPS's Tx to "IN" directly, and GPS's Rx to "OUT" through a 1:2 resistor divider (2.5V should be high enough for a 3.3V high).

And I set 
#define PRINT_GPS 1
#define GPS_PROTOCOL 1

The GPS is getting a fix (flashing red LED), but I don't see anything from the GPS in the ArduIMU serial output (reading through a FTDI adapter), and the GPS fix LED on ArduIMU doesn't turn on.

Has anyone gotten this combination to work? The code has references to LOCOSYS so I'm assuming someone has at least attempted to support it.

Thanks!
Matthew

Here is my entire configuration section, for reference -
// *** NOTE!   Hardware version - Can be used for v1 (daughterboards) or v2 (flat)
#define BOARD_VERSION 2 // 1 For V1 and 2 for V2

// Ublox gps is recommended!
#define GPS_PROTOCOL 1    // 1 - NMEA,  2 - EM406,  3 - Ublox    We have only tested with Ublox

// Enable Air Start uses Remove Before Fly flag - connection to pin 6 on ArduPilot 
#define ENABLE_AIR_START 0  //  1 if using airstart/groundstart signaling, 0 if not
#define GROUNDSTART_PIN 8    //  Pin number used for ground start signal (recommend 10 on v1 and 8 on v2 hardware)

/*Min Speed Filter for Yaw drift Correction*/
#define SPEEDFILT 2 // >1 use min speed filter for yaw drift cancellation, 0=do not use speed filter

/*For debugging propurses*/
#define PRINT_DEBUG 0   //Will print Debug messages

//OUTPUTMODE=1 will print the corrected data, 0 will print uncorrected data of the gyros (with drift), 2 will print accelerometer only data
#define OUTPUTMODE 1

#define PRINT_DCM 0     //Will print the whole direction cosine matrix
#define PRINT_ANALOGS 0 //Will print the analog raw data
#define PRINT_EULER 1   //Will print the Euler angles Roll, Pitch and Yaw
#define PRINT_GPS 1     //Will print GPS data

// *** NOTE!   To use ArduIMU with ArduPilot you must select binary output messages (change to 1 here)
#define PRINT_BINARY 0   //Will print binary message and suppress ASCII messages (above)

// *** NOTE!   Performance reporting is only supported for Ublox.  Set to 0 for others
#define PERFORMANCE_REPORTING 0  //Will include performance reports in the binary output ~ 1/2 min

/* Support for optional magnetometer (1 enabled, 0 dissabled) */
#define USE_MAGNETOMETER 0 // use 1 if you want to make yaw gyro drift corrections using the optional magnetometer                   

/* Support for optional barometer (1 enabled, 0 dissabled) */
#define USE_BAROMETER 0 // use 1 if you want to get altitude using the optional absolute pressure sensor                  
#define ALT_MIX 50 // For binary messages: GPS or barometric altitude.  0 to 100 = % of barometric.  For example 75 gives 25% GPS alt and 75% baro

Views: 282

Reply to This

Replies to This Discussion

Hi Matthew,

I am very interested in your investigation, because I also have LS20031 module and I am going to use it
with ArduIMU board.

Is it possible that 2.5v is too low voltage? The LS20031 spec says that minimum input voltage is 3v.
You could verify this by connecting the FTDI cable directly to the GPS module (in parallel with ArduIMU).
If you see normal NMEA output form it, then 2.5v input voltage is fine, and problem roots are somewhere
in GPS_NMEA parser.

Thanks,
Andrew
The VIH (minimum voltage recognized as logic high) in the datasheet is 2V, so while not the best practice, it should most certainly work. Just to clarify, I am powering it with 3.3V.

And I just realized there could be a baud rate mismatch. Will check it tonight.
I corrected the baud rate mismatch (changing the first Serial.begin(9600) to Serial.begin(57600)), and was able to get SOME corrupted data. The numbers just don't look right at all, and jump around a lot.

I also had to change a few things for it to compile.

To be terribly honest, the code is quite a big mess :P. Maybe I will try to refactor it a bit if I have the chance, but I just want to get it to work for now.

I think I will just skip the NMEA parser (since the current one is big and unreadable) and just write a dummy one that passes the string to my main computer, and do the parsing there instead.
The IMU's nmea parser seems to be based on the parser from ArduPilot sources, which now works fine (at least in the case of LS20031 module). So, you may want to adopt current version of AP's nmea parser for IMU needs...
I think I will just pass the unparsed string around, since my main computer runs Linux (gumstix), so parsing the NMEA sentences will be trivial (because sscanf supports floating point).

If anyone is interested, here's what I'm using.

void decode_gps(void)
{
gps_buffer[0] = '\0';

int gps_str_len = 0;

byte b;

// discard until '$'
while (Serial.available() > 0 && Serial.read() != '$');

while (Serial.available() > 0 && (b = Serial.read()) != '\n')
{
gps_buffer[gps_str_len++] = b;
}

gps_buffer[gps_str_len] = '\0';

if (gps_str_len > 0)
{
Serial.print(gps_buffer);
Serial.print('\n');
}
}
I think the biggest problem here is serial buffer overflow, and maybe that's why I'm getting data corruption.

The Arduino serial buffer is 128 bytes long, and 2 NMEA sentences can easily exceed that, especially when you have a fix (lines get quite a bit longer).

I'm not sure how to get around that yet, short of doing external buffering.

The baudrate doesn't matter because we are asking for 2 sentences, and they always arrive at the same time, most likely when the MCU is doing something else.

Any suggestions?
I worked around it by making my own 512 bytes buffer "wrapper", and a function that copies everything from serial buffer to my buffer. Then I call the function on each iteration of the main loop.

512 bytes buffer can hold about 6-7 sentences, so that should be fine, if the decode_gps function is called at least every 5 GPS updates (at 5Hz that's once per second - but what's the point of getting 5Hz updates if you are only going to use it once per second? 4 readings would be outdated anyways). I optimized the ArduIMU code heavily (mostly taking out things I don't need), and am able to take GPS readings a few times a second.

Very ugly, but seems to work. I've been running it for a few minutes, and didn't see any data corruption (they were very obvious and frequent).

I suspect it can help with the official parser, too, since it should have the same trouble (data corruption), but I'm not working with that code anymore.

By the way, the NMEA_OUTPUT_5HZ - NMEA_OUTPUT_1HZ strings are wrong. That's not what the PMTK command does.

A value of 1 means it will output that type of sentence every update, 2 means every other update, 3 means every third update, etc.

So to get 5Hz updates of both sentence types, you'll need to set overall update rate to 5Hz, and "NMEA_OUTPUT_1HZ".
Mathew,

Thanks for the detective work. None of us on the dev team use NMEA GPS modules, which is why that wasn't supported and is probably buggy. It sounds like you've come up with some good fixes. If you can PM me an email address I can give you commit access to the repository so you can add your changes to the current code and we can test and possibly release them as the official version.

Best,

Chris
I ported my fix to the official source, but I'm still getting garbage data.

I can confirm that it's getting the whole NMEA sentences, though.

Probably something wrong with the parser. I'm trying to rewrite it and make it more readable also.

RSS

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service