[Coco] CoCo 2 bitbanger does 57600bps!

Boisy Pitre boisy at boisypitre.com
Thu Mar 23 20:34:08 EST 2006


On Mar 23, 2006, at 6:03 PM, Roger Taylor wrote:

>
> Well, the title of this message says it all...
>
> I have achieved 57600bps communications over the CoCo 2's bitbanger  
> port at the 1mhz clock rate!  In my tests, the CoCo is receiving  
> data at 57600bps from a Windows PC reliably.  I'm going to run some  
> continuous code and check for errors over several days to prove  
> just how reliable this is, but so far it looks great.

Roger,

Congratulations on your achievement.  Just to clarify, you're  
rounding the clock rate up in your message right?  I take it that you  
really mean .895 MHz and that you didn't alter the CoCo's actual  
clock speed.

When I developed DriveWire, I experimented with 57600 bps on a CoCo  
2.  Receiving worked with inlined, straight run code, but I found it  
to be flakey when tested with different PCs and operating systems.   
At those higher speeds, it appeared that some serial ports had  
slightly different tolerances, and the bit transition timing was hit  
and miss.  As you know, it's all in (1) how consistently in time the  
CoCo samples the bit and (2) where the CoCo starts sampling the bit.

For that reason, I would encourage you to test different PCs, even if  
they are all running the same or similar operating systems.

> Besides this being an AWESOME accomplishment, I assume that the  
> 6821 PIA on the CoCo 1 and 2 can only work reliably at the 1mhz  
> clock rate.  Therefore, if the CoCo 3's PIA can work right at 2mhz,  
> then we can achieve 115200bps over the bitbanger port using my same  
> code.

Yes, the PIA on the CoCo 3 can be pushed to 115200 bps as the sender,  
but I had a much harder time getting the CoCo 3 to run at 115200 as a  
receiver.  As I recall, the timing was close but not quite enough to  
detect the start bit with consistency, and I must have tried half a  
dozen permutations of instructions to accomplish the feat.  With a  
6309 in native mode it could be achieved, but I wanted a solution  
that would work with the baseline 6809 running at 1.78MHz.

Another issue is that protocols like DriveWire are bi-directional;  
the CoCo sends a command, the PC receives it and sends a response.   
Some faster PCs would turn the response around so fast that the start  
bit would be missed by the CoCo.  If you're going to build  
reliability into your process you will need some method of passing a  
checksum or other signal back and forth.  That turn-around time  
steals cycles from your CoCo that could be used to look for the next  
start bit, so you may have to throttle the PC at those points.  Also,  
it gets really tricky if you want to implement a receive timeout on  
the CoCo side -- more cycles are spent decrementing a timeout counter  
and that also takes away from available cycles for detecting the  
start bit.

At any rate, it was a great learning process for me, and out of it  
came a very successful product.  I'm sure you're having fun  
discovering all of this yourself!

Boisy



More information about the Coco mailing list