MikroKopter - Forum » MikroKopter - general » GPS Initialisation and configuration code is not in SVN

GPS Initialisation and configuration code is not in SVN

Seite: 1

Autor Neuer Beitrag
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
After V0.22 of NaviCtrl MK supports MKGPS V2.1 which requires a re-configuration in startup.. I read this somewhere in this forum, but I cannot find where I did...

So I decided to find it in the NaviCtrl source, I checked out the latest code from SVN but there's nothing in the code about this issue, or I couldn't find it...

I tried to search for the words
"Looking for GPS" and "Configuring GPS" but I was unable to find them as well..

So are these codes stripped out from the SVN.. Or are they located in GPS.C (which doesn't make sense) ? Or are there any other parts (which are not related with 250m limit) are not provided while commiting to SVN ?

I am stucked.. All my new GPS routins work fine with the MKGPS V1.0 (the one with Ublox LEA-4H) but not with the new MKGPS...


Can anyone help me... If it is there and I can't find it, I don't want to waste my time to debug the MKGPS-NAvi linkand see what we send to GPS for initialization.... or do I ...

Anyhow.. if someone can show me a shortcut I will be very happy...


Metalman
Mitglied
Registriert seit: Oct 2010
Beiträge: 1334
Ort: Copenhagen, Denmark
Just remove the config file on the sd card, and disconnect/connect power, and you have the new config.

The navi code is mostly closed, so that's why you can't see much.
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
wizprod meinte
Just remove the config file on the sd card, and disconnect/connect power, and you have the new config.

The config file I tried to mention is the GPS config file. I don't have an SD inserted, shoul I have to ?
wizprod meinte
Te navi code is mostly closed, so that's why you can't see much.

Yes I know, but there are some other functions which are not related to navigation are missing as well... For example V0.86/0.26 has a initialization message "looking foir flight c..." But it is missing in source code...

Is there a list of "what is wiped out from source?" Somewhere?


Metalman
Mitglied
Registriert seit: Jun 2009
Beiträge: 514
you need the sd card.the settings keeped (also created) in the card as I know
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
The SD only contains MK settings.. According to settings.c file it keeps KML logging interval, etc.. These are the definitions in the file

"KMLLOGGING "
"GPXLOGGING "
"GPSAUTOCONFIG "


These are not the configs I am looking for.. he LEA-6S ublox gps receiver does not contain a memory to keep settings of the GPS (like baudrate, which is in default 9600 baud, but MK needs a communication speed of 57600)

So, prior to communicate with Ublox GPS we need to send a parameter configuration in speed of 9600 (which is default bootup speed of LEA-6S than we can switch to 57600 and start gathering data from the GPS.

The config data that I was able to capture from MK-to-GPS line sniffing is as follows (assume it as hex numbers);

EF186088001C000000800000000000800000000000800000000000FEB5620600140001000000D008000000E100000100010000000000D68D000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066CF183
C780000600300060000000000F9808000000006FC00000600000600000000000078F3E6E0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000AC01000000480080000000000049000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C6424A5242425E424
242424242424242424242424242424242424242424242424242424242FE8C6008000000000000000000000000000000000000000000808C6008000000
000000000000000000000000000000000000808C6008000000002100010000000000000000000000000000808C6008000000000000000000000000000
000000000000000808C600800000000000000000000000000000000000000000080


(the only impartant CFG-PRT part is B5620600140001000000D008000000E100000100010000000000D68D0... )

I found a few functions in uart0.c and ubx.c like ;
- UBX_CreateMsg,
- UART0_Configure,
- UART0_Connect_to_MKGPS,
- UART0_Transmit,
- UART0_TransmitTxData,
- UART0_UBXSendMsg ,
- UART0_UBXSendCFGMsg

Now I have to figure out how to call these functions, in which order and wgere (in GPS_Init ???)

Anyone with any useful idea ?

Metalman
« Bearbeitet von metalmanbaris am 19.11.2011 21:26. »
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
I modified the uart0.c in navictrl 0.26f and put these lines into the function called UART0_Configure.. Now both my LEA-4H and LEA-6S working .. tomorrow is the time to test a LIMITLESS flight...

// configure the UART0
//metalman 19.11.2011 20:46UTC
//during bootup ubx lea-6s is in 9k6 mode so put port to 9k6 first
//and send a configuration stream to configure the port to 56k than switch to 56k for uart0
UART0_Configure(9600);
u8 cfgmsg[]={0x06,0x00,0x14,0x00,0x01,0x00,0x00,0x00,0xD0,0x08,0x00,0x00,0x00,0xE1,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00}; //Setbaud 57600-8-N-1 in/out format as UBX
UART0_UBXSendCFGMsg(cfgmsg, sizeof(cfgmsg));
UART0_Configure(Baudrate);

UART0_Muxer = UART0_MKGPS;

/* TODO */
// use ublox MK config file dated 2008 to fully configure the GPS
// send all config data in 56k speed


P.S. : Dear Holger... are there any other missing parts in source that is provided in SVN... other than GPS.C ??????

Metalman
The limit is the sky....
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
After having a few trouble with the new GPS initializatoin I figured out that ONLY CHANGING THE PORT speed is not enough... these are the basic rules to be done fpr a valid GPS ;
- port speed must be 57600
- port must be set UBX (might be NMEA+UBX but NMEA slows down the system)
- the update rate must be 5Hz (200ms)
- At least these messages need to be configured on UART1
01-02 NAV-POSLLH
01-06 NAV-SOL
01-12 NAV_VELNED

The final config file should be something like this.. I will post the whole corrected source code of UART0_Configure later.. (after fully tested..)

CFG-DAT - 06 06 02 00 00 00
CFG-INF - 06 02 0A 00 01 00 00 00 87 87 87 87 87 87
CFG-INF - 06 02 0A 00 03 00 00 00 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 01 01 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 01 02 00 01 00 00 00 00
CFG-MSG - 06 01 08 00 01 03 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 01 04 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 01 06 00 01 00 00 00 00
CFG-MSG - 06 01 08 00 01 12 00 01 00 00 00 00
CFG-MSG - 06 01 08 00 01 20 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 01 30 00 01 00 00 00 00
CFG-MSG - 06 01 08 00 02 20 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 02 23 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0A 02 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0A 05 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0A 06 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0A 09 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0A 0A 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0B 00 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0B 30 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0B 31 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0B 32 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 0D 01 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 F0 00 00 00 00 00 00 01
CFG-MSG - 06 01 08 00 F0 02 00 00 00 00 00 01
CFG-MSG - 06 01 08 00 F0 03 00 00 00 00 00 01
CFG-MSG - 06 01 08 00 F0 04 00 00 00 00 00 01
CFG-MSG - 06 01 08 00 F0 05 00 00 00 00 00 01
CFG-MSG - 06 01 08 00 F0 06 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 F0 07 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 F0 09 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 F0 0A 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 F1 00 00 00 00 00 00 00
CFG-MSG - 06 01 08 00 F1 03 00 00 00 00 00 00
CFG-NAV5 - 06 24 24 00 FF FF 00 03 00 00 00 00 10 27 00 00 05 00 FA 00 FA 00 64 00 2C 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
CFG-NAVX5 - 06 23 28 00 00 00 FF 1F FF FF FF FF 03 02 03 10 0A 00 00 01 00 00 F8 05 00 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
CFG-PRT - 06 00 14 00 00 14 42 00 84 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
CFG-PRT - 06 00 14 00 01 17 42 00 C0 08 00 00 80 25 00 00 01 00 01 00 00 00 00 00
CFG-PRT - 06 00 14 00 02 12 42 00 C0 08 00 00 80 25 00 00 00 00 00 00 00 00 00 00
CFG-PRT - 06 00 14 00 03 13 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
CFG-RATE - 06 08 06 00 C8 00 01 00 01 00
CFG-RXM - 06 11 02 00 00 00
CFG-TP - 06 07 14 00 40 42 0F 00 A0 86 01 00 01 01 00 00 32 00 00 00 00 00 00 00
CFG-TP5 - 06 31 20 00 00 00 00 00 32 00 00 00 40 42 0F 00 40 42 0F 00 00 00 00 00 A0 86 01 00 00 00 00 00 F7 00 00 00


Metalmanbaris
Ideas get bigger when they are shared...
Mitglied
Registriert seit: Dec 2010
Beiträge: 180
If you look at the old configuration file and the data sheets for the LEA-4H, you get some idea of what needs to be in a configuration file for an MK.

Hardware_man
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
Yes, that exactly what I did.. Thanks for guidance... But I am trying to figure out the config diferences between LEA-4 and LEA-6.. there are some minor..
:)
Mitglied
Registriert seit: Dec 2010
Beiträge: 180
Why don't you connect the Rx input of your Sercon to the line that is Tx out of the Navi to Rx into the GPS board. Monitor it in Hyperterminal and boot the MK up. I think the new configuration file is all text so you should get a copy of it.

Hardware_man
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
I did that and tried to explain the result in the previous message old post...

But I think I had a problem there which is the baudrate changes by time.. first it starts 9600 baud, then after sending the CFG-PRT part which is B5620600140001000000D008000000E100000100010000000000D68D0 it goes to 57600... when I monitor at a contans speed I got some garbage as I posted.. then I did sniffing on both 9k6 and 56k, then I got some more usefull information...

Now it is working...
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
I think I figured out why GPS configuration is not in SVN, because the GPS.c is a good place for initializing the GPS :) which is absolutely wiped in svn..

I tried to put this code into GPS_Init function
(sorry for ugly coding...)
u8 cfgreset[]={0x06,0x09,0x0D,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x07};
u8 cfg56k[] ={0x06,0x00,0x14,0x00,0x01,0x00,0x00,0x00,0xD0,0x08,0x00,0x00,0x00,0xE1,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00};

UART1_PutString("\r\n GPS init...");
UART1_PutString("\r\n Checking GPS availability...");
UART0_Connect_to_MKGPS(9600);
if (UART0_GetUBXVersion() != 0xFF)
{
UART1_PutString("\r\nFound Something like GPS at 9k6 :");
if (UART0_UBXSendCFGMsg(cfgreset, sizeof(cfgreset))>0) UART1_PutString("\r\nGPS config resetted");
if (UART0_UBXSendCFGMsg(cfg56k, sizeof(cfg56k))>0) UART1_PutString("\r\nGPS configured for 56k");
}
UART0_Connect_to_MKGPS(57600);
if (UART0_GetUBXVersion() != 0xFF)
{
UART1_PutString("\r\nFound Something like GPS at 56k :");
u8 cfgnavposllh[]={0x06,0x01,0x08,0x00,0x01,0x02,0x00,0x01,0x00,0x00,0x00,0x00}; //nav-posllh-02
u8 cfgnavsol[] ={0x06,0x01,0x08,0x00,0x01,0x06,0x00,0x01,0x00,0x00,0x00,0x00}; //nav-sol-06
u8 cfgnavvelned[]={0x06,0x01,0x08,0x00,0x01,0x12,0x00,0x01,0x00,0x00,0x00,0x00}; //nav-velned-12
u8 cfgnavsvinfo[]={0x06,0x01,0x08,0x00,0x01,0x30,0x00,0x01,0x00,0x00,0x00,0x00}; //nav-svinfo-30
u8 cfgrate[] ={0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00}; //RATE 200ms 5Hz
u8 cfgNAV5[] ={0x06,0x24,0x24,0x00,0xFF,0xFF,0x06,0x03,0x00,0x00,0x00,0x00,0x10,0x27,0x00,0x00,0x05,0x00,0xFA,0x00,0xFA,0x00,0x64,0x00,0x2C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // NAV5 Air Vehicle
if (UART0_UBXSendCFGMsg(cfgnavposllh, sizeof(cfgnavposllh))>0) UART1_PutString("\r\nGPS configure cfgnavposllh");
if (UART0_UBXSendCFGMsg(cfgnavsol, sizeof(cfgnavsol))>0) UART1_PutString("\r\nGPS configure cfgnavsol");
if (UART0_UBXSendCFGMsg(cfgnavvelned, sizeof(cfgnavvelned))>0) UART1_PutString("\r\nGPS configure cfgnavvelned");
if (UART0_UBXSendCFGMsg(cfgnavsvinfo, sizeof(cfgnavsvinfo))>0) UART1_PutString("\r\nGPS configure cfgnavsvinfo");
if (UART0_UBXSendCFGMsg(cfgrate, sizeof(cfgrate))>0) UART1_PutString("\r\nGPS update rate set to 5Hz");
if (UART0_UBXSendCFGMsg(cfgNAV5, sizeof(cfgNAV5))>0) UART1_PutString("\r\nGPS configure cfgNAV5");

}

UBX_Init();



now.. it sometimes work like a charm, some times do not... trying to figureout why.. I think I am missing something...
using this code now I am able to use my LEA-6H... The LEA-4H died in last crash...

Today I did a 1.1 kilometers waypoint flight using my new GPS functions...
Mitglied
Registriert seit: Dec 2010
Beiträge: 180
Also, I remember reading some where in the forum that the configuration file intentionally limits the number of satellites. After a certain number of satellites received, the LEA can't keep the 5 Hz update rate because it is too busy running too many corolators. I also remember reading some where from U-Blox that the S runs faster than the H because the microprocessor can read rom faster than flash. I also remember reading in the forum that when people tried the 5H, it couldn't keep the 5 Hz update rate as the 4H so I assume Holger went to the 6S instead of the 6H to keep the update rate. I hope this helps.

Hardware_man

Hardware_man
Mitglied
Registriert seit: Feb 2011
Beiträge: 163
Thank you too much Hardware_man... I do remember something about that refreshrate as well... I am testing the parameters using the u-blox center software.. when I enable too much debus/message , or ports it cannot put 5Hz output as you mentioned..

Now I think I am in a stable position and I have at least a acceptable GPS update... My MK is not staying as steady as the original, I think I have to work on a Kalman on the output of GPS data and may be work on the kalman parameters passed between FC and NC to have a more steady flight...

When I prepare a more clean code for GPS initialization I will try to share it with you.. This is what I will use for the next one or two weeks :0

Metalman
Mitglied
Registriert seit: Dec 2010
Beiträge: 180
Also, I think that I read Holger say his new configuration file will hold the UAV to a tighter tolerance in PH than his old configuration file. I am mostly interested in aerial video so the closer the UAV is to a "sky hook" in PH, the better. So I would think that update rate is the most important parameter. The sooner that the UAV “knows” it has drifted from the target position, the faster the PH loop can correct it without over shooting.

Some of the G-Top GPS receivers claim to have a 10 Hz update rate. I haven’t read the “fine print” so I don’t know how practical it is to really get a 10 Hz update rate in real world conditions. But if these receivers really can give a 10 Hz update rate with a reasonable number of satellites, I think that would be a very good thing for PH. The PH loop could work twice as fast to put the UAV back to the target position when the wind has moved it.

Now, we are “married” to the UBLOX receivers because the MK requires UBX data format. Have you considered writing a NEMA to UBX converter that could run on a small microprocessor with two UARTS? Then the GPS receiver that can provide the fastest update rate could be used and it doesn’t have to be a UBLOX receiver.

Hardware_man
Mitglied
Registriert seit: Nov 2011
Beiträge: 5
I think some of the information here explains the problem I'm having. I'm trying to get the NMEA output from the MKGPS so I can feed it to my camera for gps tagging. I've disabled GPSAUTOCONFIG and changed the UART1 to ouput UBX+NMEA. When I power cycle it reverts to just UBX output. I can make other changes to the GPS configuration and they stick, but not the port settings. What I think is happening is that the NaviCtrl is reconfiguring the port regardless of the GPSAUTOCONFIG setting.

Can anyone here confirm this?

I have two possible work-arounds in mind. I could add an arduino to reconfigure the port to add back NMEA after the NaviCtrl changes it. If that causes problems for the NaviCtrl, I could have the arduino decode the UBX into NMEA for the camera.

Any help on this issue would be greatly appreciated.

Thanks,
-jed
Mitglied
Registriert seit: Jun 2008
Beiträge: 522
Ort: Offenbach am Main
@metalmanbaris
tried to contact you several times via pn - no reply.
Just stucked to compile NaviCtrl Sources.
Keil uVision4 is already installed.
Also Cygnus arm-uclibc-gcc.exe installed
Can you send me a pn please.

Seite: 1

MikroKopter - Forum » MikroKopter - general » GPS Initialisation and configuration code is not in SVN