New RCtimer GPS Ublox Neo 6M fails to perform on Mega boards

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

Both rx and tx line of gps have to be wired to serial port 2.

User avatar
Jonit
Posts: 37
Joined: Sat May 12, 2012 10:12 pm
Location: Slovakia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by Jonit »

dramida wrote:Both rx and tx line of gps have to be wired to serial port 2.

I have all 4 wires (VCC, GND, TX, RX) connected. But I am using serial port 0 because i have Crius SE not Crius AIO.

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by EOSBandi »

Jonit wrote:
dramida wrote:Both rx and tx line of gps have to be wired to serial port 2.

I have all 4 wires (VCC, GND, TX, RX) connected. But I am using serial port 0 because i have Crius SE not Crius AIO.


Forget it, it is very likely that you ran out of sram memory..the code is for Mega boards... with Crius SE (and other Atmega328 based boards) it is NOT recommended to use a serial GPS. Get a I2CGPS board, you will not regret it.....

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by EOSBandi »

Alexinparis wrote:Hi,

I've also committed something in _shared branch based on my yesterday work, which is based on I2C code.
EOS, feel free to mod it as yours goes a little bit more further.

This is how I see the use of UBLOX devices:
1) to avoid messing with the quality of attached batteries, or additional EEPROM, I find this mod very useful:
viewtopic.php?f=8&t=649&start=1230#p19682
in accordance to http://www.universalair.co.uk/sites/def ... asheet.pdf page 10. If we ground CFG_COM1 and CFG_COM0 (pins 14 and 15) we already get 57600 baud and UBLOX binary data at startup so we only need to change refresh rate to 5Hz (page 6 states that as maximum) (as in viewtopic.php?f=8&t=2124#p19570) and we don't need external EEPROM!?


This mod is very easy to do as the 3 PINs 13,14,15 are gathered on the same side.

2) now we have always a 57600 baud conf, with the binary protocol always enabled. 57600 is more than enough to support the messages we want.

3) configure multiwii to use 57600 baud on the serial port of your choice, and use UBLOX protocol
#define GPS_SERIAL 2
#define GPS_BAUD 57600
#define UBLOX

The needed init sequences to activate messages are coded in multiwii when the UBLOX protocol is chosen.

This way, you can use easily the cheap RCtimer GPS. No need to care about a GPS config loss.



using config pins have some gains, but not so much...
according to the datasheet, cfg1+cfg2 indeed enables ubx output at 57600bps, but some critical messages are missing... no POSLLH and no VELNED, but some unneccessary messages are enabled (SVINFO, CLOCK, INF, MON-EXPECT and AID-ALPSERV) so we have to send additional config commands to disable these and enable the needed ones. So I think it's better to start with an unknown state and set it accordingly. (The code I posted will probe from 9600 to 57600, set it to binary and disables all unneccessary messages...)
The other problem is that I can imagine that people start tampering with the gps module pins with their big 220Volt (110V) soldering irons... instant death to the module...

The only drawback that the current implementation definitely for Mega only, it uses too much flash and sram for an AtMega....

User avatar
Jonit
Posts: 37
Joined: Sat May 12, 2012 10:12 pm
Location: Slovakia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by Jonit »

EOSBandi wrote:
Forget it, it is very likely that you ran out of sram memory..the code is for Mega boards... with Crius SE (and other Atmega328 based boards) it is NOT recommended to use a serial GPS. Get a I2CGPS board, you will not regret it.....

OK, thanks for explanation. Time to buy some I2C module ;)

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by crashlander »

EOSBandi wrote:using config pins have some gains, but not so much...
(The code I posted will probe from 9600 to 57600, set it to binary and disables all unneccessary messages...)

Question: Will your code properly initialize also modules with pin 13,14,15 mod (57600, ubx)? Or do I have to undo that mod. to use your code?
I presume yes but just to be sure.

User avatar
brettwal
Posts: 93
Joined: Mon Jun 18, 2012 4:51 pm
Location: Louisiana

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by brettwal »

2 Questions:

1. Any update on how to enable WAAS?

In GPS.ino at the end, Do I change

// ask for the messages we parse to be sent on every navigation solution
UBLOX_configure_message_rate(CLASS_NAV, MSG_POSLLH, 1);
UBLOX_configure_message_rate(CLASS_NAV, MSG_STATUS, 1);
UBLOX_configure_message_rate(CLASS_NAV, MSG_SOL, 1);
UBLOX_configure_message_rate(CLASS_NAV, MSG_VELNED, 1);
UBLOX_configure_sbas(SBAS_EGNOS);

to this?

// ask for the messages we parse to be sent on every navigation solution
UBLOX_configure_message_rate(CLASS_NAV, MSG_POSLLH, 1);
UBLOX_configure_message_rate(CLASS_NAV, MSG_STATUS, 1);
UBLOX_configure_message_rate(CLASS_NAV, MSG_SOL, 1);
UBLOX_configure_message_rate(CLASS_NAV, MSG_VELNED, 1);
UBLOX_configure_sbas(SBAS_WAAS);





2. I have the CRIUS AIO Pro and the new EXTEND Board w/ LEA-6H. Without documentaion on the Extend board, I do not know what its default config is. I also have no way of connecting it to Ucenter. Anyone have any docs on the extend board?

I have GPS data in the MWC GUI but, the altitude is off from 2000' to 4000'! :shock:
LAT & LONG are correct.

I'm using EOS's GPS.INO and other code snipets from earlier in this thread.


UPDATE: Still have altitude errors. Tried POS HOLD on quad with Extend board and new GPS.ino. WAY worse than same quad with Ublox connected to i2c module.
Last edited by brettwal on Sat Aug 04, 2012 3:49 am, edited 1 time in total.

User avatar
TermicOne
Posts: 15
Joined: Wed Jul 04, 2012 9:13 pm
Location: Italy - Milan

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by TermicOne »

EOSBandi wrote:
Jonit wrote:Thank you EOSBandi !
now we need to figure out how on each startup configure Ublox module so it can work in binary protocol and at 5 Hz. So we don't need to make hardware modification.

The code above does the configuration of UBLOX for 5Hz, Binary and EGNOS :D


great job EOSBandi! ...but I do not understand if your code need to have GPS already at 57600 or if it tries different speed in order to configure GPS to 57600 even if it is at 9600.
Today I tried your code but I was not able to have GPS working unless I configure it to 57600. If you are so kind to confirm that your code tries different speed I'll try again looking what's wrong in my config. Thanks again for your great and kind support!

Luciano

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dr.tom »

it sure tries different speeds because my AIO+gps (rctimer) works with Bandi's code even withouth GPS battery!
(removed it to test the eeprom mod, but it didn't remember settings with it, so I just desoldered eeprom and then Bandi's code came right in time to test it)

User avatar
TermicOne
Posts: 15
Joined: Wed Jul 04, 2012 9:13 pm
Location: Italy - Milan

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by TermicOne »

dr.tom wrote:it sure tries different speeds because my AIO+gps (rctimer) works with Bandi's code even withouth GPS battery!
(removed it to test the eeprom mod, but it didn't remember settings with it, so I just desoldered eeprom and then Bandi's code came right in time to test it)


Thank you Tom...tried again this evening and, at list with GUI, EOS code seems working well! Atfer configuration with EOS code GPS works fine with MultiWii but u-center is not working anymore...you can see the frames but u-center is not showing sats and other info that was showing before...no problem as it seems to work with multiwii!! Tomorrow I will test it in flight!

Thanks again EOSBandi for your code!

Luciano

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by crashlander »

TermicOne wrote: but u-center is not working anymore...you can see the frames but u-center is not showing sats and other info that was showing before...no problem as it seems to work with multi...
Luciano


Yep U-Center seems to fully understand only NMEA and since default is UBX+NMEA+somethingeles U-Center shows satelites + additional info and when you disable NMEA U-Center shows only position but no satellites.

Andrej

User avatar
TermicOne
Posts: 15
Joined: Wed Jul 04, 2012 9:13 pm
Location: Italy - Milan

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by TermicOne »

crashlander wrote:Yep U-Center seems to fully understand only NMEA and since default is UBX+NMEA+somethingeles U-Center shows satelites + additional info and when you disable NMEA U-Center shows only position but no satellites.

Andrej


Thank you Andrej!

This morning I tested GPS with u-center and I verified that in the night it has lost the configuration and was reset to NMEA, 1Hz, 9600bps.

Powered MultiWii (2 times as always for activating GPS) and GPS has been reconfigured to UBLX binary, 5Hz and 57600bps!

Tested quad outdoor. GPS fix in few seconds. Tested GPS HOLD and GPS RTH and they work great!!! I'm still impressed looking at my quad flying itself!!

I'd like to thank again Alexinparis, EOSBAndi and all the developers of this great sw.....NAZA is going to wait some more time!!! :D

Luciano

User avatar
brettwal
Posts: 93
Joined: Mon Jun 18, 2012 4:51 pm
Location: Louisiana

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by brettwal »

Anyone test the new GPS.ino with a SERIAL connected UBLOX? Looks like an error in ALTITUDE calculations. i2C Ublox works fine.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

I soldered the 13, 14 and 15 terminals together and i applied EosBandi's GPS initialisation code with Ublox binary viewtopic.php?f=8&t=2166#p20097
The good news is that the software works and gps is configured at startup
Two issues:
1-Also i had 8 sats in GUI, there were no visual sign of 3D fix on controller, no led were flashing or whatsoever
2- On GUI GPS altitude is way out of scale, it shows 11000m or so...

Now i am going outside to test it on flight.

And one more thing, if NMEA is selected, no setup procedure is initiated...

Last Edit: The led's are not flashing every time. I was seeing 8 satelites on GUI but the leds were not flashing. After reboot the leds start flashing regulary.

After all trouble i had (#endif missing at the end of bandi's code), i am starting to understand the meaning and causality of arduino stataments :idea:

User avatar
brettwal
Posts: 93
Joined: Mon Jun 18, 2012 4:51 pm
Location: Louisiana

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by brettwal »

dramida wrote:I soldered the 13, 14 and 15 terminals together and i applied EosBandi's GPS initialisation code with Ublox binary viewtopic.php?f=8&t=2166#p20097
The good news is that the software works and gps is configured at startup
Two issues:
1-Also i had 8 sats in GUI, there were no visual sign of 3D fix on controller, no led were flashing or whatsoever
2- On GUI GPS altitude is way out of scale, it shows 11000m or so...

Now i am going outside to test it on flight.

And one more thing, if NMEA is selected, no setup procedure is initiated...

Last Edit: The led's are not flashing every time. I was seeing 8 satelites on GUI but the leds were not flashing. After reboot the leds start flashing regulary.



The code will initialize the module properly w/o soldering the pins together.

There is no code in this one to run the Ublox in NMEA mode, only MTK modules.

Altitude is WAY off. I cannot find the calculation error in the code.

I too, have the LED issues.


What result did the missing #endif have?

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

After a few night flights in parking lot with SERIAL RCtimer Ublox 6m GPS and Crius AIO Mega Board, i observed an improvement in gps pos hold. Also gps acuracy wonders around 2-4 meters or so around the start point, the movement is smooth, less chaotic and more and more periods of time the copter is staying in the same spot.
My next experiment will be to modify the GPS antenna with an 2.5 cm patch antenna and then to home build an standard half wave patch antenna on 1575Mhz and mount it above the copter.
Any links for a DIY? I found only one http://www.express-builder.com/docs/gpsant/
Other ideeas are wellcome.

@brettwal: Every "if" statament must be closed with an "Endif" placed after all the code executed in case of a true statament or else you got the error "if statament not closed"
Last edited by dramida on Sun Aug 05, 2012 1:28 am, edited 2 times in total.

User avatar
brettwal
Posts: 93
Joined: Mon Jun 18, 2012 4:51 pm
Location: Louisiana

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by brettwal »

@ dramida Ahh, I thought you saw something besides a compile error. My code compiled fine. You have serial attached GPS or i2c attached?

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by EOSBandi »

Altitude error is know, it is in cm instead of meters. I'll needed it for checking alt precision.... I'll change it back to meters when I push the code to shared.... but if it bothers you then just change this :

In line 1449 :

Code: Select all

GPS_altitude     = _buffer.posllh.altitude_msl / 10;      //alt in cm 

replace it with

Code: Select all

GPS_altitude     = _buffer.posllh.altitude_msl / 1000;      //alt in meters

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by EOSBandi »

dramida wrote:After a few night flights in parking lot with SERIAL RCtimer Ublox 6m GPS and Crius AIO Mega Board, i observed an improvement in gps pos hold. Also gps acuracy wonders around 2-4 meters or so around the start point, the movement is smooth, less chaotic and more and more periods of time the copter is staying in the same spot.
My next experiment will be to modify the GPS antenna with an 2.5 cm patch antenna and then to home build an standard half wave patch antenna on 1575Mhz and mount it above the copter.
Any links for a DIY? I found only one http://www.express-builder.com/docs/gpsant/
Other ideeas are wellcome.

You will need active antenna for the module. The antenna you linked is a passive one.... so you will have to add an LNA to this to make it work... also active antenna designs also contains a bandpass filter to cancel out out-of-the-band noise, and all parts have to be properly impedance matched... So unless you are experienced with over Ghz radio comms and has a proper equipment (spectrum analyser, SWR meter for Ghz band, etc...) it is just shooting in the dark....

carlonb
Posts: 210
Joined: Sun Apr 03, 2011 6:29 pm

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by carlonb »

Hi EOSBandi,
I'm so confused, I have this serial GPS http://www.flytron.com/osd-headtrackers/15-simpleosd-gps-module.html and I tried your gps.ino module (adding also the few line in setup loop) on MWii 2.1 sketch.
Setted it to MTK, added TX serial line (I'm using RX1,TX1 pins of Mega board) but no GPS data on GUI.
My question: Is this GPS usable with your sketch mods?
I already test this with official MWii 2.1 release with NMEA and set comm to 9600 baud, but still no gps data.

What I'm missing ? Note : This GPS unit works OK with my DIY OSD with default 9600baud.
Thanks, Carlo

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by EOSBandi »

carlonb wrote:Hi EOSBandi,
I'm so confused, I have this serial GPS http://www.flytron.com/osd-headtrackers/15-simpleosd-gps-module.html and I tried your gps.ino module (adding also the few line in setup loop) on MWii 2.1 sketch.
Setted it to MTK, added TX serial line (I'm using RX1,TX1 pins of Mega board) but no GPS data on GUI.
My question: Is this GPS usable with your sketch mods?
I already test this with official MWii 2.1 release with NMEA and set comm to 9600 baud, but still no gps data.

What I'm missing ? Note : This GPS unit works OK with my DIY OSD with default 9600baud.
Thanks, Carlo


MTK binary protocol requires a special firmware on the GPS module...
either AXN 1.30 or AXN 1.51

Are you crossed the serial data lines ? (tx-rx rx-tx ?)

carlonb
Posts: 210
Joined: Sun Apr 03, 2011 6:29 pm

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by carlonb »

EOSBandi wrote:
carlonb wrote:Hi EOSBandi,
I'm so confused, I have this serial GPS http://www.flytron.com/osd-headtrackers/15-simpleosd-gps-module.html and I tried your gps.ino module (adding also the few line in setup loop) on MWii 2.1 sketch.
Setted it to MTK, added TX serial line (I'm using RX1,TX1 pins of Mega board) but no GPS data on GUI.
My question: Is this GPS usable with your sketch mods?
I already test this with official MWii 2.1 release with NMEA and set comm to 9600 baud, but still no gps data.

What I'm missing ? Note : This GPS unit works OK with my DIY OSD with default 9600baud.
Thanks, Carlo


MTK binary protocol requires a special firmware on the GPS module...
either AXN 1.30 or AXN 1.51

Are you crossed the serial data lines ? (tx-rx rx-tx ?)


Hi EOS, yes of course I did tx-rx crossing.
I tested my gps unit with arduino USB-serial at 9600 baud with Window Hyperterminal and it run good.
Now I have a tool from "Global Top Tecnology" you suggested and relate F/W AXN 1.51xxxxxx.
If I update with this F/W, what about the new default as comm speed, refresh rate and std NMEA strings? I need to know as I use it also with my OSD.

Thank very much, Carlo

Edit : I verifyed the GPS F/W with Minigps and show AXN 1.30....? is it strange ?
Bye

User avatar
brettwal
Posts: 93
Joined: Mon Jun 18, 2012 4:51 pm
Location: Louisiana

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by brettwal »

EOSBandi wrote:Altitude error is know, it is in cm instead of meters. I'll needed it for checking alt precision.... I'll change it back to meters when I push the code to shared.... but if it bothers you then just change this :

In line 1449 :

Code: Select all

GPS_altitude     = _buffer.posllh.altitude_msl / 10;      //alt in cm 

replace it with

Code: Select all

GPS_altitude     = _buffer.posllh.altitude_msl / 1000;      //alt in meters



I had actually found this and changed it but, the Altitude error is still much more than my i2c UBlox setup.

i2c is UBlox NEO-6 with 25x25 antenna
Serial is UBlox LEA-6 with 25x25 antenna

both tested in same location


Alos, would it break any other calculations if I converted to U.S. Feet instead of meters?

Thanks!

jy0933
Posts: 180
Joined: Wed Jun 27, 2012 4:24 pm

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by jy0933 »

altho i have read thru the entire thread for several times.. i'm still confused

is there a code to insert into mwc to config gps chip to nmea, 5hz, 57600baud when power is plugged in?
the gps i have is serial ublox-neo-6m, at default 1hz, 9600..... fc is mega2560....
fc is working with the gps already. but i feel like to make it better to 5hz and 57600baud
( i heard this gps can be set up to 10hz... is that possible?)


thanks

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by IceWind »

Does the soldering of the pins 13/14/... is needed to get the GPS to boot at first try?

So far the main issue for me hasn't been the fact of loosing the settings but rather the fact that it doesn't start/work at first try.
Sometimes I need to power it off a few times until I get it to work. When it works it get's the 3D fix right away.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

EOSBandi wrote:
dramida wrote:After a few night flights in parking lot with SERIAL RCtimer Ublox 6m GPS and Crius AIO Mega Board, i observed an improvement in gps pos hold. Also gps acuracy wonders around 2-4 meters or so around the start point, the movement is smooth, less chaotic and more and more periods of time the copter is staying in the same spot.
My next experiment will be to modify the GPS antenna with an 2.5 cm patch antenna and then to home build an standard half wave patch antenna on 1575Mhz and mount it above the copter.
Any links for a DIY? I found only one http://www.express-builder.com/docs/gpsant/
Other ideeas are wellcome.

You will need active antenna for the module. The antenna you linked is a passive one.... so you will have to add an LNA to this to make it work... also active antenna designs also contains a bandpass filter to cancel out out-of-the-band noise, and all parts have to be properly impedance matched... So unless you are experienced with over Ghz radio comms and has a proper equipment (spectrum analyser, SWR meter for Ghz band, etc...) it is just shooting in the dark....



The LNA and band pass filter is built in gps receiver chipset. Can you see any power line output twoards gps patch antenna to power LNA? ANd impedance match is meet as this desigh has 50 ohm impedance.
Anyway, your latest gps.ino works like a charm. With standard RCTimer ublox 6M GPS receiver, it holds position within 2 m radius, and even if it drifts, it wonders very smooth. See sample video below http://www.youtube.com/watch?v=ORQ30NBwB-M
One issue, i observed that not all the time the GPS led is flashing on controller, sometimes it needs a reboot. Also i wold like to have a setup procedure for NMEA standard. I'll keep you informed about results with full size gps patch.
/Mihai

Woppit
Posts: 22
Joined: Tue Jul 17, 2012 11:47 pm

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by Woppit »

Hi All,I have a strange problem, been running multiwii v2.1 with the Neo 6 at 115K with no problems (apart from the power cycling and the odd config refresh)
So I thought I would give the following a go(bottom of page). I loaded all the bits in with the new gps.ino, compiled and had the missing endif pop up. I added an endif after this bit of code.

SerialOpen(GPS_SERIAL,GPS_BAUD);

not sure if it's the right place but it seemed to do the trick! recompiled and loaded the code and it all fired up fine, tested it through the config and had good gps
and all looked ok. But when I powered the craft from the flight pack the ESC'S don't finish initialization so when I arm the board the motors wont start. I have tried
loading the code several times and the same result? all works but ESC's don't finish there initialization tones?
Any ideas?

Thanks
Woppit

EOSBandi wrote:OK, here is a first version : I dont commit it into shared yet, since it is based on a 2.1 Gps.ino and still uses classes.
Just replace the Gps.ino and add the follwing lines to config.h gps part

Code: Select all

    //#define NMEA
    #define UBLOX
   // #define MTK

   #define GPS_LEAD_FILTER

//#define GPS_FILTERING
//#define NAV_SLEW_RATE              30

Plus add the initialisation to the multiwii.ino setup()

Code: Select all

  
#if defined(GPS_SERIAL)
 
  #if defined(UBLOX)
   UBLOX_init();
   delay(200);
  #endif

 #if defined(MTK)
   MTK_init();
   delay(200);
 #endif

    SerialOpen(GPS_SERIAL,GPS_BAUD); 

For UBLOX and MTK the GPS_BAUD must be 57600

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

You have to wait a few more seconds befor trying to arm the copter because initialisation routine of GPS takes a few seconds. Anyway the code works sporadicaly, some times the gps stautus leds don't flash even we have a 3d fix and pos hold dosen't work either in this situation.(binary RCtimer ublox neo 6M GPS on serial 2)

Woppit
Posts: 22
Joined: Tue Jul 17, 2012 11:47 pm

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by Woppit »

Don't think it's that because I had it on the bench GPS running for ten mins and an 8 sat lock, plugged in the flight pack with it still on the pc the ESC's start to beep but don't finish? the board arms and disarms and the GPS LED's are flashing but the ESC's just don't give the final init tone? tried it in the garden to and same thing it's very odd, if I comment out the GPS in config.h it all works again, uncomment GPS and the ESC's don't fully arm? it must be something I have done as it works for others! unless the endif I had to put in is in the wrong place? I'll go have another play!
Thanks
Woppit

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

MW 2.1 + FC CRIUS AIOP + CRIUS GPS neo 6m

Post by quadwalker »

Hello

I have Crius GPS and FC AIOP and I've made the nice modification by soldering on the GPS the pins 13&14 together

This is working like a charm. Starting from default 38400baud and setting 115400baud/10hz from the MW 2.1 software modified. So no more problem due to the lack of power for the battery not working so well

Here the piece of code to modifiy in Multiwii_2_1.ino. This is a little "harded" coded by using Serial2 from "HardwareSerial" component since I've connected my GPS on the serial #2 port. The code here after is the full section to init the GPS_SERIAL

In order to have your sktech compiling with Arduino 1.0.1, you will need to comment some part of code in HardwareSerial.cpp. I think it is necessary since those macro are probably alredy defined somewhere in the mwc sketech
hardwareSerial.cpp is located in "arduino-1.0.1\hardware\arduino\cores\arduino"

Then you can flash this version on your CRIUS AIOP FC and your CRIUS GPS should be fine now

hope that will help folk!


-------------------------------------------- modifcations in multiwii_2_1 -----------------------------------------------

Code: Select all

#if defined(GPS_SERIAL)

[COLOR="Red"]    /*****
    //debut suppression BR
    SerialOpen(GPS_SERIAL,GPS_BAUD); 
    delay(400);
    //fin suppression BR
    ******/[/COLOR]
     
[COLOR="DarkGreen"]    //debut ajout BR
    //ouverture de la connexion en 38400 baud
    //programmation par trames UBX du GPS en 115200 baud et 10hz
    //puis reouverture de la connexion en 115200
    delay(1000);
   
    Serial2.begin(38400);
    delay(500);
   
    byte gps10hz[] = {0xB5,0x62,0x06,0x08,0x06,0x00,0x64,0x00,0x01,0x00,0x01,0x00,0x7A,0x12};
    Serial2.write(gps10hz,sizeof(gps10hz));
 
    /****
    byte gps5hz[] = {0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A};   
    Serial2.write(gps5hz,sizeof(gps5hz));
    *****/
   
    byte baudrate115200[] = {0xB5,0x62,0x06,0x00,0x14,0x00,0x01,0x00,0x00,0x00,0xD0,0x08,0x00,0x00,0x00,0xC2,0x01,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0xC4,0x96};
    Serial2.write(baudrate115200,sizeof(baudrate115200));
    delay(500); //give the GPS receiver time to process
    Serial2.end();
   
    Serial2.begin(115200);
    delay(1000);
    //fin ajout BR [/COLOR]

    for(uint8_t i=0;i<=5;i++){
      GPS_NewData();
      LEDPIN_ON
      delay(20);
      LEDPIN_OFF
      delay(80);
    }
    if(!GPS_Present){
      SerialEnd(GPS_SERIAL);
      SerialOpen(0,SERIAL_COM_SPEED);
    }     
    #if !defined(GPS_PROMINI)
      GPS_Present = 1;
    #endif
    GPS_Enable = GPS_Present;   
  #endif


-------------------------------------------------- modifications in HardwareSerial.cpp

comment from line 88 to 160
and comment from line 178 to 218

Code: Select all

[COLOR="Red"]/**** start section commented
#if !defined(USART0_RX_vect) && defined(USART1_RX_vect)
// do nothing - on the 32u4 the first USART is USART1
#else
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
    !defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
   !defined(SIG_UART_RECV)
  #error "Don't know what the Data Received vector is called for the first UART"
#else
  void serialEvent() __attribute__((weak));
  void serialEvent() {}
  #define serialEvent_implemented
#if defined(USART_RX_vect)
  SIGNAL(USART_RX_vect)
#elif defined(SIG_USART0_RECV)
  SIGNAL(SIG_USART0_RECV)
#elif defined(SIG_UART0_RECV)
  SIGNAL(SIG_UART0_RECV)
#elif defined(USART0_RX_vect)
  SIGNAL(USART0_RX_vect)
#elif defined(SIG_UART_RECV)
  SIGNAL(SIG_UART_RECV)
#endif
  {
  #if defined(UDR0)
    unsigned char c  =  UDR0;
  #elif defined(UDR)
    unsigned char c  =  UDR;
  #else
    #error UDR not defined
  #endif
    store_char(c, &rx_buffer);
  }
#endif
#endif

#if defined(USART1_RX_vect)
  void serialEvent1() __attribute__((weak));
  void serialEvent1() {}
  #define serialEvent1_implemented
  SIGNAL(USART1_RX_vect)
  {
    unsigned char c = UDR1;
    store_char(c, &rx_buffer1);
  }
#elif defined(SIG_USART1_RECV)
  #error SIG_USART1_RECV
#endif

#if defined(USART2_RX_vect) && defined(UDR2)
  void serialEvent2() __attribute__((weak));
  void serialEvent2() {}
  #define serialEvent2_implemented
  SIGNAL(USART2_RX_vect)
  {
    unsigned char c = UDR2;
    store_char(c, &rx_buffer2);
  }
#elif defined(SIG_USART2_RECV)
  #error SIG_USART2_RECV
#endif

#if defined(USART3_RX_vect) && defined(UDR3)
  void serialEvent3() __attribute__((weak));
  void serialEvent3() {}
  #define serialEvent3_implemented
  SIGNAL(USART3_RX_vect)
  {
    unsigned char c = UDR3;
    store_char(c, &rx_buffer3);
  }
#elif defined(SIG_USART3_RECV)
  #error SIG_USART3_RECV
#endif
end section commented ********/[/COLOR]
void serialEventRun(void)
{
#ifdef serialEvent_implemented
  if (Serial.available()) serialEvent();
#endif
#ifdef serialEvent1_implemented
  if (Serial1.available()) serialEvent1();
#endif
#ifdef serialEvent2_implemented
  if (Serial2.available()) serialEvent2();
#endif
#ifdef serialEvent3_implemented
  if (Serial3.available()) serialEvent3();
#endif
}

[COLOR="red"]/******** start section commented
#if !defined(USART0_UDRE_vect) && defined(USART1_UDRE_vect)
// do nothing - on the 32u4 the first USART is USART1
#else
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
  #error "Don't know what the Data Register Empty vector is called for the first UART"
#else
#if defined(UART0_UDRE_vect)
ISR(UART0_UDRE_vect)
#elif defined(UART_UDRE_vect)
ISR(UART_UDRE_vect)
#elif defined(USART0_UDRE_vect)
ISR(USART0_UDRE_vect)
#elif defined(USART_UDRE_vect)
ISR(USART_UDRE_vect)
#endif
{
  if (tx_buffer.head == tx_buffer.tail) {
   // Buffer empty, so disable interrupts
#if defined(UCSR0B)
    cbi(UCSR0B, UDRIE0);
#else
    cbi(UCSRB, UDRIE);
#endif
  }
  else {
    // There is more data in the output buffer. Send the next byte
    unsigned char c = tx_buffer.buffer[tx_buffer.tail];
    tx_buffer.tail = (tx_buffer.tail + 1) % SERIAL_BUFFER_SIZE;
   
  #if defined(UDR0)
    UDR0 = c;
  #elif defined(UDR)
    UDR = c;
  #else
    #error UDR not defined
  #endif
  }
}
#endif
#endif
end section commented *****/[/COLOR]

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

@quadwalker:
Hi, i had the same problem as you and i found that EosBandi already coded an init function for Crius GPS on Mega Boards. Here it is : viewtopic.php?f=8&t=2166#p20097

First of all i don't think Neo6M gps can work at 10 Hz refresh.
Secondly, i prefer to work on Bandi's code because is straight forward. But since you have to restart the board and wait a lot to have GPS signal OK shown by flashing leds (red and green simultaneously) i think that the GPS init code has some bugs in it.

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

HI Dramida

THanks. I didn't figure out that an attachment was available in the EosBandi post. His code is pretty nice
From my side, using 115200b and 10hz seems to be working. I can see working well in u-center but also when inside the FC my red and green led are flashing pretty well and in the MWGui I can see my position on the map
If ever, I will switch to 5hz

At the momnt I don't really flew so much with that new FC just received recently

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

I am not a programmer and i like neat and easy to understand code. Your GPS is working at first boot? I have to unplug the battery after a few minutes and replug it to work.
If you could improve Bandi's code, would have more sense for me. Thank you.

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

I think that it can work at the fisrt boot. I need more time to test since my code was working until tonight :-) From what I read, working at first boot is due to joining together pins 13 & 14
I will keep you informed but normally nothing very fundametaly different from Bani's code except he ensured to filter only the necesssary messages. His init code is nice as well to be able to work whatever the default speed your GSP is configured

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by crashlander »

UBLOX NEO 6 configuration with soldering pins 13,14 and 15 (together) + code that was submitted to _shared by Alexinparis works from r1014 up without problems (from first boot):
viewtopic.php?f=8&t=2166&start=10#p20105

Regards
Andrej

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

Hi Dramida

I made a test this morning to see the result on the fisrt plug. After 2/3min I got my GPS active. Red and green leds were "dancing" pretty well :-)
FYI I have soldered only pins 13&14 together

I need to learn now how to use the POSHOLD. When flying and switch on the POSHOLD, is the quadcopter supposed to maintain itself its position?
In my case if it was having an ascending or descending behavior, it is continuing to go up or down even after switching the POSHOLD!!! I probably misunderstood something :-(

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

Hi Andrej

Yes I saw that thanks to dramida. I was missing the GPS.zip attchment. Anyway, it was funny to test by myself and learned how all that stuff is working. GPS is a real magic box :-)
cheers

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by crashlander »

quadwalker wrote:Hi Andrej

Yes I saw that thanks to dramida. I was missing the GPS.zip attchment. Anyway, it was funny to test by myself and learned how all that stuff is working. GPS is a real magic box :-)
cheers

GPS.zip is EOSBandi's approach to NEO6 and it works with original 2.1 (not dev. _shared) and without any soldering to GPS. But I have not tested it myself.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by crashlander »

quadwalker wrote:Hi Dramida
....
In my case if it was having an ascending or descending behavior, it is continuing to go up or down even after switching the POSHOLD!!! I probably misunderstood something :-(


POS. HOLD. will hold geographical position of your multi and not altitude. For that you need properly tuned ALT. HOLD that is independent from GPS functionality.

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

crashlander wrote:
quadwalker wrote:Hi Dramida
....
In my case if it was having an ascending or descending behavior, it is continuing to go up or down even after switching the POSHOLD!!! I probably misunderstood something :-(


POS. HOLD. will hold geographical position of your multi and not altitude. For that you need properly tuned ALT. HOLD that is independent from GPS functionality.


ah great. thank you for pointing out this detail. I am going to test this at the end of this day

pm1
Posts: 136
Joined: Sun Jan 22, 2012 7:26 pm

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by pm1 »

quadwalker wrote:HI Dramida
From my side, using 115200b and 10hz seems to be working.


I can confirm that. I have measured the time between consecutive reading and put that to a debug variable, it's about 100 ms...

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

For those who would like to test using UBLOX Neo 6m at 115200/10hz, here the GPS.ino attachment file modified
As my Neo 6m gps seems supporting this rate, let's have a try from you side if you wish

The GPS.ino was modified to scan 115200 as well during the the GPS init phase to setup the binary mode if ever your GPS should be in that default speed

I think it is also fixing a bug in the scan loop to setup the binay mode. The loop is looking one element behind the end of the baudrates array. Only 4 elements in the array and then 0 to 4 is too much.

Code: Select all

const unsigned long baudrates[5] = {9600U, 19200U, 38400U, 57600U};
...
for (uint8_t i=0; i<5; i++) {


If you prefer to keep using the actual GPS.ino, it will be better to replace 5 by 4 or again better by sizeof(baudrates)

Code: Select all

for (uint8_t i=0; i<sizeof(baudrates); i++) {


Using the new GPS.ino, you will have to add a new define statement GPS_RATE in config.h in the GPS section.

Code: Select all

#define GPS_BAUD   115200   //can be 57600 or 115200
#define GPS_RATE   100        //can be 100ms for 10Hz or 200ms for 5hz
 


Hope that wil help and will be working from your side
have fun
Attachments
GPS.zip
few modifications in the UBLOX_init function
(14.17 KiB) Downloaded 390 times

User avatar
brettwal
Posts: 93
Joined: Mon Jun 18, 2012 4:51 pm
Location: Louisiana

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by brettwal »

EDIT: Although the module will run at 115,200 5Hz or 10Hz, this code is NOT properly initializing the module. If I revert back to EOSBandi's GPS.ino it intializes fine.


Looks like it works for the Ublox LEA-6 module on the Crius Extend board as well.

Don't forget to change the SBAS setup in GPS.ino for you area of the world. Also remember, that altitude is set to centimeters, not meters in this version.
Last edited by brettwal on Mon Aug 13, 2012 2:41 am, edited 1 time in total.

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

brettwal wrote:Looks like it works for the Ublox LEA-6 module on the Crius Extend board as well.

Don't forget to change the SBAS setup in GPS.ino for you area of the world. Also remember, that altitude is set to centimeters, not meters in this version.


Great if it is becoming more and more "Generic"
Correct for the SBAS. I am going to have a look to setup for froggyland in my case :-)

Will have a look to the ALT unit as well. Perhaps also because I found that POSHOLD is not very very efficient on my first tests?????

Anyother issue. When althold is switched on, I can have my throttle too much sensitive. In other words moving the throttle stick just a litlle and my quad is going up or down too much. When althold is back to off, this become more smooth
Any suggestion to investigate on that issue?
Oops perhaps the ALT unit effect in fact???????

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by nhadrian »

Hi quadwalker,

EDIT.: I tested with my LEA-6H in my Crius ext. board, looks like it's not working... :( nothing serial from GPS. Changing back to 58600 it works.

For ALT hold sensitivity, change this value in config.h:
#define ALT_HOLD_THROTTLE_NEUTRAL_ZONE 20
I'm using my copter with 80 value instead of 20.....

But be careful, once you'll reach the neutral zone with the stick, it'll became as sensitive as now!!! It's because of the current ALT hold code behaviour. I posted a solution in another topic for compensating angle in LEVEL/ALT hold. For better alt hold behaviour you should try if you would like.

BR
Adrian

PS.: GPS altitude is not used for any purposes in the MWI.

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

nhadrian wrote:EDIT.: I tested with my LEA-6H in my Crius ext. board, looks like it's not working... :( nothing serial from GPS. Changing back to 58600 it works.

For ALT hold sensitivity, change this value in config.h:
#define ALT_HOLD_THROTTLE_NEUTRAL_ZONE 20
I'm using my copter with 80 value instead of 20.....


HI nhadrian

Thanks for the information regarding ALT_HOLD_THROTTLE. I am going to test this
Sorry about LEA-6H not working at 115200bd. NEO-6M is able to do!!!
Perhaps it could be possible to setup autamticaly regarding the receiver version? We can get the hardware version using the MON-VER UBX message :geek:
Yes I got the information that GPS alt is not used. But for the position if unit is cm rather than meter than can have an impact to analyse. My quad is really moving in a large bow when POSHOLD is on!!!

cheers

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by nhadrian »

you mean it mooves up-down too much when poshold is active not only alt hold?

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by IceWind »

quadwalker wrote:For those who would like to test using UBLOX Neo 6m at 115200/10hz, here the GPS.ino attachment file modified
As my Neo 6m gps seems supporting this rate, let's have a try from you side if you wish

The GPS.ino was modified to scan 115200 as well during the the GPS init phase to setup the binary mode if ever your GPS should be in that default speed

I think it is also fixing a bug in the scan loop to setup the binay mode. The loop is looking one element behind the end of the baudrates array. Only 4 elements in the array and then 0 to 4 is too much.

Code: Select all

const unsigned long baudrates[5] = {9600U, 19200U, 38400U, 57600U};
...
for (uint8_t i=0; i<5; i++) {


If you prefer to keep using the actual GPS.ino, it will be better to replace 5 by 4 or again better by sizeof(baudrates)

Code: Select all

for (uint8_t i=0; i<sizeof(baudrates); i++) {


Using the new GPS.ino, you will have to add a new define statement GPS_RATE in config.h in the GPS section.

Code: Select all

#define GPS_BAUD   115200   //can be 57600 or 115200
#define GPS_RATE   100        //can be 100ms for 10Hz or 200ms for 5hz
 


Hope that wil help and will be working from your side
have fun


Are you using this and have the ublox with the pins 13,14 and 15 soldered?
I changed the I2C sketch to perform the same and so far the only remaining issue is the damm GPS not starting at first try.

User avatar
quadwalker
Posts: 18
Joined: Wed Aug 08, 2012 8:21 pm
Location: IdF

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by quadwalker »

nhadrian wrote:you mean it mooves up-down too much when poshold is active not only alt hold?


I mean even horizontaly. The quad is realy moving 5m in any direction from the position I'm switching on POSHOLD

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: New RCtimer GPS Ublox Neo 6M fails to perform on Mega bo

Post by dramida »

It seems that serial GPS is not so-well supported as I2C navi GPS.
Today i had hard times trying to make ublox gps neo 6m working. the leds were flashing but the GUI arrow did not flash.
I even tried MT3329 gps and this one worked sporadically as if it worked 1 second and then shutted off and after another 5 seconds worked again...and off again...
My last hope is to try I2C navi board, even it seems to be over my shoulder as i use a mega board with 3 spare serial ports.

Post Reply