GPS - outofmemoryexception since WM6

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Agrartec, try to read the data without first checking if there is any data:
B4X:
Sub Timer1_Tick
s = serial.InputString
if StrLength(s) > 0 then GPS.GPSStream(serial.InputString)
End Sub
Set the timer interval for 1000 ms.
If there are errors because no data is available try to add an ErrorLabel in this sub:
B4X:
Sub Timer1_Tick
ErrorLabel(Timer1Err)
s = serial.InputString
if StrLength(s) > 0 then GPS.GPSStream(serial.InputString)
return
Timer1Err:
End Sub
 

Agrartec

Member
Licensed User
OK, now I achieved that the "outofmemorxexception" -error doesn`t appear any more. The errorlabel works and somehow the portsplitter as well (maybe I used an older version at first, sorry).
But I don`t receive GPS-data any more. Also GPS4PPC disconnects after 5 seconds if I use the portsplitter-port.
 

agraham

Expert
Licensed User
Longtime User
The errorlabel works and somehow the portsplitter as well (maybe I used an older version at first, sorry).
In what way are they "working" when you are not receving any data? You are not really giving us much detail.

I assume that you have tried Erels' code. Does "serial.InputString" ever return any data at all or is it always a null string?
 

Agrartec

Member
Licensed User
Ok, sorry Agraham. I installed the latest JAL Portsplitter and now the error doesn`t appear any more. Also by using an errorlabel like Erel said above, I could get rid of the error. I think using the Portsplitter is the better way to solve my problem. The program opens the serialport and gps runs.
But now I don`t get any gps-data. I created a label to count the serial.inbuffercount, but it stays at 0.
 

agraham

Expert
Licensed User
Longtime User
Hmmm - stubborn problem isn't it.

It seems, from the gpstuner site, that using JAL Port Splitter on a P3300 does allow a .NET based program to read the GPS via the .NET serial port class. If we assume that this is so then there would seem to be no reason why a B4PPC app cannot do the same. As it presently cannot there would seem to be be two areas where the problem could lie.

a) The JAL Port Splitter is not configured properly.

I assume that you have the input port set to COM4 and the virtual output port to something different. GPStuner indicates that COM5 works so I assume you are using that. I don't know what other configuration might be needed


b) The B4PPC app is not using the serial port correctly.

I assume that you have altered the COM port that your app is using to be COM5. Your first post implies that you had a B4PPC program that worked previously before WM6. Have you tried that program with the Port Splitter exactly as it was before with only the COM port changed? Also have you tried Erels' GPS4PPC unmodified apart from changing the COM port to that of the Splitter?

However at the bottom of this thread where someone has a similar problem

http://www.gpstuner.com/forum/viewtopic.php?t=1201&sid=96e3f7f24e76d645c7139dc7bb5065ef

I found this
Of course, Jaluna also goes on to state that you may need to use the Port Splitter built-in to WinMobile 5.0 and point the two splitters at each other to make the final connection. This does not sound like a fun experiment, and I'm truly sorry you have to jump thru this many hurdles to get the software to work for you...
It doesn't mean anything to me as I have never used WM5 -but maybe WM6 has a similar built-in splitter.

What I don't understand is how your application worked at all under WM5 on a P3300 as all the posts I have found imply that .NET apps won't work. Maybe it was because it was using the old serial library that is not .NET based. In the serial help Erel states that the old libraries don't work under .NET 2.0 yet I thought that WM5 came with .NET 2.0 included. I'm puzzled, any comments Erel?

I'm afraid this is looking like a fundamental problem with the P3300 :mad:

EDIT:- I've since seen a suggestion, I don't know if it is true, that the P3300 with WM5.0 didn't have .NET installed. Was this so? Did you have to install the Compact framework yourself? If so it must have been .NET 1.0. Does WM6 come with .NET 2.0 in ROM? You could always try installing .NET 1.0 SP3 and go back to the old serial libraries to see if that will work.
 
Last edited:

Agrartec

Member
Licensed User
At first, thank you very much for taking your time to help me Agraham.

Of course I know that sometimes very little mistakes or malconfigurations happen and the search for it is a long way.
But I think, I configured the portsplitter and the progs correctly.
When I used GPSTuner some month ago under WM5 then I had to use the portsplitter as well, but the b4ppc-progs worked without the splitter. I use port 4 as incoming gps port and port 5 as virtual port.
Erels GPS4ppc worked without help on WM5.
With WM6 now: Also the installed Version of GPS4ppc (not changed by me) disconnects after the timeout of 5 seconds because serial.inbuffercount stays at 0. And I used the portsplitter too.

What did you mean here:
Have you tried that program with the Port Splitter exactly as it was before with only the COM port changed?
which serial.dll should I use then? I changed ervery prog to serial2.dll. Or is there a way to use the old serialdevice.dll?
My device has .net cf 1.0 installed with WM5 and .net cf 2.0 with WM6. I never had to install CF by Hand. Is it possible to install .Net 1.0 now? I thought it is already within .Net 2.0.

I think there is an error with .Net 2.0 and some buildIn GPS-receivers. I found similar problems in a .Net-forum. I just don`t understand why it works very good with some progs or at least by using portsplitter. Maybe other gps-progs, developed with microsofts devolpment tools on .net cf, wouldn`t work either? But except of GPSTuner I don`t know any.
 

agraham

Expert
Licensed User
Longtime User
What did you mean here: which serial.dll should I use then? I changed ervery prog to serial2.dll. Or is there a way to use the old serialdevice.dll?
I meant toally unmodifed but forget that. Now that we have more information the summary of your situation is that :-

a) Your application worked with WM5 under .NET 1.0 using the original serial library.

b) Your application breaks under WM6 using .NET 2.0 and the serial2 library because of an unresolved incompatibility between the .NET SerialPort class and the P3300 hardware/firmware. Other .NET based software trying to use SerialPort also suffers from this problem but this is not likely to be fixed by HTC as they only support TomTom on the device.

c) Your solution (hopefully) is to install .NET 1.0 SP3 and go back to your original software with the original serial library. I hope this works as it is all that I think that can be done.
 

Agrartec

Member
Licensed User
Oh, it`s so annoying. The installation of .Net 1.0 SP3 tells me that it couldn`t find a correct .Net-Version suitable for my device. (sounded strange to me, but finally it won`t install .Net 1.0)
I tested an old prog with serialdevice.dll and it couldn`t open the serialport.

So, the last and unlikeliest solution would be to go back to WM5?! :sign0148:

And I can`t give my progs to other people using WM6. :sign0080:
 

agraham

Expert
Licensed User
Longtime User
You may know about it but I just found this - it explains about the WM5 GPS splitter that I mentioned in reply #25 in this thread.

http://blogs.msdn.com/windowsmobile/archive/2006/06/07/620387.aspx

Assuming that it exists in WM6 you could invoke this in built-in splitter to pass the GPS (COM4 I believe) to an unused COM, say COM6 and try with the serial2 libary. If this doesn't work then try adding the JAL Post Splitter inputting from COM6 and outputting to COM7. Clutching at at straws I know but maybe worth a try.
 

Agrartec

Member
Licensed User
Now, I have tried every possible combination I could imagine of portsettings in WM6 with and without the portsplitter.
If I do it correct with the portsplitter then the "outofmemoryexception" does not appear, but I do not get any gps-data(serial.inbuffercount). Other progs that use .Net 2.0 work. So I think there is something going wrong in Basic4ppc and its libaries.
I will test on other devices as soon as I can (maybe it is only on devices with buildIn gps). But now I have to stop programming. :mad: This took me too many hours and I have do a job for money as well. Hopefully there will be an answer for this in near future.
Thanks a lot for your help.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've attached a small application to test the SerialPort class.
It was written with Visual Studio 2005.
Inside the zip file you will find a single executable file. Copy it to your device and run it.
Choose the right port and press connect.
The TextBox should get filled with data from the gps.
 

Attachments

  • GPS.zip
    3.2 KB · Views: 305

Agrartec

Member
Licensed User
Hi Erel,
the prog you wrote with Visual Studio 2005 did not show any data in the textbox, but it seems to connect to the Serial.
And I tested a little bit on a friends device with WM6 and buildIn-GPS, but there were no problems at all.
So, I`m sorry that I suggested an error in B4ppc-libaries. It really seems like a bigger problem with my device. :( I think the manufacturer won`t be intrested in my problem, even if every HTC P3300 has it. :sign0105:
I don`t know enough about the deeper backgroud how this "serial/gps and program talking to each other" works. Now I`m a bit disappointed that I can`t find a solution.
 

Agrartec

Member
Licensed User
I got it running! :sign0060:

I read something about GpsGate and just thought its worth a try. Somehow this program can pass the gps-data to b4ppc-apps. I still haven`t got an idea why this is so strange, but I can go on with my work, even if it costs 25 Euro now.

Thanks a lot for your help Erel and Agraham. Maybe some day we will find the failure. (Or not)
 

Agrartec

Member
Licensed User
GpsGate

is an app that is very similar to portsplitter, but it seems to have more oppertunities . It catches the GPS-receiver and gives a virtual-com-port or another format which you desire. I didn`t check out everything. It just works. :sign0162:
 

agraham

Expert
Licensed User
Longtime User
What a relief! I am really pleased that you found a solution that works for you.

From all the Googling around I did it seems there is definitely a .NET 2.0 SerialPort class issue with the built-in GPS on the P3300 as other .NET based apps have the same problem. I found one person who had contacted HTC and was told that they would only provide support for TomTom so he was on his own with third-party GPS apps.
 

bidibulle

Member
Licensed User
Longtime User
I had the same problem with my SPV M650 (HTC P3300 sold by Orange) under WM5. I fixed the problem by installing GPSGATE.
One thing to know: My SPV M650 was sold with a USIM (128Mo) and I add a SD card (1Go). You must install GPSGATE in the main memory or in the USIM. If you install GPSGATE in the SD card you will not be able to set the COM port.
I think that some other software have the same problem (VitesseLimite for example).
 

Frank

Member
Licensed User
Longtime User
ComplexGPS example sometimes working, sometimes doesn't

Hi,
I have the same problem on an O2 XDA Orbit (HTC Artemis).
I installed GPSGate and can run Erel's VisualStudio-sample program ("DeviceApplication3.exe") with no problems (on a virtual COM-port that I defined with GPSGate).

I installed Erel's complexGPS-sample from a setup file I found somewhere here on the forum and it also runs fine.
Now here is the problem: I got the sources of the complexGPS-sample, compiled it myself with B4PPC V6.30 (not optimized; optimized compile doesn't work due to a "Registry Desktop" error) and it shows the same error as before: out-of-memory-exception!

Now that is strange. I have attached the zip-file with the sample which doesn't work. Any idea anyone?

Thanks,
Frank
 
Top