USB disk interface

602 views
Skip to first unread message

Alan Cox

unread,
Aug 29, 2023, 1:30:31 PM8/29/23
to rc201...@googlegroups.com
I've uploaded the board design now I've had a chance to get the Fuzix
software for it working.

https://hackaday.io/project/192569-rcbus-to-usb-adapter

The module itself is capable of running a full USB host but needs a
lot of software writing if you want to do hubs and the like.
Fortunately it also has a mode where it acts as a storage adapter and
does most of the hardware for a single USB stick. For now this is the
mode I'm running it in.

Hardware wise it can handle hotplug although right now the Fuzix
driver cannot. That's something I'll work on later.

If you want a PCB and the code I have to do a RomWBW driver Wayne let
me know and I'll stick one in the post.

Alan
IMG_20230829_175017.jpg

Wayne Warthen

unread,
Aug 29, 2023, 3:04:01 PM8/29/23
to RC2014-Z80
Support for the CH375/376 in RomWBW has been brought up multiple times, but thus far I have had no hardware to pursue it.

So, I would love to get one of these boards Alan.  I will send you a separate email with shipping information.

In my prior research of this chip, it seems to support both direct sector mode access as well as FAT filesystem file access.  What approach did you use for Fuzix?  I didn't see that specified in the Hackaday entry.  I had originally thought to use direct sector I/O, but I could theoretically just treat a FAT file as a RomWBW disk.

Thanks!

Wayne

Alan Cox

unread,
Aug 29, 2023, 3:13:45 PM8/29/23
to rc201...@googlegroups.com
On Tue, 29 Aug 2023 at 20:04, Wayne Warthen <wwar...@gmail.com> wrote:
>
> Support for the CH375/376 in RomWBW has been brought up multiple times, but thus far I have had no hardware to pursue it.
>
> So, I would love to get one of these boards Alan. I will send you a separate email with shipping information.
>
> In my prior research of this chip, it seems to support both direct sector mode access as well as FAT filesystem file access. What approach did you use for Fuzix? I didn't see that specified in the Hackaday entry. I had originally thought to use direct sector I/O, but I could theoretically just treat a FAT file as a RomWBW disk.

The 375 supports host mode, device mode and block device. The 376 also
has some FAT support but using a large FAT file as a disk seems to be
horribly slow I guess because it's a little microcontroller and has to
keep walking the FAT every time you ask for a block some distance into
the file. The 376 file access mode would certainly be useful exposed
as a tool - and I've seen a few systems do this for accessing FAT
files on random microcontroller/device.

Fuzix at the moment is using the block mode - so you give it an LBA
and you ask it 8 times for 64 bytes (one USB packet each time). I may
look at doing a full USB host later but that's a lot of work, although
keyboard alone wouldn't be too bad.

Alan

Wayne Warthen

unread,
Sep 25, 2023, 6:23:07 PM9/25/23
to RC2014-Z80
Just a quick follow-up on this thread.

Thanks to Alan's PCB and example code, RomWBW now supports both the CH375 and CH376 devices bringing USB Drive support to the RCBus platform under CP/M.  For now, this support is only in the dev branch of RomWBW, but can be downloaded in the Development Snapshot on the RomWBW Github Releases page.

Since RomWBW has a utility (FAT.COM) to read/write files between DOS formatted drives and CP/M, this allows you to insert a generic FAT formatted USB drive/thumbdrive into your RCBus system and easily exchange files with your modern computer.  I'm finding this to be very convenient.

My only warning is that I have found the CH375/CH376 devices to be incompatible with some older USB drives.  I looked very closely at this and I am convinced this is not an issue with the driver code, rather a true incompatibility in the CH37x devices.  I have not seen any issues with reasonably modern USB Drives.

Thanks,

Wayne

MartinR

unread,
Sep 26, 2023, 1:43:01 AM9/26/23
to RC2014-Z80
That's great news! I've long thought that a USB memory stick would be a great way to transfer 'stuff' between desktop PC and my SC126 - but the hardware and software designs are beyond my capabilities. I'll be building one of these, right once I've got my floppy drives working.... or maybe before. Thanks both for making it happen.

MartinR

Gary S

unread,
Sep 26, 2023, 10:28:50 AM9/26/23
to RC2014-Z80
Memory sticks and their management should be interesting...

maybe even the use of hubs...

I look forward to maybe the use of an ethernet dongle ....

Wayne Warthen

unread,
Sep 26, 2023, 2:55:32 PM9/26/23
to RC2014-Z80
On Tuesday, September 26, 2023 at 7:28:50 AM UTC-7 Gary S wrote:
Memory sticks and their management should be interesting...

maybe even the use of hubs...

Hmmm... Not sure that the CH375/CH376 devices will handle a hub.  Honestly, I didn't try it.  I know for sure that the RomWBW driver will not support multiple USB sticks on one interface.

Thanks,

Wayne 

Alan Cox

unread,
Sep 26, 2023, 3:26:38 PM9/26/23
to rc201...@googlegroups.com
The device has four modes, of which one is a device mode so not
relevant to that adapter.

In the block device mode it does the low level USB work for you and is
meant for nailing microcontrollers to USB storage devices (USB sticks
etc, but anything that uses that class should work including an SSD but
not floppy). In the second mode there is a primitive FAT file system
handler on top of the block mode. This is mostly CH376 stuff. The third
mode is a USB message send/receive interface. In that mode you can
in theory do anything but you will need to implement some level of
software USB stack to do so. Keyboard or mouse without a hub isn't too
hard and there are Arduino sketches for that type of use. Doing hub as
well is a lot more code.

So in theory it can do anything USB but needs a lot of babysitting.
There was someone working on a full USB Stack for NitrOS/9 on the COCO
using a CH376 but that seems to have gone quiet. Not sure if they've
given up or ended up being fetched by the men in white coats 8)



Alan

MartinR

unread,
Oct 17, 2023, 9:19:23 AM10/17/23
to RC2014-Z80
Hello -

I'd be really grateful for some help here with this little RCBus to USB module. Maybe Alan or Wayne? After the trials and tribulations with my floppy disk controller, I thought I'd try something easy and so I had high hopes for this module on my SC126/Z180....

I'm using a Dev version of RomWBW:

RomWBW HBIOS v3.4.0-dev.9, 2023-10-13
Small Computer SC126 [SCZ180_sc126] Z8S180-N @ 18.432MHz IO=0xC0

To save me hand-wiring, I had some PCBs manufactured from the files Alan kindly provided -  thank-you! - and the board was easy to build up.

I am using a CH376. And I note that it has a pair of 3-way headers. One is labelled 'P_S' and the other 'S'. The module was supplied with the two pins closest to the 'P-S' legend linked. And I have left it as is.

I have jumpered all 7 of the links on the PCB so that the board responds to I/O address 0x00 and 0x01. I used 1K pull-ups, though that's rather academic with the 7 links to 0V in place.

I've confirmed +5V and 0V are in the right places. And Pin19/P=R of the HTC688 toggles if I use the RomWBW monitor to output to port 0x00 or 0x01, but not for 0x02 and beyond.

At power-up the message 'FP: IO=0x00 NOT PRESENT' has encouragingly changed to 'FP: IO=0x00 SWITCHES=0x00'. I also get the message 'FP Switches = 0x00' immediately before the 'Boot [H=Help]:' prompt. I'm not sure what the 'SWITCHES' refers to....

I don't see a 'Unit' number being allocated for this. Should I? Both FDISK80.COM and FAT.COM expect me to supply a 'Unit' number....

Am I seeing expected behaviour, or am I missing something? I had expected to see a 'Unit' number allocated, and then as Wayne pointed out being able to conveniently transfer files between the SC126 and my Win11 PC using FAT.COM.

Noting Wayne's comment about issues with older USB memory sticks, I've tried a range of USB sticks, ancient and modern, from 4GByte up to 64GByte and all freshly formatted with FAT, or FAT32 for the larger ones. It makes no difference.

I've noticed that hot-swapping the USB memory stick causes the SC126 to reboot, though I accept that's probably something I shouldn't be going with an SC126!

Can anyone please give me a steer?? I've reached the end of my knowledge about what to do next.....

Many thanks in anticipation.


MartinR

Wayne Warthen

unread,
Oct 17, 2023, 12:20:16 PM10/17/23
to rc201...@googlegroups.com
I can send better instructions later, but the main thing is that RomWBW expects the board to be at 0xBE.

Thanks,

Wayne

--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/a3641890-80eb-4564-b070-f52fa1b37d43n%40googlegroups.com.

MartinR

unread,
Oct 17, 2023, 12:25:27 PM10/17/23
to RC2014-Z80
Hi Wayne - 

Ahhh - OK - thanks - much appreciated. I guess I was duped by seeing the 'FP: IO=0x00 SWITCHES=0x00'. I'll adjust the jumpers to 0xBE and have another look. Thanks, I'd appreciate some better instructions - would be helpful.

Many thanks again - 

MartinR

Wayne Warthen

unread,
Oct 17, 2023, 12:37:25 PM10/17/23
to rc201...@googlegroups.com
Sorry, one other thing.  I don’t think the USB support is enabled by default.  You need to enable it in the config settings and build a ROM.  Again, I can provide better instructions later today.  

MartinR

unread,
Oct 17, 2023, 1:16:57 PM10/17/23
to RC2014-Z80
OK Wayne - very many thanks.

MartinR

MartinR

unread,
Oct 17, 2023, 2:33:07 PM10/17/23
to RC2014-Z80
Hi Wayne - 

Thanks to your helpful hints I've now got the board working.

I set the jumpers accordingly, and checked for activity when reading from 0xBE/0xBF.

I found the the CHENABLE flag in cfg-scz180.asm - set FALSE - and over-rode it in SCZ180_sc126.asm. Then I built the ROM using your 'clean' and 'build' scripts, and finally wrote the new SC126 ROM image into the flash memory. And - I now get a unit ID, followed by CP/M giving me four drives on each of the uSD and USB-stick. I've been able to PIP files from uSD to USB without it reporting any errors, so I'm taking that as the board/firmware is working as it should. I'll move on to creating the necessary partition space to allow me to use FAT.COM.

Is there anything else I need to do apart from change the CHENABLE flag? 

As the uSD is my main working "hard drive" and the USB will be used for transfer, I'd like to reduce the number of drives on the USB stick (possibly to zero) and increase them on the uSD. How do I configure that?

I suspect that some documentation/instructions/notes would be very helpful for others. But for now, I think it's a fantastic little module - many thanks both to Alan and yourself!!


MartinR

Wayne Warthen

unread,
Oct 17, 2023, 9:48:36 PM10/17/23
to rc201...@googlegroups.com
On Tue, Oct 17, 2023 at 11:33 AM MartinR <marti...@gmail.com> wrote:
Thanks to your helpful hints I've now got the board working.

Excellent. 

I set the jumpers accordingly, and checked for activity when reading from 0xBE/0xBF.

I found the the CHENABLE flag in cfg-scz180.asm - set FALSE - and over-rode it in SCZ180_sc126.asm. Then I built the ROM using your 'clean' and 'build' scripts, and finally wrote the new SC126 ROM image into the flash memory. And - I now get a unit ID, followed by CP/M giving me four drives on each of the uSD and USB-stick. I've been able to PIP files from uSD to USB without it reporting any errors, so I'm taking that as the board/firmware is working as it should. I'll move on to creating the necessary partition space to allow me to use FAT.COM.

You have it exactly right.

Is there anything else I need to do apart from change the CHENABLE flag? 

Nope.

As the uSD is my main working "hard drive" and the USB will be used for transfer, I'd like to reduce the number of drives on the USB stick (possibly to zero) and increase them on the uSD. How do I configure that?

Well, there is no way to change the number of drive letters assigned by default.  However, if you don't want any drive letters assigned, you could boot your system without the USB stick inserted.  After booting, insert the stick.  It should be accessible to FAT.COM as long as you have already created a valid FAT partition and formatted it.

I suspect that some documentation/instructions/notes would be very helpful for others. But for now, I think it's a fantastic little module - many thanks both to Alan and yourself!!

Yeah, documentation is the perpetual issue.

Thanks,

Wayne 

MartinR

unread,
Oct 19, 2023, 5:18:40 PM10/19/23
to RC2014-Z80
Hi Wayne -

You say that documentation is a problem - which I can understand, as I know it's very time consuming. Can I help in some way? I've derived so much pleasure from what Steve Cousins and yourself have done, I'd like to help give something back. If you think I could help - please email me.

MartinR

Reply all
Reply to author
Forward
0 new messages