Re: GPS integration
Posted: Sun Aug 26, 2012 1:05 pm
Is it released for Pro mini? Is there something I can do for Pro mini?
Bledi wrote:tsoum wrote:Hello Eosbandi,
i have the following gps board from adafruit that uses a MTK3339 chip: http://www.adafruit.com/products/746#tutorials.
I would like to ask you if this is compatible whith I2C gps. If it is, can i flash it with MTK3329 firmware? If not is it going to be in your future plans?
Thanks in advance!
George
yes it's work (it's what I am using) but you can't use MTK binary protocol. Don't try to flash it with MTK3329 firmware
Tizzy wrote:Bledi wrote:tsoum wrote:Hello Eosbandi,
i have the following gps board from adafruit that uses a MTK3339 chip: http://www.adafruit.com/products/746#tutorials.
I would like to ask you if this is compatible whith I2C gps. If it is, can i flash it with MTK3329 firmware? If not is it going to be in your future plans?
Thanks in advance!
George
yes it's work (it's what I am using) but you can't use MTK binary protocol. Don't try to flash it with MTK3329 firmware
I've been trying to get my LS20031 MTK3339 working for days now with a Crius AIOP and mwii 2.1, but it has a hard time holding it's config. The module is running the 1.30 firmware but defaults to 57600 1Hz if left to the battery. I tried flashing the firmware to 115200 and 10Hz but that gave an error (illegal sync command at the end) and I'd actually prefer to get it initialized properly by the FC on boot so the unused sentences are switched off.
I've swapped the original gps.ino out with EosBandi's, changed the config.h GPS_BAUD to 57600 and defined MTK and the LEAD_FILTER. I then added the MTK init in the multiwii_2.1.ino. Not working, the FC doesn't receive any data altho the gps module does get initialized.
Checking the code in gps.ino it sets binary mode so I was wondering based on the above remark if it's enough to comment out that line or is there something else I need to do?
Code: Select all
#if defined(MT3339)
#define MTK_SET_SPEED "$PMTK251,115200*1F\r\n"
#define MTK_SET_BINARY "$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n" // not actually for binary but it was easier to reuse the existing variables by eosbandi
#define MTK_SET_5HZ "$PMTK220,100*2F\r\n" //actually it's for 10Hz
#define MTK_SET_10HZ "$PMTK300,100,0,0,0,0*2C\r\n" //also for 10Hz, not sure which is needed, but either one should work
void SerialWriteBuffer(uint8_t port, uint8_t *buffer, uint8_t size)
{
uint8_t i;
uint8_t *ptr;
ptr = buffer;
for (i=0;i<size;i++) {
SerialWrite(port,*ptr);
ptr++;
}
}
void MT339_init(void)
{
SerialOpen(GPS_SERIAL,38400);
delay(1500);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_SPEED, sizeof(MTK_SET_SPEED)-1);
delay(300);
SerialEnd(GPS_SERIAL);
SerialOpen(GPS_SERIAL,57600);
delay(1500);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_SPEED, sizeof(MTK_SET_SPEED)-1);
delay(300);
SerialEnd(GPS_SERIAL);
SerialOpen(GPS_SERIAL,115200);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_BINARY, sizeof(MTK_SET_BINARY)-1);
delay(1000);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_5HZ, sizeof(MTK_SET_5HZ)-1); //actually it's still for 10Hz
delay(300);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_10HZ, sizeof(MTK_SET_10HZ)-1);
delay(300);
SerialEnd(GPS_SERIAL);
}
#endif
Code: Select all
.....
......
// This code is used for parsing NMEA data
#if defined(GPS_SERIAL)
#if !defined(UBLOX)
/* Alex optimization
The latitude or longitude is coded this way in NMEA frames
.....
This function converts this format in a unique unsigned long where 1 degree = 10 000 000
EOS increased the precision here, even if we think that the gps is not precise enough, with 10e5 precision it has 76cm resolution
with 10e7 it's around 1 cm now. Increasing it further is irrelevant, since even 1cm resolution is unrealistic, however increased
resolution also increased precision of nav calculations
*/
/////////////// NEB (Carlonb) from Eosbandi idea
// Autosetup for serial GPS MTK 3329 chipset
// The strange think is that the new serial speed update will be accepted only if the GSP chiset is in default state at 9600 bps ???!!!
// My GPS will go back in default setttings after 2 days unpowered.
// With this, if GPS is in default state, OK, will be updated with new param, if not, no problem, will not accept these commands and nothig happens,
// simply means that already has these new parameters (115200bps, 10Hz, GGA and RMC NMEA strings).
void NMEA_MTK_NEB_init(void) // NEB
{
const unsigned long baudrates[5] = {9600U, 19200U, 38400U, 57600U, 115200U};
//const unsigned long baudrates[4] = {9600U, 19200U, 38400U, 57600U};
//#define NMEA_MTK_RESET "$PMTK104*37\r\n" // Reset to factory default
#define NMEA_MTK_STRING "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" // Command for only GGA & RMC NMEA strings
#define NMEA_MTK_SET_SPEED "$PMTK251,115200*1F\r\n" // 115200 bps
//#define NMEA_MTK_SET_SPEED "$PMTK251,57600*2C\r\n" // 57600 bps
//#define NMEA_MTK_SET_SPEED "$PMTK251,9600*17\r\n" // 9600 bps
#define NMEA_MTK_SET_HZ "$PMTK300,100,0,0,0,0*2C\r\n" // 10Hz
//#define NMEA_MTK_SET_HZ "$PMTK300,200,0,0,0,0*2F\r\n" // 5Hz
//#define NMEA_MTK_SET_HZ "$PMTK300,1000,0,0,0,0*1C\r\n" // 1Hz
for (uint8_t i=0; i<6; i++) { // Carlonb from idea of EOSBANDI (autosearch of default baud rate)
SerialOpen(GPS_SERIAL,baudrates[i]);
delay(200);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)NMEA_MTK_SET_SPEED, sizeof(NMEA_MTK_SET_SPEED)-1); // NEB set GPS serial speed
delay(200);
SerialEnd(GPS_SERIAL);
delay(200);
}
SerialOpen(GPS_SERIAL,GPS_BAUD); // NEB changed 57600 with GPS_BAUD
delay(200);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)NMEA_MTK_SET_HZ, sizeof(NMEA_MTK_SET_HZ)-1); // NEB set GPS refresh rate (Hz)
delay(200);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)NMEA_MTK_STRING, sizeof(NMEA_MTK_STRING)-1); // NEB set GPS for GGA & RMC NMEA strings only
delay(200);
SerialEnd(GPS_SERIAL);
delay(100);
}
void SerialWriteBuffer(uint8_t port, uint8_t *buffer, uint8_t size)
{
uint8_t i;
uint8_t *ptr;
ptr = buffer;
for (i=0;i<size;i++) {
SerialWrite(port,*ptr);
ptr++;
}
}
/////////////// NEB mod end
#define DIGIT_TO_VAL(_x) (_x - '0')
....
Code: Select all
#if defined(GPS_SERIAL)
///////////// EOSBANDI
#if defined(UBLOX)
UBLOX_init();
delay(200);
#endif
#if defined(MTK)
MTK_init();
delay(200);
#endif
#if defined(NMEA) // NEB added for NMEA MTK setup
NMEA_MTK_NEB_init();
delay(200);
#endif
///////////// EOSBANDI
SerialOpen(GPS_SERIAL,GPS_BAUD);
....
....
Code: Select all
#define GPS_SERIAL 2 // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
#define GPS_BAUD 115200 // 57600
#define NMEA
//#define UBLOX // Eosbandi
//#define MTK // Eosbandi
....
....
Tizzy wrote:Thanks for that. It looked like it was a step in the right direction so I added the code below (by grace of eosbandi and kristaps_r) to the gps.ino after the "#if defined (TINY_GPS)" section. I then added "#define MT3339" to config.h in the GPS section and added a few lines in the multiwii code after "#if defined(GPS_SERIAL)" to init the MT339:
"
#if defined(MT339)
MT3339_init();
delay(200);
#endif
"
It doesn't get in the way of the code but it doesn't initalise the MT3339 either. I feel as if I'm really close. Please help, I'm losing my hair!!!Code: Select all
#if defined(MT3339)
#define MTK_SET_SPEED "$PMTK251,115200*1F\r\n"
#define MTK_SET_BINARY "$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n" // not actually for binary but it was easier to reuse the existing variables by eosbandi
#define MTK_SET_5HZ "$PMTK220,100*2F\r\n" //actually it's for 10Hz
#define MTK_SET_10HZ "$PMTK300,100,0,0,0,0*2C\r\n" //also for 10Hz, not sure which is needed, but either one should work
void SerialWriteBuffer(uint8_t port, uint8_t *buffer, uint8_t size)
{
uint8_t i;
uint8_t *ptr;
ptr = buffer;
for (i=0;i<size;i++) {
SerialWrite(port,*ptr);
ptr++;
}
}
void MT339_init(void)
{
SerialOpen(GPS_SERIAL,38400);
delay(1500);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_SPEED, sizeof(MTK_SET_SPEED)-1);
delay(300);
SerialEnd(GPS_SERIAL);
SerialOpen(GPS_SERIAL,57600);
delay(1500);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_SPEED, sizeof(MTK_SET_SPEED)-1);
delay(300);
SerialEnd(GPS_SERIAL);
SerialOpen(GPS_SERIAL,115200);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_BINARY, sizeof(MTK_SET_BINARY)-1);
delay(1000);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_5HZ, sizeof(MTK_SET_5HZ)-1); //actually it's still for 10Hz
delay(300);
SerialWriteBuffer(GPS_SERIAL, (uint8_t *)MTK_SET_10HZ, sizeof(MTK_SET_10HZ)-1);
delay(300);
SerialEnd(GPS_SERIAL);
}
#endif
dramida wrote: And BTW, The gps FMP04 mentioned above can be flashed with MTK3329 10 hz firmware ( i have one this way)
pm1 wrote:flyman777 wrote:I tried the Poshold with genuine i2c_gps_nav rc2 from EOS but my copter speeded up after a few seconds forwards and backwards and begin to tilt so I must switch off the gps for avoiding a crash.
That's exactly the situation I met. Therefore I had a deeper look into the code. The lines I did put in limit the possible speed in PH. It didn't show the result I expected. The I saw, that D term was not related to change of speed, but to change of distance. I made D term to zero, then it worked as expected by me.
If you are using i2c GPS, make additionally following modification on the fc (GPS.ino):
void GPS_NewData() {
uint8_t axis;
#if defined(I2C_GPS)
static uint8_t GPS_pids_initialized;
static uint8_t _i2c_gps_status;
//Do not use i2c_writereg, since writing a register does not work if an i2c_stop command is issued at the end
...
...
if (_i2c_gps_status & I2C_GPS_STATUS_NEW_DATA) { //Check about new data
if (GPS_update) { GPS_update = 0;} else { GPS_update = 1;} //Fancy flash on GUI
if (!GPS_pids_initialized) {
GPS_set_pids();
GPS_pids_initialized = 1;
}
Without this modification, you may always use the default pids hard coded in the i2c board. Then try the pids from my post as a start.
Code: Select all
//************* GPGSA FRAME parsing
case GPRMC_FRAME:
switch(param)
{
[b][color=#FF0000]case 7: i2c_dataset.ground_speed = (atof(string)*0.5144444)*100;[/color][/b] //convert to m/s*100
Code: Select all
//************* GPGSA FRAME parsing
case GPRMC_FRAME:
switch(param)
{
[b][color=#FF0000]case 7: i2c_dataset.ground_speed = (atof(string)/0.5144444)*1000*100/3600;[/color][/b] //convert to m/s*100
Some firmware versions (e.g. most AXN1.50) have a hardware mismatch protection function. When a user flashes a firmware intended for a module (e.g. PA6B) into another one (e.g. PA6C), then a sentence like the following
EOSBandi wrote:Ublox neo modules are not reflashable, but they not need it at all....
You need the u-center software to config the u-blox module.
Here is a settings file for NMEA. You can download it to your module with the tools->GPS configuration menu...
Once the binary protocol parser is committed to Multiwii i'll update the i2c sw too.
One more issue : I found that the onboard battery of these ebay ublox modules are hardly last more than a couple of days... and since the neo-6M does not have flash onboard, then it forgets the settings. So it's worth do buy an i2c EEPROM chip (about .5usd a piece) (Microchip 24AA32A, or ST MC24C32-R) and connect it to the i2c port of the gps (some boards already has i2c port connection, or you can solder it directly to the module). (I'll update the GPS docs about ublox, including the external i2c storage).
I there is interest, i'll make breakout boards with i2c eeprom chips.
pm1 wrote:flyman777 wrote:I tried the Poshold with genuine i2c_gps_nav rc2 from EOS but my copter speeded up after a few seconds forwards and backwards and begin to tilt so I must switch off the gps for avoiding a crash.
That's exactly the situation I met. Therefore I had a deeper look into the code. The lines I did put in limit the possible speed in PH. It didn't show the result I expected. The I saw, that D term was not related to change of speed, but to change of distance. I made D term to zero, then it worked as expected .
bill516 wrote:Is there any way of getting what the GPS module settings are while the GUI is running, it would be nice to know the speed and baud rate are as expected.
EmmeDi8 wrote:Hi,
this is the version of my gps.
How can I check if is lastest version and support binary protocol ?
Thanks
flyboy_____ wrote:EmmeDi8 wrote:Hi,
this is the version of my gps.
How can I check if is lastest version and support binary protocol ?
Thanks
Is you r GPS MKT 3329 or MKT 3339?
EOSBandi wrote:The basic rule is that the antenna gain increases with the size (and volume). Antenna manufacturers are giving the antenna gain towards the zenith, but it is more important that how sensitive the antenna towards the horizon and this is where the size really matters. (For example a 25x25mm antenna and a 35x35mm antenna booth have 2dB gain at Zenith, but at 10° elevation the 25x25 antenna has only -4dB gain while the 35x35 antenna has 1.5dB.
dramida wrote:Ublox GPS protocol dosen't work anymore on MWC21 R1100 with some MPU boards.
Tested on two different Crius AIO Mega boards with three different ublox GPS receivers and serial ppm. The yellow led is blinking, the GUI shows GPS activity BUT THE SAT NUMBER STAYS 220, SPEED SWINGS AND BAD COORDINATES ARE DISPLAYED.
Strange is that same software worked on a mega controller with BMP085- ITG3200-BMA180 and HMC83xx (Paralel RC channel imput). I even uploaded the same software that worked on AIO board and the GPS dosen't work anymore.
Mis wrote:Indeed the UBLOX parser is overcomplicated and little crazy
Get fresh r1117 version from repository, and UBLOX should work propertly.
I'm rewrite some pieces of UBLOX parser, and fix it.
Tested on Crius AIO Pro with RC-Timer UBLOX module.
LuFa wrote:is this error also in the i2c GPS Code ?
Mis wrote:dramida wrote:Ublox GPS protocol dosen't work anymore on MWC21 R1100 with some MPU boards.
Tested on two different Crius AIO Mega boards with three different ublox GPS receivers and serial ppm. The yellow led is blinking, the GUI shows GPS activity BUT THE SAT NUMBER STAYS 220, SPEED SWINGS AND BAD COORDINATES ARE DISPLAYED.
Strange is that same software worked on a mega controller with BMP085- ITG3200-BMA180 and HMC83xx (Paralel RC channel imput). I even uploaded the same software that worked on AIO board and the GPS dosen't work anymore.
Indeed the UBLOX parser is overcomplicated and little crazy
Get fresh r1117 version from repository, and UBLOX should work propertly.
I'm rewrite some pieces of UBLOX parser, and fix it.
Tested on Crius AIO Pro with RC-Timer UBLOX module.
Code: Select all
////////////////////////////////////////////////////////////////////////////////////
// Calculate nav_lat and nav_lon from the x and y error and the speed
//
static void GPS_calc_poshold(int x_error, int y_error)
{
int32_t p,i,d;
int32_t output;
int32_t x_target_speed, y_target_speed;
// East / West
x_target_speed = pi_poshold_lon.get_p(x_error); // calculate desired speed from lon error
x_rate_error = x_target_speed - x_actual_speed; // calc the speed error
.
.
diyboy wrote:I refer to EOSBANDI's "ublox-hw-hacks" guide to connect a EEPROM to my NEO-6M GPS. After that I use U-Center to config the GPS to 57600 and 5Hz rate and then save the data to GPS. But all data will return to default configuration after power off the GPS.
Anybody can help me to solve this problem. Thank a lot!
Termic1 wrote:diyboy wrote:I refer to EOSBANDI's "ublox-hw-hacks" guide to connect a EEPROM to my NEO-6M GPS. After that I use U-Center to config the GPS to 57600 and 5Hz rate and then save the data to GPS. But all data will return to default configuration after power off the GPS.
Anybody can help me to solve this problem. Thank a lot!
With the new dev 1129 and following multiwii configures RCTimer Ublox GPS at start up. No need to hack anything.
Luciano
diyboy wrote:Termic1 wrote:diyboy wrote:I refer to EOSBANDI's "ublox-hw-hacks" guide to connect a EEPROM to my NEO-6M GPS. After that I use U-Center to config the GPS to 57600 and 5Hz rate and then save the data to GPS. But all data will return to default configuration after power off the GPS.
Anybody can help me to solve this problem. Thank a lot!
With the new dev 1129 and following multiwii configures RCTimer Ublox GPS at start up. No need to hack anything.
Luciano
Hi Luciano,
Do you mean the updated version "MultiWii_dev_r1143.zip "?
I going to try it. Thanks!
DIYBoy
Termic1 wrote:I'm still using dev r1129 and GPS config works great. I assume that it will work with r1143 too.
Of course you need to define GPS, UBLOX, speed, etc...