gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > GPS to GBA @ 4800 ?

#26658 - Hutch - Wed Sep 22, 2004 8:39 am

Hi,

I am just starting at programming the GBA, and my first attempt is a moving map display for my Magellan 310 GPS. All the documentation I have seen shows the slowest predefined serial speed is 9600 baud and my GPS outputs at 4800, does this mean I have to monitor pin 3 for activity and decode ascii on the fly ?

Has anyone communicated with the GBA at 4800 baud, and if so can they show me how they did it. ?

I have experience with C but am a little rusty.

Mark.

#26686 - ampz - Thu Sep 23, 2004 4:04 pm

Well, bit banging is probably the only solution.

Perhaps there is a chance you can trick the gba to recieve the data using multiplayer mode communication? Set it to 9600bit/s and 16bit transfers.
You will get two copies of every recieved bit, and you will get alot of missing stop-bit errors, but you can just ignore thoose, the data should be ok.
The special multiplayer handshake might be a problem.

#26687 - Hutch - Thu Sep 23, 2004 4:14 pm

From what I have seen, bit banging seems to be the only option. Assuming at 9600 the GBA expects 16 bits, won't that mean the start bit and the first 7 bits will be doubled and the final bit and stop bit will either be on the next word or discarded..

Anybody have a code snippit for tracking the bits as they arrive at the serial in pin ?

#26692 - SmileyDude - Thu Sep 23, 2004 9:21 pm

on a somewhat related topic, I was thinking about writing some library code for bit-banging the serial port at different rates/formats. This is really something that's crying out for a somewhat standard library implementation... does anyone have any interest/suggestions for such a beast?
_________________
dennis

#26706 - Hutch - Fri Sep 24, 2004 5:24 am

Yes please, also I wouldn't mind some code examples of bit banging on the GBA, assembler or C.

#26722 - ampz - Fri Sep 24, 2004 1:39 pm

Hutch wrote:
From what I have seen, bit banging seems to be the only option. Assuming at 9600 the GBA expects 16 bits, won't that mean the start bit and the first 7 bits will be doubled and the final bit and stop bit will either be on the next word or discarded..


Ah, but you are forgeting that the GBA expects 16bits, one start bit and one stop bit.
The first bit recieved efter the startbit will be a copy of the start bit, after that you get 14 bits representing the first 7bits of the byte transfered (two copies of each bit), and the last bit will be the 8th bit of the byte.
Now the GBA will expect a stop-bit, but instead it will get a copy of the last bit, so there will be alot of missing stop-bit errors. But other than that, it should work.
Code:

4800bit/s 8bit:    SS0011223344556677PP
9600bit/s 16bit:   S0123456789abcdefP

S=start bit
P=stop bit

#26733 - Hutch - Fri Sep 24, 2004 5:19 pm

Then the gameboy gets the 2 stop bits, won't that stuff up the next byte coming in ? The GPS shoves out 10 bits at a time, the GBA receives 20 bits and only expects 18, what happens to the overflow ? won't it be counted as the first 2 bits of the next byte ?

#26738 - ampz - Fri Sep 24, 2004 8:47 pm

No. Stop bits are the same as "idle".