QLAN-USB Adapter - working prototype...

Nagging hardware related question? Post here!
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

QLAN-USB Adapter - working prototype...

Post by martyn_hill »

Hi everyone

After 18 months on and off, I have brought my 'QLAN-USB Adapter' project to a working prototype stage... Whilst its usefulness may prove limited to others, I'm quite chuffed and share it here out of sheer enthusiasm :-)

I myself have no plans to make this a commercial offering, but will ultimately post here all the code and designs to allow anyone else to build their own...

In brief:
A small microcontroller-based device that connects to the PC via USB (as a virtual COM port), running code to speak the QLAN protocol down the original 2-wire cable, direct to a native QL (well, as many as QLAN allows). A simple but effective 'Message Queue' is implemented in both the microcontroller and mirrored in the emulated QL that manages the requests from the emulated QL's NET calls, packaging the requests (Send a packet, Read a packet, etc - Martin Head's innovative IPNet seems to do some similar 'encapsulation.') and placing them in the SER queue - from where it reads back the results on a subsequent interrupt.

Practically identical in concept to the (difficult to track-down) SerNET, but potentially faster (3-5 KB p.s. vs SerNET's 1.9 KB p.s. - with Hermes, of course) and using longer and cheaper cabling than RS-232 typically allows. My early attempts with the necessary SIm-Ser drivers and SerNET were not very promising.

Use of the Message Queue and off-loading the physical bit-banging to the uController should allow for smooth multi-tasking at the emulated QL end whilst the NET is otherwise busy - of course, the native QL's NET is operating in the same way as it always has.

Intended development will allow for TK2's FSERVE capabilities to also be accommodated and thus allow one or more native QLs to share the file/print resources available to the emulated QL. All down cheap, 2-wire cabling.

An interesting further development would be to integrate with Martin's IPNet - and potentially open-up the Internet to our humble Black Boxes...

Why?
Whilst developing an application on my PC laptop in QPC (and TextPad as the editor on Windows) to ultimately run on my QL, I got tired of transferring each update of the compiled program and data from QPC to the QL. I started-out using a serial-link and my own X-Modem-like transfer program, but that was bothersome - serial cables don't run very long and my laptop had no native COM port, unless I fitted its docking-station (and don't get me started on USB to Serial adapters...)

After investing in the terrific QL SD-Card adapter, I then used a physical SD card to get the updates across to the modded QL unit sat in my son's bedroom... As there are no SD-Card drivers currently available for QPC, that involved using Q-Emulator to copy between the QXL-WIN file used by QPC and the physical SD-Card. Oh, how tedious (no fault of Q-Em - another terrific piece of software!)

Never satisfied with 'it's working, but could be better', and having always been fascinated by the simplicity of the QLAN network, I started this project to ultimately link QPC (or any QL Emulator that can access the PC's COM ports) direct to a native QL via QLAN.

Or perhaps it was just born of procrastination at finishing the next version of my son's Scalextric lap-counter/timer that I rigged-up to Hermes on the QL.

Status:
I've got the core software running on the uController (an Arduino-like, Teensy++2.0) and as of a couple of hours ago, able to reliably send a single packet successfully to the remote QL. Sending in QLAN requires a couple of read acknowledgements per packet, so the primitive read routines also seem to work. Timing is everything :-)

The test packets are currently built and sent/received by a fairly complex SBasic program running on QPC to implement the Message Queue handler, which will need to be rewritten in MC in due course.

I expect to complete the uController code in the next week or so and then move on the more onerous task of re-compiling the Tk2 NET-FSERVE drivers for QPC/SMSQ, but with the 'physical' NET calls patched to speak to the Message Queue handler code instead (which will do all the send/receive via the SER port.)

P.S.
I have poured over the available sources for QDOS, Minerva and Tk2 NET source code for many hours and think I have gotten to grips with it all - in due course, I will share my findings. How FSERVE does its thing is reminiscent of modern-day RPC calls and really quite clever. Thanks TT!


User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: QLAN-USB Adapter - working prototype...

Post by Dave »

I'd be interested in making a few of these so they're available to those that want them. If you evolve the design to where you're confident the hardware is solid, would you be interested in having me make a batch of 25? I'm sure a few would sell right away. This does solve a major problem many of us have in an interesting way so I'm confident of the demand.

I think the worst outcome is that you publish the details, but nobody makes one because it's too difficult and expensive to make just one.

At the least, I could make sure the PCB is available at low cost.


Derek_Stewart
Font of All Knowledge
Posts: 3928
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QLAN-USB Adapter - working prototype...

Post by Derek_Stewart »

Hi Martyn,

Your project sounds really interesting, I would like to support you in your hardware development.


Regards,

Derek
Paul
Gold Card
Posts: 257
Joined: Mon May 21, 2012 8:50 am

Re: QLAN-USB Adapter - working prototype...

Post by Paul »

Very interresting indeed, I'd love to have one...


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLAN-USB Adapter - working prototype...

Post by martyn_hill »

Hi everyone

What a lovely surprise to hear interest in this pet-project of mine :-)

Given all the interest in adding 'real' networking via Ethernet to the native QL, I thought my idea would be considered out-dated!

@Dave: The hardware is so simple that a PCB might be overkill, especially given that the Teensy can he acquired (as I did) with pins pre-soldered to fit a breadboard. That said, I would fully support someone like your good self fabricating for the 'masses'. One point of special interest is that the Teensy only appears to be available direct from the main designer/producer - PJRC (https://www.pjrc.com/teensy/) - who is based State-side and I naively paid almost as much on customs handling (£ 18) as for the part itself ($ 27) when getting it shipped to the UK.

We can take that offline for the time being, but my only (possibly unnecessary) concern with it going 'commercial' is that I really had it in mind to make the whole design available for free to the community that has supported my activities all this time - and I'd hate that to become a bone of contention later on or undermine any commercial investment...

Meanwhile, I'm completing the Receive side of the code on the uController - more to follow!

I am enthused by your responses! Thank you...


User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: QLAN-USB Adapter - working prototype...

Post by Dave »

If I end up making something for the QL that is someone else's work, I will sell it at actual cost price. If I put a lot of effort, with Nasta, into designing something completely new, I will charge a small margin to cover costs and contribute to the next QL development.

In this case, given the tiny size of the device, it can be sent by 1st class mail, between two pieces of corrugated cardboard, for $1.15, with no duty.

If you or someone in the UK decides to supply these, let me order them and ship them all in a single padded envelope so they can be programmed and cheaply distributed at that end. I'd be happy to help.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLAN-USB Adapter - working prototype...

Post by martyn_hill »

Hi Dave

Now, that sounds like a plan!

But I'm getting ahead of myself - I've still got quite a bit of code to write (I haven't even started on the hack and recompile of the Tk2 code for the emulator side yet!)

Watch this space - nothing like publishing one's ideas to add a bit of pressure to complete a project!

M.


User avatar
QLvsJAGUAR
Gold Card
Posts: 455
Joined: Tue Feb 15, 2011 8:42 am
Location: Lucerne, Switzerland
Contact:

Re: QLAN-USB Adapter - working prototype...

Post by QLvsJAGUAR »

Good stuff, Martin!


QL forever!
https://www.sinclairql.net/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
Derek_Stewart
Font of All Knowledge
Posts: 3928
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QLAN-USB Adapter - working prototype...

Post by Derek_Stewart »

Hi Martyn,

I would be interested in the project, is it possible to build the interface?

I had a quick search on Ebay, there is a Chinese copy:

http://www.ebay.co.uk/itm/Teensy-2-0-US ... Swwo1XehxU

Whether will work the same way is questionable, but at £10.09 and free delivery taking many weeks. Maybe worth a try.


Regards,

Derek
Post Reply