Skip to content

Commit b276d76

Browse files
committed
v2.4 Improved support for Usb to Serial devices based on findings from GitHub user "prickle" - firmware is now V1.7
1 parent d7e5581 commit b276d76

File tree

9 files changed

+54
-103
lines changed

9 files changed

+54
-103
lines changed

ArduinoFloppyReader/ArduinoFloppyReader/Main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReader (and writer)
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This program is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Library General Public
@@ -127,8 +127,8 @@ void runDiagnostics(int comPort) {
127127

128128
int wmain(int argc, wchar_t* argv[], wchar_t *envp[])
129129
{
130-
printf("Arduino Amiga ADF Floppy disk Reader/Writer, Copyright (C) 2017-2018 Robert Smith\r\n");
131-
printf("Full sourcecode and documentation at http://amiga.robsmithdev.co.uk\r\n");
130+
printf("Arduino Amiga ADF Floppy disk Reader/Writer, Copyright (C) 2017-2020 Robert Smith\r\n");
131+
printf("Full sourcecode and documentation at https://amiga.robsmithdev.co.uk\r\n");
132132
printf("This is free software licenced under the GNU General Public Licence V3\r\n\r\n");
133133

134134
if (argc < 3) {

ArduinoFloppyReader/ArduinoFloppyReaderWin/ArduinoFloppyReaderWin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReaderWin
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This program is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Library General Public

ArduinoFloppyReader/ArduinoFloppyReaderWin/ArduinoFloppyReaderWin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReaderWin
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This program is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Library General Public

ArduinoFloppyReader/ArduinoFloppyReaderWin/ArduinoFloppyReaderWinDlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReaderWin
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This program is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Library General Public

ArduinoFloppyReader/lib/ADFWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReader (and writer)
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This library is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Library General Public

ArduinoFloppyReader/lib/ArduinoInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReader (and writer)
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This library is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Library General Public

CONTRIBUTING.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

FloppyDriveController.sketch/FloppyDriveController.sketch.ino

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ArduinoFloppyReader (and writer)
22
*
33
* Copyright (C) 2017-2020 Robert Smith (@RobSmithDev)
4-
* http://amiga.robsmithdev.co.uk
4+
* https://amiga.robsmithdev.co.uk
55
*
66
* This sketch is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU General Public
@@ -20,14 +20,18 @@
2020
/* Latest History:
2121
Firmware V1.4: Merged with Pull Request #6 (Modified the behavior of the current track location on Arduino boot - paulofduarte) which also addresses issues with some drives
2222
Firmware V1.5: Merged with Pull Request #9 (Detect and read out HD floppy disks 1.44M by kollokollo)
23-
Firmware V1.6: Added experimental writing HD disk support
23+
Firmware V1.6: Added experimental unbuffered writing HD disk support
24+
Firmware V1.7: Added suggestion from GitHub user "prickle" regarding the CHECK_SERIAL function which should reoslve issues with some of the USB to SERIAL converters
2425
*/
2526

2627
/////////////////////////////////////////////////////////////////////////////////////////////////////
2728
// This sketch manages the interface between the floppy drive and the computer as well as the //
2829
// low-level disk reading and writing. For more information and how to connect your Arduino //
29-
// to a floppy drive and computer visit http://amiga.robsmithdev.co.uk //
30+
// to a floppy drive and computer visit https://amiga.robsmithdev.co.uk //
3031
/////////////////////////////////////////////////////////////////////////////////////////////////
32+
// This code doesnt actually do any decoding, and is mearly reading pulses, so can be used to //
33+
// Read data from other disk formats too. //
34+
//////////////////////////////////////////////////////////////////////////////////////////////
3135

3236
#define BAUDRATE 2000000 // The baudrate that we want to communicate over (2M)
3337
#define BAUD_PRESCALLER_NORMAL_MODE (((F_CPU / (BAUDRATE * 16UL))) - 1)
@@ -93,7 +97,6 @@
9397

9498
// The current track that the head is over. Starts with -1 to identify an unknown head position.
9599
int currentTrack = -1;
96-
=======
97100

98101
// If the drive has been switched on or not
99102
bool driveEnabled = 0;
@@ -357,11 +360,11 @@ unsigned char SERIAL_BUFFER[SERIAL_BUFFER_SIZE];
357360
#define CHECK_SERIAL() if (UCSR0A & ( 1 << RXC0 )) { \
358361
SERIAL_BUFFER[serialWritePos++] = UDR0; \
359362
serialBytesInUse++; \
360-
} else \
361-
if (serialBytesInUse<SERIAL_BUFFER_START) { \
363+
} \
364+
if (serialBytesInUse<SERIAL_BUFFER_START) \
362365
PIN_CTS_PORT &= (~PIN_CTS_MASK); \
363-
PIN_CTS_PORT|=PIN_CTS_MASK; \
364-
}
366+
else PIN_CTS_PORT|=PIN_CTS_MASK;
367+
365368

366369

367370

@@ -481,6 +484,7 @@ void writeTrackFromUART() {
481484

482485

483486
// Write a track to disk from the UART - the data should be pre-MFM encoded raw track data where '1's are the pulses/phase reversals to trigger
487+
// THIS CODE IS UNTESTED
484488
void writeTrackFromUART_HD() {
485489
// Configure timer 2 just as a counter in NORMAL mode
486490
TCCR2A = 0 ; // No physical output port pins and normal operation
@@ -571,10 +575,10 @@ void writeTrackFromUART_HD() {
571575
WRITE_BIT(0x68,B00000010);
572576
CHECK_SERIAL();
573577
WRITE_BIT(0x78,B00000001);
574-
TCNT2=248; // a little cheating, but *should* work
578+
TCNT2=248; // a little cheating, but *should* work
575579
}
576580

577-
// Turn off the write head
581+
// Turn off the write head
578582
PIN_WRITE_GATE_PORT|=PIN_WRITE_GATE_MASK;
579583

580584
// Done!
@@ -589,7 +593,7 @@ void writeTrackFromUART_HD() {
589593

590594

591595

592-
// Write a track to disk from the UART - the data should be pre-MFM encoded raw track data where '1's are the pulses/phase reversals to trigger
596+
// Write blank data to a disk so that no MFM track could be detected
593597
void eraseTrack() {
594598
// Configure timer 2 just as a counter in NORMAL mode
595599
TCCR2A = 0 ; // No physical output port pins and normal operation
@@ -639,7 +643,8 @@ void eraseTrack() {
639643

640644

641645

642-
// Write a track to disk from the UART - the data should be pre-MFM encoded raw track data where '1's are the pulses/phase reversals to trigger
646+
// Write blank data to a disk so that no MFM track could be detected
647+
// THIS IS UNTESTED
643648
void eraseTrack_HD() {
644649
// Configure timer 2 just as a counter in NORMAL mode
645650
TCCR2A = 0 ; // No physical output port pins and normal operation
@@ -925,7 +930,7 @@ void loop() {
925930
writeByteToUART('V'); // Followed
926931
writeByteToUART('1'); // By
927932
writeByteToUART('.'); // Version
928-
writeByteToUART('5'); // Number
933+
writeByteToUART('7'); // Number
929934
break;
930935

931936
// Command "." means go back to track 0
@@ -961,12 +966,12 @@ void loop() {
961966

962967
// Command "<" Read track from the drive
963968
case '<': if(!driveEnabled) writeByteToUART('0');
964-
else {
969+
else {
965970
writeByteToUART('1');
966971
if(disktypeHD)
967-
readTrackDataFast_HD();
968-
else
969-
readTrackDataFast();
972+
readTrackDataFast_HD();
973+
else
974+
readTrackDataFast();
970975
}
971976
break;
972977

@@ -975,20 +980,20 @@ void loop() {
975980
if (!inWriteMode) writeByteToUART('0'); else {
976981
writeByteToUART('1');
977982
if(disktypeHD)
978-
writeTrackFromUART_HD();
979-
else
980-
writeTrackFromUART();
981-
}
982-
break;
983+
writeTrackFromUART_HD();
984+
else
985+
writeTrackFromUART();
986+
}
987+
break;
983988

984989
// Command "X" Erase current track (writes 0xAA to it)
985990
case 'X': if (!driveEnabled) writeByteToUART('0'); else
986991
if (!inWriteMode) writeByteToUART('0'); else {
987992
writeByteToUART('1');
988993
if (disktypeHD)
989-
eraseTrack_HD();
990-
else
991-
eraseTrack();
994+
eraseTrack_HD();
995+
else
996+
eraseTrack();
992997
}
993998
break;
994999

readme.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ file is created (ADF for AMIGA, .img for ATARI ST and PC/DOS).
2020
It also allows you to write a backed up ADF file back onto a floppy disk!
2121

2222
# ArduinoFloppyReader
23-
This Visual Studio 2017 project contains two applications, a command line,
23+
This Visual Studio 2019 project contains two applications, a command line,
2424
and a Windows dialog based application
2525

2626
# Scripts for linux
2727
The ATARI ST and DOS/PC floppy formats can be decoded whith these scripts.
2828
9,10,11 or 18 Sectors per track. Up to 82 tracks, DD (ca. 800 kBytes) or
2929
HD (1.4 MBytes). The images usually contain a FAT12 file system which can be
3030
directly mounted by linuy without any additional driver.
31-
Sorry, no interface to WINDOWS yet.
31+
32+
# Commodore 1581 Disks
33+
To read commodore 1581 disks, check out the project at: https://github.com/hpingel/pyAccess1581
3234

3335
# FloppyDriverController.sketch
3436
This is the Ardunio source code/sketch for all Floppy formats.
@@ -39,7 +41,7 @@ This is the Ardunio source code/sketch for all Floppy formats.
3941
* read write protection status
4042
* Read index pulse
4143
* read raw track data (FM, MFM; SD, DD or HD)
42-
* write track data (unbuffered, only DD yet)
44+
* write track data (unbuffered, DD, untested HD)
4345

4446
# AVR Firmware
4547
If you want to use the AVR directly instead of within the Arduino environment,
@@ -48,16 +50,21 @@ has ported the code.
4850

4951
# Help and Instructions
5052
For further details including how to wire this up please visit
51-
[http://amiga.robsmithdev.co.uk]
53+
[https://amiga.robsmithdev.co.uk]
5254

5355
# Whats changed?
54-
V2.2 Fixed 99% of checksum errors when writing by erasing the track first
55-
V2.1 Diagnostics and potential write bug fixed
56-
V2.0 Disk reading has been vastly improved and you can now also write disks!
57-
V1.0 Initial release, can read disks fairly well
56+
v2.4 Improved support for Usb to Serial devices based on findings from GitHub user "prickle" - firmware is now V1.7
57+
v2.33 Merged with Pull Request #9 (Detect and read out HD floppy disks 1.44M by kollokollo) - firmware is now V1.6
58+
v2.32 Merged with Pull Request #6 (Modified the behavior of the current track location on Arduino boot - paulofduarte) which also addresses issues with some drives and updated firmware to 1.4
59+
Made a small change to the diagnostics code to also erase the track before writing it
60+
v2.31 Upgraded the PC code side to work with Visual Studio 2019 resolving issue #11 (ourIThome) and merging pull request #13 (bassclefstudio)
61+
Fixed a few typos in ArduinoInterface.cpp from pull request #12 (Crkk)
62+
V2.2 Fixed 99% of checksum errors when writing by erasing the track first
63+
V2.1 Diagnostics and potential write bug fixed
64+
V2.0 Disk reading has been vastly improved and you can now also write disks!
65+
V1.0 Initial release, can read disks fairly well
5866

5967
# Licence
60-
6168
This entire project is available under the GNU General Public License v3
6269
licence. See licence.txt for more details.
6370

0 commit comments

Comments
 (0)