USB CDC ACM/serial drivers
Jeffrey Lee (213) 6048 posts |
Has anyone had a go at writing USB CDC ACM/serial drivers for RISC OS? I was looking for a way to save me from inserting/ejecting SD cards all the time to test ROM images (especially to save me from fiddling with microSD cards on the BB xM) and figured the easiest way would be to download the ROM image over USB via u-boots USB TTY support. So last night I wrote a quick BASIC program to load a ROM image, convert it to the SREC/s-record format (as used by the u-boot ‘loads’ command) and transmit it over the USB connection. Except something is seriously wrong somewhere, because characters start getting dropped if I transmit at more than 100 baud or so, which isn’t very useful when you want to transmit 8MB of data! (SREC encodes everything as hex digits, so the data size is roughly doubled) I’m fairly certain this must be a bug in the 1.5 year old version of u-boot that I’m using, but I figured I’d check to see if anyone has any tried-and-tested drivers for USB CDC ACM/serial devices before I spend too much time fiddling with my own or start experimenting with newer versions of u-boot. I was also unable to figure out a way to receive bytes from the beagleboard – but since that was just a quick test trying to read from the bulk in pipe by opening the DeviceFS file in BASIC it’s probable that there’s some initialisation step that I missed out. |
Jeffrey Lee (213) 6048 posts |
After a bit more work I was able to improve TX reliability and get RX working (albeit only semi-reliably). So I then had a go with hyperterminal on Windows, which was much more reliable. Also unlike when it was connected to my BASIC program the beagleboard wasn’t throwing up any errors when the host received data, so I think part of my troubles were because of the oddness of the Castle USB stack. However despite hyperterminal working OK for regular interaction, things still went horribly wrong when I tried sending a 8MB block of text containing the s-record encoded ROM image, so I’d guess that there are also some problems inside u-boot. Since hyperterminal directly supports kermit & Y-modem I had a go with transferring a ROM image using those protocols, but disappointingly the transfer rate didn’t seem to be any better than RS232. I’m not sure where the problem could be with that. So in summary: It doesn’t look like I’ll be able to switch to downloading ROM images over USB anytime soon! |