Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to I²C)

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Actually, the procedure is more or less the same for ATMega and ATTiny controllers.

First, clone the git repository (or download an archive from the github site):

Code: Select all

git clone https://wertarbyte@github.com/wertarbyte/tiny-gps.git


Make sure you have "make" and an AVR compiler suite installed; install these programs using the package management of your operating system, e.g.

Code: Select all

apt-get install make gcc-avr

Now change into the directory with the source code, edit config.h according to your needs and compile the firmware:

Code: Select all

make

Voila! you should end up with tinygps.hex ready to be flashed onto your controller.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

dr.tom wrote:you say that clock needs to be set to 8MHz, there are 3 setting with 8MHz for that chip, +0ms, +4.1ms, and the +64ms (default), don't want to make it wrong...
believe just one line with defined fuses would help a lot: U lfuse:w:xx:x, U hfuse:w:xx:m, U efuse:w:xx:m

Like the one I already published a few postings ago?

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

I have also corrected my previous post, just follow the instructions.


For my "include" problem... I am investigating. Yes I am using a linux os and your #include "" looks right, it must be something with my setup, i think

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Federico wrote:For my "include" problem... I am investigating. Yes I am using a linux os and your #include "" looks right, it must be something with my setup, i think

Try using the Makefile from my "makefile" branch, with it, you can abandon the Arduino IDE. Works fine for me :-)

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

It's probably an IDE problem, as they say: http://electronics.stackexchange.com/qu ... e-not-work
In the meanwhile I did a little change to the code to get it to compile.
Now I discover that tiny-gps is not working :-) At least, the standard MultiWii Conf is not reporting any GPS.
But it's late and it's better if I re-check tomorrow :-)

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

If Multiwiiconf does not indicate GPS support (GPS not green), you probably did not enable it in the firmware. Make sure the correct firmware has been flashed, and also make sure that GPS support is actually included.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

thnx for extra help,
i managed to flash it now :)

but the problem is that is somehow interfers with MAG sensor, as I can see in gui graphs(even if I calibrate MAG)
I2C errors also build up... probably attiny ones, because gps works ok connected over same I2C wires

Image


board is CriusSE http://tinyurl.com/CriusSEMWC ,
I2C GPS is navigatron http://tinyurl.com/Navigatronboard ,
and sonar is HC-SR04 http://tinyurl.com/HCSR04sonar
connected via 2313 and your code

it seems to work because I can hear clicking sounds from it about every half a second when connected to MWC
And the setup is 100% operational and tested in air before connecting attiny part of the story, I flies great.

are there any incompatibilities in my setup or?

config files are here:
Image Image
(the // marked red are just coloured for this photo, not before flashing ofcourse)

thnx for your help

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

What is the value of your external pull up resistors?
Did you set the fuses on the ATTiny2313? I also encountered I²C errors when relying on internal pull ups or running the controller at a slower speed.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Just a quick note, I just updated my github branch to add the option GPS_TINY_GPS, otherwise Multiwii would try to pull GPS data from the ATTiny2313 (although you have no serial GPS and only sonar connected there).

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

thanks for quick reply :)

Ok, got the fuses, 8MHz, CLKDIV8 disabled, and brownout to 2,7V.
-U lfuse:w:0xe4:m -U hfuse:w:0xdb:m -U efuse:w:0xff:m

I didn't measure the pullups value, I use internal defined via code, and external on FC, will measure them now and edit this msg.
now i did some search and found this: viewtopic.php?f=15&t=1657#p13634, so, i shpuld disable internal pullups and check if external are ok by value and connected to 5V?

ok, will try to compile and upload new github code.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Fuses should be OK, if you have second Arduino lying around, you could also test whether the Tiny works by querying its I2C interface. It's also good practice to solder a 100nF capacitator at the chips power supply, without it, the controller might fail spontaniously.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

thnx, will try it on spare promini,

Image


about the cap, it's already there, circled yellow, you mentioned it @ first side of this thread,

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Here's a small Arduino test sketch to access the I²C data:

Code: Select all

#include <Wire.h>

void setup() {
   Wire.begin();
   Serial.begin(9600);
}

void loop() {
   Serial.print("Request: ");
   Wire.requestFrom(0x11, 30);    // request 30 bytes from slave device 0x11

   while(Wire.available()) {
      uint8_t b = Wire.read();
      Serial.print(b);
      Serial.print(' ');
   }
   Serial.print('\n');
   delay(100);
}

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

this is without internal pullups, and with proper fuses (last one was clock divided by 8, now i can hear sonar working much faster)

Image


my gps unit is working, no I2C errors because of attiny,

how to best test if sonar values are ok,
(if i look at values outputed to motors, and i come close to sonar, nothing changes, they don't speed up,
only baro is active now, to exlude mag and acc motor control)

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Sadly, the sonar data is not actually used for altitude corrections. This is still experimental and hasn't trickled down into the svn trunk.
Did I mention that having some kind of distributed version control system would make development so much easier? I think I did, but you cannot emphasize that enough.

You should update your Multiwiiconf GUI, your version seems buggy; otherwise, you should see your sonar altitude in the debug 3 field (see here viewtopic.php?f=8&t=1647)

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

Does anyone knows if multiwii is supposed to work also without an imu ? I have an test environment with just the attiny, the serial gps and an atmega with multiwii firmware. On the guy (the dev one) I get never ending i2c errors

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Federico wrote:Does anyone knows if multiwii is supposed to work also without an imu ? I have an test environment with just the attiny, the serial gps and an atmega with multiwii firmware. On the guy (the dev one) I get never ending i2c errors

Did you disable any other I²C sensors in the config? Otherwise, MW will try to retrieve data from Motion+ etc. and generate I²C errors.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

ups, so sonar is still not implemented :(

which version is newer than 0504?

Image

and newer, 'wingui' @ 2.0 setting cant even connect to this firmware in MWC(because gui is older than fw)

Image
Last edited by dr.tom on Sat May 12, 2012 7:01 pm, edited 1 time in total.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

dr.tom wrote:which version is newer than 0504?

Read the thread, there is a bug in the GUI which affects the debug fields.

Grab my fixed version from SVN and compile your own version using processing:
https://code.google.com/p/multiwii/sour ... iiConf.pde

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

Is there somewhere already a compiled fixed version? :)

I get error creating .exe, must be doing something wrong..
(copied P5 library to sketchbook, not sketch folder, that fixed first error message about libraries, but stuck on this error)

Image


Thank you for your help :)

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

I need help to debug this :-/
My setup is tiny2312 with just gps activated, gps connected
Arduino 2009 with multiwii-tiny
A developer version of the GUI.

The attiny2313 is seen at the right address from the i2c scanner sketch from todbot.

The MultiWIi gui is showing green on gps, but only errors on the i2c bus (i do have the pullup resistors) and the "magnetometer" section is "blinking" (the indicator NSOW) ...

I am testing right now the code to test the i2c, it says something like

Code: Select all

equest: 6 12 5 12 19 8 15 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255 
Request: 6 12 5 12 0 0 0 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 0 0 0 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 0 0 0 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 0 0 0 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 0 0 0 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 0 0 0 45 26 86 153 9 10 135 98 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 19 8 16 45 26 86 52 9 10 135 1 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 19 8 16 45 26 86 52 9 10 135 1 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255
Request: 6 12 5 12 19 8 16 45 26 86 52 9 10 135 1 124 0 3 0 3 0 0 0 0 255 255 255 255 255 255


Code: Select all

@altair:~/tiny-gps $ avrdude -c avrisp -p t2313 -P /dev/ttyUSB0 -b 19200 -U flash:w:tiny-gps.hex -U lfuse:w:0xe4:m -U hfuse:w:0xdb:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.12s

avrdude: Device signature = 0x1e910a
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "tiny-gps.hex"
avrdude: input file tiny-gps.hex auto detected as Intel Hex
avrdude: writing flash (1826 bytes):

Writing | ################################################## | 100% 5.17s

avrdude: 1826 bytes of flash written
avrdude: verifying flash memory against tiny-gps.hex:
avrdude: load data flash data from input file tiny-gps.hex:
avrdude: input file tiny-gps.hex auto detected as Intel Hex
avrdude: input file tiny-gps.hex contains 1826 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 5.18s

avrdude: verifying ...
avrdude: 1826 bytes of flash verified
avrdude: reading input file "0xe4"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.04s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xe4:
avrdude: load data lfuse data from input file 0xe4:
avrdude: input file 0xe4 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.04s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xdb"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.04s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xdb:
avrdude: load data hfuse data from input file 0xdb:
avrdude: input file 0xdb contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.04s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

blackman@altair:~/tiny-gps $

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Please read the thread I linked to. You need a recent version of controlP5.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

It's a bumpy road, but I'm struggling somehow :)

finally got the .exe file. :)
it wasn't the controlP5 that was causing the error, but wiiconfig.pde needed some modification,
(the one you linked, it was not modified? so i deleted the part with checkboxes and added the lines from one of your posts)
hopefully thats ok now,

Image

now i figured that for attiny option, it's needed to double define it. not only tiny_sonar, but also gps_tiny
Image

so previously in my pics, it wasn't enabled in wii at all. :(
but when I define it, it cannot compile, even if your files are added, what's wrong on my side.



thank you for your help :)
Last edited by dr.tom on Sun May 13, 2012 5:36 pm, edited 4 times in total.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

dr.tom wrote:but when I define it, it cannot compile, even if your files are added, what's wrong on my side.
thank you for your help :)


I had the same problem with the arduino ide and the .h files. They need to be placed somewhere where the ide likes. But if you copy the .h files from the tiny-gps directory to the main multiwii directory, and change the relative path under "gps" tab, it will compile.

Federico

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

:-( Downloaded the last MultiWiiConf and controlP5 0.7.2, compiled with processing (while having an error on "hidelabel" for "checkbox" (just commented out for testing). Same error as before. I get just tons of i2c errors and this strange blinking portion of the magnetometer datas. My Multiwii test has nothing but the tiny-gps enabled and connected.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Looks like your I²C connections are faulty. the debugging output indicates that the TinyGPS controller is working fine (you can spot date, time and your position there).
Have you tried lowering the value of your pushup resistors?

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

Tommie wrote:Looks like your I²C connections are faulty. the debugging output indicates that the TinyGPS controller is working fine (you can spot date, time and your position there).
Have you tried lowering the value of your pushup resistors?


Haven't tried others resistors yet but as I see your test software working, the i2c scanner working, and many others project I did working basically with the same resistors, I started to think that must something else... I'd really like to use the tiny-gps :-)

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

The more devices your I²C bus has, the longer the wires are, the higher the electrical bus capacity gets. This means that it takes longer for the pull up resistors to re-charge the bus after it has been pulled down. You can also try to slow down the bus (if you are using 400kHz).

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

Tommie wrote:The more devices your I²C bus has, the longer the wires are, the higher the electrical bus capacity gets. This means that it takes longer for the pull up resistors to re-charge the bus after it has been pulled down. You can also try to slow down the bus (if you are using 400kHz).


I am testing different resistor and different speed of the bus but for what I know 3.3k resistor on a single device bus (the gps-tiny) and 5cm of wires should be ok. I had success with 2.2k or 3.3k depending on the situation also on 2meters of bus with many devices... The thing is, the multiwii conf say "i2c" error also if I have no devices attached at all. I don't know if this is normal. I still don't get why the test software is working and MWii is not. I will report as soon as possible if I do any progress!

Thanks for your help,
F

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Sure, if you have no devices connected at all and Multiwii tries to access these devices, every try will yield an I2c error.
3.3k is quite high, I am using half of that right now. If you are running your bus at 400kHz, the resistor has to recharge the entire bus from 0 to 5 (or 3.3) V in less than 0,0025 milliseconds.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Federico wrote:I had the same problem with the arduino ide and the .h files. They need to be placed somewhere where the ide likes. But if you copy the .h files from the tiny-gps directory to the main multiwii directory, and change the relative path under "gps" tab, it will compile.

Thanks for your input, I changed my branch to place the tiny-gps.h in the main multiwii directory and adapted the #define and #include statements.

#define TINY_GPS will now enable the GPS portion of the module, define TINY_GPS_SONAR will activate the sonar stuff. Of course you can use both, ut one is enough :)

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

So it's everything working for you?

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Sure, I have GPS data as well as sonar data in my UI, alle sensors are working without any sign of trouble.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

Downloaded your latest branch,

compiles OK without attiny activated, but with it, it doesn't, where's the problem, does something need to be modified/imported or ... ? I thought it was updated and ready for compiling :cry:

Image Image

Thank you for your help :)

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

I cannot reproduce your problem, I can compile it with or without ATTiny enabled.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

You managed to compile previous version(with bug) also without problem :) obviously you have a bunch of files on hard drive so your compiler can access them somehow,

Please try it on some clean computer, where you download only your last branch and have arduino 1.0
if you have time and will.

I can compile and fly other wii versions without problem,
so i believe my comp is not the problem (but that's just hope :D )

Thnx :)

btw, there were some more or less successful attempts to integrate sonar reading in to flying behaviour, not only to display it in GUI.
It works over pins D8 & D12 directly on Promini, without second cpu,
but eliminated AUX2 option and costed some of cycle time :(
viewtopic.php?f=7&t=1033&hilit=sonar&start=80#p11815
viewtopic.php?f=8&t=1356&hilit=sonar&start=10

so if you can find time to adopt it into your code, it would be great.
it would give sense to tiny_sonar option :)

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

dr.tom wrote:You managed to compile previous version(with bug) also without problem :)

There is no bug in the code. Only in the Arduino build environment, which is horrible.
so if you can find time to adopt it into your code, it would be great.
it would give sense to tiny_sonar option :)

If Multiwii employed a sane versioning system (read: distributed), integration of such changes would be no issue at all. However, since we are stuck at SVN...

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

OK, got it. Stupid Arduino cannot handle .h files with an - in it. Fixed it.

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by dr.tom »

You're the man! Thanks :)

all works OK now on Promini without sacrificing Aux1&2 pins

even at 400kHz with 0 I2C errors, no matter if wires are 20cm long to attiny board(will shorten them, this was for test purpose only)

Image


Now it's just a matter of time when EosBandi will finish his new GPS code, and someone else integrate Sonar values into Alt hold :)

EDIT: don't know what rev do you exactly use,
but it seems it hasn't got this r760 'hexa+gimbal fix' included in it http://code.google.com/p/multiwii/source/detail?r=760 , just tried to fly it.
will try to owerwrite it with that 'output.ino' and see if it will work on your attiny wii version like it does on latest dev,

EDIT2: just replaced your output.ino with the fixed one, it works on desk, will try it out tomorrow.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

Just tried to pull last commit from gpstiny branch and I can confirm that it compiles without problems on the arduino ide.
Still investigating the code becase my gps is not working at all on multiwii-gpstiny :-(

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Federico »

Could you help me to debug why my tiny-gps is not working?
I have cloned your repositories, tinygps and multiwiiconf to the last patches. Downloaded last p5 library.
I configured in tinygps for attiny2313 the config.h and enabled (1) the gps and set the baud, 4800.
Uploaded to successfully to my tiny with this line

Code: Select all

avrdude -c avrisp -p t2313 -P /dev/ttyUSB0 -b 19200 -U lfuse:w:0xe4:m -U hfuse:w:0xdb:m -U efuse:w:0xff:m  -U flash:w:tiny-gps.hex

The example test sketch right now gives

Code: Select all

Request: 7 16 5 12 0 0 0 45 26 86 66 9 10 103 3 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255 
Request: 7 16 5 12 21 26 1 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 21 26 1 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 21 26 1 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 21 26 1 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 21 26 1 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 0 0 0 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 0 0 0 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 21 26 2 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255
Request: 7 16 5 12 21 26 2 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255

where this first value 7 looks like strange (it was 6 in my previous post) because in your paper looks like valid just 0 1 2

A brand new config of multiwii, with just connected and uncommented tinygps gives only i2c errors (from 0 to 30000 then from -30000 to 0 and so on), whatever pullups i put (from 1.8 to 4.7, I tried everything)

Should I suppose that some piece of hardware is broken?

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Federico wrote:

Code: Select all

Request: 7 16 5 12 21 26 2 45 26 86 82 9 10 103 146 147 0 3 1 3 0 0 0 0 255 255 255 255 255 255 

where this first value 7 looks like strange (it was 6 in my previous post) because in your paper looks like valid just 0 1 2

This is completely valid, the first byte is a bitmask, take a look at nmea_structs.h:

Code: Select all

#define NMEA_RMC_FLAGS_STATUS_OK 0
#define NMEA_RMC_FLAGS_LAT_NORTH 1
#define NMEA_RMC_FLAGS_LON_EAST 2

7 is decimal for 00000111, so the bit 0, 1 and 2 are all set; you are on the northern hemisphere, east of the zero meridian, and your GPS unit has acquired some sort of lock (STATUS_OK).
A brand new config of multiwii, with just connected and uncommented tinygps gives only i2c errors (from 0 to 30000 then from -30000 to 0 and so on), whatever pullups i put (from 1.8 to 4.7, I tried everything)

Should I suppose that some piece of hardware is broken?

I don't think that your hardware is broken; the tinygps controller is obviously working, your copter is obviously flying, for some reason the two devices do not talk to each other. Double- and triplecheck the wires, make sure the ATTiny is supplied with the right voltages. It's either that or some weird software/configuration issue.

charbot
Posts: 34
Joined: Wed May 23, 2012 8:37 pm

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by charbot »

Hey, just order some parts- cant wait to build the tiny-gps! Have the patches been merged in the lasted devs?

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

No, sadly not. And with each passing day, merging gets more complicated due to new changes in the GPS and I²C code. Therefore please merge my changes :-)

charbot
Posts: 34
Joined: Wed May 23, 2012 8:37 pm

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by charbot »

heh, We need to start a "petition"

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

I updated my TinyGPS branch to the latest MWC version present in the shared SVN. Please merge my changes before they get out of date again:

https://github.com/wertarbyte/multiwii- ... les_bucket (Select "Files CHanges")

https://github.com/wertarbyte/multiwii- ... nygps.diff

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

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by EOSBandi »

Tommy,
Gps code uses 1deg =10000000 precision, you have to update your code to that precision if you want to integrate tinygps with latest gps code.
E

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Thank you for your input, I already fixed that; please check the above links again.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Alexinparis »

@Tommie,
We defined some simple rules to add code here:
http://code.google.com/p/multiwii/sourc ... README.txt

And one rule is "no new tabs".
It's maybe not the most efficient way of coding from a coder point of view, but I prefer to keep low the number of files.
So please remove and merge tinygps.h into gps.ino

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: Tiny-GPS integrated into Multiwii (GPS/Sonar/Optical to

Post by Tommie »

Alexinparis wrote:It's maybe not the most efficient way of coding from a coder point of view, but I prefer to keep low the number of files.
So please remove and merge tinygps.h into gps.ino

Do you really think dumping the entire bulk of structs into a single file is a good idea? GPS.ino (and most of the other files) are already so heavily overloaded that it is hard to get anything done without spending considerable time searching for definitions or declarations.
If you think that its a good idea[tm], I'm happy to comply, but I'm not sure whose life is made easier by doing so. Ordinary users? Won't case about these tabs, edit config.h and upload. Developers? Are happy about some structure and probably aren't using "tabs" anyway.

Post Reply