Is Wire Library screwing up my app?

I am using the Wire library to move some data from a shield to the Arduino.

The shield always puts out exactly 36 bytes (GPS Device) but the Arduino sees two data transfers that together add up to 36 bytes. Not always the same count in each of the transfers but always 36 bytes total. The setup() routine is re-run every time the data comes in.

Its as if the library is re-entering the Arduino application and screwing it royally.

Is this possible?

Please mention The shield you are using.

The shield always puts out exactly 36 bytes (GPS Device) but the Arduino sees two data transfers that together add up to 36 bytes. I could not able to understand above sentence please elaborate briefly

It is not the shield or the arduino that has the problem. You need to understand how serial communications work.

there is a reason the GPS serial data has headers and message terminations.

each time the arduino executes it's loop() function, it reads the data which has already come in.
It is doing this process much faster than the data is actually arriving. It will empty the buffer faster
than the serial communication is filling it, and will end the loop() before the message completes.
The next loop() will get the rest of the data. This is not a malfunction, it is how reading serial ports
works. You need to organise your program to deal with it.

Even if you are using some modified GPS protocol in which every message has the exact same number of bytes,
you still need to deal with it.

There are several different ways.

If you know always exactly how many bytes will arrive, modify the code so you always wait for that
many characters.

Otherwise, modify the code to that the parts of the message you are getting, get put back together
into a complete message.

Its better you put code to check the mistake.I wanted to know what is ur expected result @ end of program

I refer put delay in you program before new data is arrived
@ end of your program clear buffer , Once you ensure that you got proper data.

James-Brown:
The shield always puts out exactly 36 bytes (GPS Device) but the Arduino sees two data transfers that together add up to 36 bytes. Not always the same count in each of the transfers but always 36 bytes total.

See this about I2C: http://gammon.com.au/i2c

Mentioned there is that the Wire library has a buffer size of 32 bytes.

Perhaps post your code if you have more questions.

Nick - You were spot on. There were actually two problems interacting.
The first causing the setup() routine to be re-entered was because one of my functions was running away with itself while building a String item. The string became so large that it blew up the application and somehow re-entered the setup().

The other problem, as you pointed out, was that my shield (my own design) always puts out 36 bytes but the buffer in the wire library is 32 bytes and was causing the problem. I have since switched the SoftwareSerial library and am using the shields UART for the job. Works fine.

Thanks again
Regards......... Jim

You can modify a couple of constants in the Wire library to increase the buffer size if you have to. However as I recall each extra byte takes 5 as it makes 5 copies of the buffer.