RobSmithDev / ArduinoFloppyDiskReader

DrawBridge aka Arduino Amiga Floppy Disk Reader/Writer - Hardware and software interface for accessing Amiga disks (read/write ADF and SCP) on non-Amiga hardware
https://amiga.robsmithdev.co.uk
GNU General Public License v3.0
226 stars 53 forks source link

Using Arduino Duemilanove with on-board USB UART (FT232RL) for read-only? #3

Closed ewenmcneill closed 6 years ago

ewenmcneill commented 6 years ago

This looks like a real exciting project, and I'm considering trying to adapt it for my (non-Amiga) use case.

Could you clarify the Arduino hardware requirements a little further for me? In particular I happen to have a AT Mega 328-based Arduino Duemilanove board here already which I'm wondering if I can use "as is" (the early Duemilanove boards came with a AT Mega 168, but later ones were 328-based, and mine has a sticker staying AT Mega 328; according to the Arduino website it's an AT Mega 328P). It looks like the Arduino Uno is also AT Mega 328P based.

As best I can tell your project needs:

The Arduino Duemilanove board has a FTDI FT232RL onboard, which seems to be capable of 2Mbps serial. Is this likely to be sufficient for read-only purposes? (AFAICT CTS is just grounded on the Duemilanove onboard USB-serial, so I'm assuming write support is a no go without an external USB-serial device.)

AFAICT the Arduino Uno does not have a FT232RL on it; instead programming seems to be via a smaller AT Mega device, which presumably has its own serial IO implementation. I'm not sure if that one will do 2Mbps?

Can you clarify if an external USB-serial device is needed even for read-only access? (AFAICT many of those external USB-serial, eg, PMOD, devices are using, eg, FT232RL or similar).

Thanks,

Ewen

RobSmithDev commented 6 years ago

Hi

Curious what disk format you will be targeting!

Anyway, yes the FTDI external module is only for write because of the CTS as you suspected.

The Arduino I have been using is a 328p at 16mhz anyway so should be compatible.

2M is the max the Arduino can do at 16MHz, so as long as the on board device can do that you should be ok. You could if needed change it and the PC software to 1M baud if needed, I just wanted to minimise writing errors.

Hope this helps

Best wishes

Rob Smith Creative/Frontend/Backend Developer http://robsmithdev.co.uk

On 19 Mar 2018, at 21:19, Ewen McNeill notifications@github.com wrote:

This looks like a real exciting project, and I'm considering trying to adapt it for my (non-Amiga) use case.

Could you clarify the Arduino hardware requirements a little further for me? In particular I happen to have a AT Mega 328-based Arduino Duemilanove board here already which I'm wondering if I can use "as is" (the early Duemilanove boards came with a AT Mega 168, but later ones were 328-based, and mine has a sticker staying AT Mega 328; according to the Arduino website it's an AT Mega 328P). It looks like the Arduino Uno is also AT Mega 328P based.

As best I can tell your project needs:

AT Mega 328P-based Arduino (eg, 2KB RAM) or bigger

16MHz clock (for the timing loops)

USB-serial capable of 2Mbps on standard Arduino TX/RX pins

For write support only (which I don't need), wired access to control the CTS serial line to slow down PC host from sending data, eg via using an external USB/serial module with a CTS line

The Arduino Duemilanove board has a FTDI FT232RL onboard, which seems to be capable of 2Mbps serial. Is this likely to be sufficient for read-only purposes? (AFAICT CTS is just grounded on the Duemilanove onboard USB-serial, so I'm assuming write support is a no go without an external USB-serial device.)

AFAICT the Arduino Uno does not have a FT232RL on it; instead programming seems to be via a smaller AT Mega device, which presumably has its own serial IO implementation. I'm not sure if that one will do 2Mbps?

Can you clarify if an external USB-serial device is needed even for read-only access? (AFAICT many of those external USB-serial, eg, PMOD, devices are using, eg, FT232RL or similar).

Thanks,

Ewen

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ewenmcneill commented 6 years ago

Hi Rob,

Per #4, I'm looking at IBM PC-like 5.25" floppies. Although in my case most of them were actually written on an Amstrad CPC6128 with a 5.25" drive attached. The Amstrad CPC had its own disk formats, but due to the use of the NEC 765 disk controller (identical chip to the early IBM PCs) in practice the only real difference to read them back is the sector numbers being offset by some amount (different for each format, it was how it detected the format). Most of my floppies are actually in a "NigDos" (Amstrad extension ROM) double sided format -- 42 tracks, 10 sectors/track, 2 sides (out side A, then out side B), 512 byte sectors -- with yet more different sector numbers.

I read a bunch of them years ago (14+ years ago) under Linux by using the raw interface to the floppy controller via Linux, so I know the format is "fairly standard" (by "modern" floppy disc standards). But it's been at least half a dozen years since I've had a PC with a floppy drive attached.... so I've been looking around at other options other than trying to get a bunch of old PC parts to work again!

From what you've said it sounds like the more recent Arduino Duemilanove boards (like mine), with the AT Mega 328P should work as is, which encourages me to give it a try since it seems like I already have the parts I need on hand (other than spare time :-) )

I'll close this issue now as I have the answer I need. But when/if I try it and get it working I'll try to remember to add a "for the record" comment for later reader's benefit.

Ewen

ewenmcneill commented 6 years ago

FTR, I've started trying to make this work today. At least from Linux there are a few challenges in trying to make the Arduino Duemilanove on-board FT232RL work as the serial port of the floppy tools:

So I've been able to confirm I can talk to the Arduino at 115200bps from kermit, and send "?" to get the firmware version back, but I have not been able to confirm any higher transmission rates. I have a feeling if I could wait out the boot loader before sending commands, I could make the Linux tool work, and that might allow confirming higher transfer speeds also work.

In kermit I need to do:

set line /dev/ttyUSB0
set speed 115200
set flow-control none
set carrier-watch off
c

to connect to the Arduino. Then sending "?" should return a string with the version number in it.

Ewen

ewenmcneill commented 6 years ago

Based on some quick experimentation it does seem to work with a 2 second sleep() between opening the serial port and trying to send the "?" firmware enquiry. And it does seem to work at 2Mbps, with that 2 second delay and RTS/CTS disabled. (1 second seems to be almost but not quite long enough; the bootloader source shows the delay is a loop count, and for the Arduino Duemilanove ATMega328 -- "atmega328" -- the loop count is set in the Makefile with MAX_TIME_COUNT=F_CPU>>4, which seems to work out to 1M loops, and presumably takes "about" 1-2 seconds. But I have been unable to find an actual "wait this long" time documented anywhere useful.)

Ewen

RobSmithDev commented 6 years ago

Sounds like you are making some progress then at lease, keep up the good work!

Rob Smith Creative/Frontend/Backend Developer http://robsmithdev.co.uk

On 2 Apr 2018, at 05:49, Ewen McNeill notifications@github.com wrote:

Based on some quick experimentation it does seem to work with a 2 second sleep() between opening the serial port and trying to send the "?" firmware enquiry. And it does seem to work at 2Mbps, with that 2 second delay and RTS/CTS disabled. (1 second seems to be almost but not quite long enough; the bootloader source shows the delay is a loop count, and for the Arduino Duemilanove ATMega328 -- "atmega328" -- the loop count is set in the Makefile with MAX_TIME_COUNT=F_CPU>>4, which seems to work out to 1M loops, and presumably takes "about" 1-2 seconds. But I have been unable to find an actual "wait this long" time documented anywhere useful.)

Ewen

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.