- Home
- Discussion Forum
- AROS FORUMS
- Development General
- SerialDiskReader Project
SerialDiskReader Project
Last updated on 1 year ago
miker1264Software Dev
Posted 1 year agoMy first attempt to connect to the UART (serial) USB device using AROS x86 failed.
So I decided to setup the serial connection in Windows 10 then use an application called Tera Term to write directly to serial port com3.
I sent the 3-character Arduino command sequence xR? Where x means abort previous command, R means reset the connection & ? means list version. You can see the reply from com3.
It works! Now to do the same on AROS.
So I decided to setup the serial connection in Windows 10 then use an application called Tera Term to write directly to serial port com3.
I sent the 3-character Arduino command sequence xR? Where x means abort previous command, R means reset the connection & ? means list version. You can see the reply from com3.
It works! Now to do the same on AROS.
Edited by miker1264 on 10-10-2023 19:11, 1 year ago
You do not have access to view attachments
miker1264Software Dev
Posted 1 year agoI'm sorry about the quality of the screenshot.
I sent three 1-character commands to the DrawBridge Device (Arduino Controller). The commands were 'xR?' which asked it to reset & list it's firmware version.
The reply was 1 followed by 1V1,9 which means 1=successfully received commands. Then the version is v1.9 which is also a valid version no.
I sent three 1-character commands to the DrawBridge Device (Arduino Controller). The commands were 'xR?' which asked it to reset & list it's firmware version.
The reply was 1 followed by 1V1,9 which means 1=successfully received commands. Then the version is v1.9 which is also a valid version no.
Edited by miker1264 on 10-10-2023 23:51, 1 year ago
miker1264Software Dev
Posted 1 year agoSome more testing with Tera Term and the Arduino floppy drive controller.
I decided to test the device with an Amiga disk inserted. So I tried the easy ones first. CheckDiskExists '^' and it replies 1# meaning yes it's inserted and it's not write protected. So I flipped the write protect tab and re-inserted it. After sending the command the reply is 11. Yes and it's write protected.
Encouraged by that I wanted to try diagnostics. Next test was to send command Test_RPM. The response was an error "Drive Motor Is Not Turned On" Duh! Of course, how do you test RPM if the disk isn't spinning? So I sent the command Enable to enable reading the disk (and whatever else). Surprise! The disk started spinning. Now we can test RPM. So I sent the Test_RPM again. The response was 1 command received followed by 300.70 which is 300 rpm for an Amiga DD disk. So being finished I sent the command Disable to disable reading and surprise again! The motor switched off and the disk stopped spinning. I tried a few more tests such as GoToTrack #9 and Rewind to seek track 0. I heard the head park itself at track zero. Done!
So what can we do with this? It may be possible to write an entire "SerialDiskReader" program to read Amiga Disks. I would probably write it in C# since the PC COM ports (serial) is easier to work with and more familiar than the AROS serial port structure. That way I can produce a working program so that I can learn all the necessary parts
Then when I finally get the AROS serial.device to open the correct device so I can send and receive the serial data I'll already have a working prototype. I did the same with ILBM images. I wrote an ILBM Viewer in C# before I wrote the SaveILBM for the AROS picture datatype. Of course that took 2 years to complete. 😊
I decided to test the device with an Amiga disk inserted. So I tried the easy ones first. CheckDiskExists '^' and it replies 1# meaning yes it's inserted and it's not write protected. So I flipped the write protect tab and re-inserted it. After sending the command the reply is 11. Yes and it's write protected.
Encouraged by that I wanted to try diagnostics. Next test was to send command Test_RPM. The response was an error "Drive Motor Is Not Turned On" Duh! Of course, how do you test RPM if the disk isn't spinning? So I sent the command Enable to enable reading the disk (and whatever else). Surprise! The disk started spinning. Now we can test RPM. So I sent the Test_RPM again. The response was 1 command received followed by 300.70 which is 300 rpm for an Amiga DD disk. So being finished I sent the command Disable to disable reading and surprise again! The motor switched off and the disk stopped spinning. I tried a few more tests such as GoToTrack #9 and Rewind to seek track 0. I heard the head park itself at track zero. Done!
So what can we do with this? It may be possible to write an entire "SerialDiskReader" program to read Amiga Disks. I would probably write it in C# since the PC COM ports (serial) is easier to work with and more familiar than the AROS serial port structure. That way I can produce a working program so that I can learn all the necessary parts
Then when I finally get the AROS serial.device to open the correct device so I can send and receive the serial data I'll already have a working prototype. I did the same with ILBM images. I wrote an ILBM Viewer in C# before I wrote the SaveILBM for the AROS picture datatype. Of course that took 2 years to complete. 😊
miker1264Software Dev
Posted 1 year agoIf anyone is interested I have attached the full list of Arduino Character Commands. Some are two or three character commands. But most are just single characters.
Edited by miker1264 on 11-10-2023 11:48, 1 year ago
You do not have access to view attachments
miker1264Software Dev
Posted 1 year agoFor the C# Windows program I'll start with a SerialPortWrapper.cs class to send & receive data across the selected serial port.
It will also have a user interface with gadgets very similar to my floppy disk image program.
But the title at top will be "Serial Disk Reader" with a red & white Boing Ball Icon. The Read & Write group boxes will be the same except they will have two radio buttons each for "Low Density" & "High Density" where the floppy disk drop down boxes are. The bottom group box will be "Settings" instead of "Disk Data". That's for the Serial Port Settings such as Baud Rate, etc .
As for AROS I'll keep testing & experimenting while trying to get the serial.device connection to work correctly to send & receive serial data.
It will also have a user interface with gadgets very similar to my floppy disk image program.
But the title at top will be "Serial Disk Reader" with a red & white Boing Ball Icon. The Read & Write group boxes will be the same except they will have two radio buttons each for "Low Density" & "High Density" where the floppy disk drop down boxes are. The bottom group box will be "Settings" instead of "Disk Data". That's for the Serial Port Settings such as Baud Rate, etc .
As for AROS I'll keep testing & experimenting while trying to get the serial.device connection to work correctly to send & receive serial data.
Edited by miker1264 on 11-10-2023 11:59, 1 year ago
You do not have access to view attachments
miker1264Software Dev
Posted 1 year agoThis is the concept for the C# version for Windows 10. The AROS user interface will be as similar as possible.
You do not have access to view attachments
miker1264Software Dev
Posted 1 year agoSometimes when you are searching for the solution to a problem such as trying to find out why I can't send and receive data to a device the answer should be obvious but you don't see it. ðŸ˜
I tried many times to use serial.device with unit 0, 1, 2, 3 to establish a serial connection to the DrawBridge Device which I knew was attached. Finally I concluded that USB to Serial Devices are not supported by serial.device.
It seems that serial.device is for RS232 devices attached to the Serial Port on older computers. It doesn't support modern USB to Serial Devices.
While trying to find out which unit number to use for serial.device I looked at Trident. Hmmm. If it's a USB to Serial UART Device with an FTDI chip on Hub 4 which unit is that? None.
Poseidon USB handles USB devices. That's why usbscsi.device is used to read data from a USB floppy drive. In order to connect to the DrawBridge Device on AROS (or Amiga) we will need a completely new usbserial.device driver that works with Poseidon and Trident. But at least we have usbscsi.device as a model.
It can be found in:
AROS/rom/USB/classes/massstorage/
/* dev.c - usbscsi.device by Chris Hodges */
I tried many times to use serial.device with unit 0, 1, 2, 3 to establish a serial connection to the DrawBridge Device which I knew was attached. Finally I concluded that USB to Serial Devices are not supported by serial.device.
It seems that serial.device is for RS232 devices attached to the Serial Port on older computers. It doesn't support modern USB to Serial Devices.
While trying to find out which unit number to use for serial.device I looked at Trident. Hmmm. If it's a USB to Serial UART Device with an FTDI chip on Hub 4 which unit is that? None.
Poseidon USB handles USB devices. That's why usbscsi.device is used to read data from a USB floppy drive. In order to connect to the DrawBridge Device on AROS (or Amiga) we will need a completely new usbserial.device driver that works with Poseidon and Trident. But at least we have usbscsi.device as a model.
It can be found in:
AROS/rom/USB/classes/massstorage/
/* dev.c - usbscsi.device by Chris Hodges */
Edited by miker1264 on 13-10-2023 10:24, 1 year ago
You do not have access to view attachments
AMIGASYSTEMDistro Maintainer
Posted 1 year agoGreat this way probably on Native AROS and Virtual Machines you will be able to see the contents of PC floppies in Fat, but I believe also those formatted Amiga FFS or other supported Filesystem!
miker1264Software Dev
Posted 1 year agoOn Native AROS we will be able to read/write & mount Amiga Disks on AROS workbench. The Poseidon Device Driver will behave like the usbscsi.device driver when reading USB PC formatted floppy disks. That's exciting!
So with the realization that Poseidon and Trident are needed for USB devices it becomes much easier since I now know where the classes and drivers are located in the source code. But it becomes much more difficult because I have to research and learn everything I can about classes and drivers for Poseidon USB to Serial Devices.
I found mass storage class which contains usbscsi.device driver. I also found serialcp210x and serialpl2303 classes each with their own drivers. The last one, serialpl2303 is the USB to Serial Driver for the Prolific USB to Serial Translator Chip. But DrawBridge uses the FTDI USB to Serial Translator Chip. So we need an FTDI FT232R class with it's own device driver. The driver will need to implement CMD_SEEK, CMD_READ and CMD_WRITE commands.
So with the realization that Poseidon and Trident are needed for USB devices it becomes much easier since I now know where the classes and drivers are located in the source code. But it becomes much more difficult because I have to research and learn everything I can about classes and drivers for Poseidon USB to Serial Devices.
I found mass storage class which contains usbscsi.device driver. I also found serialcp210x and serialpl2303 classes each with their own drivers. The last one, serialpl2303 is the USB to Serial Driver for the Prolific USB to Serial Translator Chip. But DrawBridge uses the FTDI USB to Serial Translator Chip. So we need an FTDI FT232R class with it's own device driver. The driver will need to implement CMD_SEEK, CMD_READ and CMD_WRITE commands.
Edited by miker1264 on 13-10-2023 15:10, 1 year ago
deadwoodAROS Dev
Posted 1 year agoThat's interesting, a few questions from me:
1) What is this DrawBridge? Is this a floppy drive that you can buy (assembled) or do you have to connect Arduino so some existing stock USB floppy drives?
2) How is this detected under Window? Does it see it as a floppy driver or a generic serial device?
3) I assume it's open source hardware. Isn't there a existing linux driver source code that can be adapted to expose a .device-like interface?
4) Doesn't the device expose some standard USB media interface so that it is auto-detected under Window (no need for driver)? Does it really allow access only via serial commands?
1) What is this DrawBridge? Is this a floppy drive that you can buy (assembled) or do you have to connect Arduino so some existing stock USB floppy drives?
2) How is this detected under Window? Does it see it as a floppy driver or a generic serial device?
3) I assume it's open source hardware. Isn't there a existing linux driver source code that can be adapted to expose a .device-like interface?
4) Doesn't the device expose some standard USB media interface so that it is auto-detected under Window (no need for driver)? Does it really allow access only via serial commands?
miker1264Software Dev
Posted 1 year agodeadwood
These are all good questions.
The DrawBridge Device is an open-source project by Rob Smith. You can find all the source files and information on his GitHub page
DrawBridge is the name he chose because it's an Amiga "Disk Reader And Writer" and he calls all his similar devices "bridges". DrawBridge itself is actually a small (really small) PCB attached to a USB cable that Rob Smith solders himself when the PCB returns from the factory. He programs it also by uploading the Arduino sketch.
There are two types of "DrawBridge" Device. On the GitHub page there are instructions to make your own or you can do what I did and buy the pre-made mini PCB that costs about $25 USD. If you buy the pre-made solution you will need to buy a cheap USB floppy drive on eBay for $30. Not just any USB drive will do. The drive must be of a specific type. I bought the wrong one at first. Then I watched a video by Chris Edwards. I had to zoom in to see the exact make & model no.
The correct floppy drive is the N533 model no. FD-05PUB from China. It has p/n 19308801-19 and s/n U356244. Though others may or may not work this one is known to be compatible. The screw hole on the bottom has to be off center to allow room for the small PCB & the ribbon inside has to be compatible with DrawBridge. There is a video with assembly instructions.
When you connect the DrawBridge equipped USB floppy drive in Windows 10 it doesn't appear as a USB floppy drive but rather a UART (serial) device attached by default to COM3. The Arduino controller is inside the PCB in the floppy drive case. To communicate with the Arduino I used Tera Term Serial Terminal to send single character commands such as "xR?" which is Reset & List Firmware Version. Each symbol is an Arduino command. Arduino replied "1V1,9" which is valid. The GUI for Windows is provided as a download. But I'd like to write my own C# version using the list of Arduino command s.
The DrawBridge Device Driver for Windows can be compiled in Visual Studio. Rob Smith stated that there is a Linux driver that also compiles.
These are all good questions.
The DrawBridge Device is an open-source project by Rob Smith. You can find all the source files and information on his GitHub page
DrawBridge is the name he chose because it's an Amiga "Disk Reader And Writer" and he calls all his similar devices "bridges". DrawBridge itself is actually a small (really small) PCB attached to a USB cable that Rob Smith solders himself when the PCB returns from the factory. He programs it also by uploading the Arduino sketch.
There are two types of "DrawBridge" Device. On the GitHub page there are instructions to make your own or you can do what I did and buy the pre-made mini PCB that costs about $25 USD. If you buy the pre-made solution you will need to buy a cheap USB floppy drive on eBay for $30. Not just any USB drive will do. The drive must be of a specific type. I bought the wrong one at first. Then I watched a video by Chris Edwards. I had to zoom in to see the exact make & model no.
The correct floppy drive is the N533 model no. FD-05PUB from China. It has p/n 19308801-19 and s/n U356244. Though others may or may not work this one is known to be compatible. The screw hole on the bottom has to be off center to allow room for the small PCB & the ribbon inside has to be compatible with DrawBridge. There is a video with assembly instructions.
When you connect the DrawBridge equipped USB floppy drive in Windows 10 it doesn't appear as a USB floppy drive but rather a UART (serial) device attached by default to COM3. The Arduino controller is inside the PCB in the floppy drive case. To communicate with the Arduino I used Tera Term Serial Terminal to send single character commands such as "xR?" which is Reset & List Firmware Version. Each symbol is an Arduino command. Arduino replied "1V1,9" which is valid. The GUI for Windows is provided as a download. But I'd like to write my own C# version using the list of Arduino command s.
The DrawBridge Device Driver for Windows can be compiled in Visual Studio. Rob Smith stated that there is a Linux driver that also compiles.
Edited by miker1264 on 14-10-2023 11:23, 1 year ago
miker1264Software Dev
Posted 1 year agoFor further information I believe the Arduino controller only supports a serial connection. So the best solution for modern computers is USB to Serial connection. Rob Smith chose to use the FTDI Usb to serial translator chip. The other well-known brand is "Prolific". Poseidon already has a serialpl2303 class driver for Prolific chips. But looking at the source code it seems the driver turns the USB to Serial into a pure Serial Port. So we can then call OpenDevice ( seialpl2303.device, unit 0, ...) to send serial commands to an attached device. That's cool. 😎
My plan is to adapt a new Poseidon class driver for the serialft232r.device that uses the FTDI chip for USB to Serial. Then I can write SerialDiskReader to use the driver to send character commands across the serial connection. The SerialDiskReader program will handle all the data from each track which is returned as MFM encoded data streams. The data needs to be sent to an MFM Decoder Algorithm to turn it into Binary Data consisting of a stream of 1's & 0's. Then the data can be written to an ADF file at the correct offset.
I have started to adapt the Prolific class driver to be used as the serialft232r class driver by binding the new class with the FTDI chip Vendor ID & Product ID for DrawBridge. Once completed, if it works, I should be able to send & receive data using the new serial device. DrawBridge only communicates with a high speed serial port. The settings are Baud=2000000 which is 2 Mbps. (Yes. Modern PC hardware supports that). Other settings are 8n1 values, RTS/CTS handshake, No Parity. These values are easily set using serial commands in AROS. If successful the set parameters command returns 0. If it fails it is non-zero. SerialDiskReader is at the point of setting parameters & opening the device. But we need a Poseidon class driver to send & receive data.
Because working with serial connections in Windows (COM3) is much easier for me I will quickly (within 2 weeks) write a C# SerialDiskReader program to get the complete prototype for writing an AROS version.
My plan is to adapt a new Poseidon class driver for the serialft232r.device that uses the FTDI chip for USB to Serial. Then I can write SerialDiskReader to use the driver to send character commands across the serial connection. The SerialDiskReader program will handle all the data from each track which is returned as MFM encoded data streams. The data needs to be sent to an MFM Decoder Algorithm to turn it into Binary Data consisting of a stream of 1's & 0's. Then the data can be written to an ADF file at the correct offset.
I have started to adapt the Prolific class driver to be used as the serialft232r class driver by binding the new class with the FTDI chip Vendor ID & Product ID for DrawBridge. Once completed, if it works, I should be able to send & receive data using the new serial device. DrawBridge only communicates with a high speed serial port. The settings are Baud=2000000 which is 2 Mbps. (Yes. Modern PC hardware supports that). Other settings are 8n1 values, RTS/CTS handshake, No Parity. These values are easily set using serial commands in AROS. If successful the set parameters command returns 0. If it fails it is non-zero. SerialDiskReader is at the point of setting parameters & opening the device. But we need a Poseidon class driver to send & receive data.
Because working with serial connections in Windows (COM3) is much easier for me I will quickly (within 2 weeks) write a C# SerialDiskReader program to get the complete prototype for writing an AROS version.
Edited by miker1264 on 14-10-2023 11:45, 1 year ago
You do not have access to view attachments
miker1264Software Dev
Posted 1 year agoThis is the GitHub page for the Arduino Floppy Drive Controller aka "DrawBridge".
https://github.co...DiskReader
https://github.co...DiskReader
deadwoodAROS Dev
Posted 1 year agoThanks for explanation. I took a look at serialpl2303.class and it looks like it's pretty re-usable - I guess the initial initialization is something that will have to modified to fir new chipset. I have an Arduino board so if you get stuck with the driver, I might be able to help out.
miker1264Software Dev
Posted 1 year agodeadwood
Thanks. I've not compiled a device driver for AROS before. This will be a first. Just looking at the files it has a dev.c and ****.class.c so it looks a lot like a datatype.
Not sure though if I can just compile the new Poseidon Class Driver on it's own? It has a makefile.src But I may need to use the Build System and either compile all of Poseidon or all of AROS. We'll see when I get to that point.
Thanks. I've not compiled a device driver for AROS before. This will be a first. Just looking at the files it has a dev.c and ****.class.c so it looks a lot like a datatype.
Not sure though if I can just compile the new Poseidon Class Driver on it's own? It has a makefile.src But I may need to use the Build System and either compile all of Poseidon or all of AROS. We'll see when I get to that point.
AMIGASYSTEMDistro Maintainer
Posted 1 year agomiker, I have noticed that on the new aros-exec there are many more users visiting the portal, you better post your news 'also' on aros-exec!
https://ae.aroswo...
https://ae.aroswo...
miker1264Software Dev
Posted 1 year agoAMIGASYSTEM
Thanks for the link. I see my "Nostalgia" topic is till there. I kinda like the Pink Text. ;-)
Maybe I could start a new topic about my adventures working with the C# version of the Serial DiskReader for Windows 10 & Windows 11.
Amiga DrawBridge only works with Windows 10+. It has a special driver for the FTDI Serial Converter. That's what it lists it as in Device Manager. The same is true for AROS. We need a special Poseidon Class Driver for the FTDI chip.
Today I spent several hours installing Visual Studio ( complete version ) so I could compile the C# sources and test it on my Windows 10 PC with the new 1TB m.2 Nvme SSD drive. :-)
I'm writing a Serial Terminal Program to test sending character commands to the Arduino. Additionally I added some buttons for a Track Number Combo Box and two command buttons for "Read Track" and "Read Disk". The last one is most important but the most difficult part is the MFM Decoder Algorithm to turn MFM data into Binary Data that can be written to a test file.
After I'm sure the subroutines all work I can focus on making the AROS version based on the new Poseidon Class Driver for the serialft232r.
Thanks for the link. I see my "Nostalgia" topic is till there. I kinda like the Pink Text. ;-)
Maybe I could start a new topic about my adventures working with the C# version of the Serial DiskReader for Windows 10 & Windows 11.
Amiga DrawBridge only works with Windows 10+. It has a special driver for the FTDI Serial Converter. That's what it lists it as in Device Manager. The same is true for AROS. We need a special Poseidon Class Driver for the FTDI chip.
Today I spent several hours installing Visual Studio ( complete version ) so I could compile the C# sources and test it on my Windows 10 PC with the new 1TB m.2 Nvme SSD drive. :-)
I'm writing a Serial Terminal Program to test sending character commands to the Arduino. Additionally I added some buttons for a Track Number Combo Box and two command buttons for "Read Track" and "Read Disk". The last one is most important but the most difficult part is the MFM Decoder Algorithm to turn MFM data into Binary Data that can be written to a test file.
After I'm sure the subroutines all work I can focus on making the AROS version based on the new Poseidon Class Driver for the serialft232r.
miker1264Software Dev
Posted 1 year agoFor the C# SerialDiskReader GUI project for Windows 10 which is the prototype for the AROS version I've made some progress.
I can detect if a disk is inserted and I can test if it is write protected. I can check whether the disk is double density or high density. But for reading a sector I have to do more to make it work.
In order to ensure I get the correct number of bytes for the MFM encoded data I need a BlockingRead function then an MFM Decoder Algorithm to make sure the binary data is ok.
I can detect if a disk is inserted and I can test if it is write protected. I can check whether the disk is double density or high density. But for reading a sector I have to do more to make it work.
In order to ensure I get the correct number of bytes for the MFM encoded data I need a BlockingRead function then an MFM Decoder Algorithm to make sure the binary data is ok.
Edited by miker1264 on 17-10-2023 19:12, 1 year ago
AMIGASYSTEMDistro Maintainer
Posted 1 year agoGood work miker, if you are interested I have published the new AROS One v2.2 !
miker1264Software Dev
Posted 1 year agoAMIGASYSTEM
Thanks for the update about AROS One. I'll give it a try as soon as I can.
Thanks for the update about AROS One. I'll give it a try as soon as I can.
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.
Moderator: Administrator, Moderators