acemielektron / fddEMU

AVR (atmega328p) based floppy drive emulator for PC
https://acemielektronikci.blogspot.com/2021/10/fddemu-disket-surucu-emulatoru.html
GNU General Public License v3.0
145 stars 22 forks source link

Running on arduino.cc #2

Closed thiagofalencar closed 2 years ago

thiagofalencar commented 2 years ago

Hi,

I love this project and it's exactly what I was looking for several days!

I'm a newbie in this kind of thing and I'm trying to compile using Arduino.cc application using these files but I can't.

Can explain in more detail how do I can run it in windows? If is not possible to run on Arduino.cc, where do I can run?

Thank you so much!

acemielektron commented 2 years ago

Thank you for your interest in fddemu project.
Actually I started developing fddemu on Arduino platform despite the overhead caused by wiring (I had to disable timer0 interrupt used by millis() function). Unfortunately along the way I run into "relocation-truncated-to-fit r_avr_13_pcrel" error and though all my efforts to resolve the problem (yes, I tried what the forum posts said) I couldn't find a solution. On some forum (I don't remember which) I read that this error was caused by outdated avr-gcc compiler bundled with arduino IDE and I already had the latest avr-gcc on my development machine. Although fddemu can't be built with Arduino IDE for now, precompiled fddemu hex files for single and dual drive configurations are already in releases page which you can easily use to program an arduino nano/pro mini/uno or an atmega328p(@16mhz) with arduino (optiboot) bootloader. Avrdude can be downloaded from avrdude project page The latest version at the time I am writing these lines is avrdude-6.3-mingw32. After extracting the files to a convenient location such as "Desktop" try running avrdude from command prompt, if avrdude terminates with "libusb0 not found" error (that's what happened to me) you need to download libusb0 from libusb-win32 project page and you need to copy "libusb0_x86.dll" from "libusb-win32-bin-1.2.6.0/bin/x86" folder of downloaded zip file to where you extracted avrdude and rename this file to "libusb0.dll". Then for ease of use, put the hex file you want to flash in to same folder. After this the programming command in releases page work as expected: my arduino is connected to (virtual usb serial port) COM4 so the command for flashing is "avrdude -B 10 -p m328p -c arduino -P com4 -U flash:w:fddEMU-single.hex" for single drive configuration or "avrdude -B 10 -p m328p -c arduino -P com4 -U flash:w:fddEMU-dual.hex" for dual drive configuration. If you want to modify then recompile the code, avr compiler winavr could be downloaded from winavr download page (I haven't tried this). I hope this resolves the issue. Please inform me.

thiagofalencar commented 2 years ago

I managed to compile and I will burn the bootloader! Thanks a lot!

acemielektron commented 2 years ago

Arduino boards already have their bootloader programmed. You won't need to program bootloader unless you are using microcontroller (atmega328p) on custom pcb or previously overwritten the bootloader. Bootloader makes programming (flashing firmware) easier. While an atmega328p with bootloader could be programmed through its serial port, without the bootloader either spi or parallel programming and specialized programmers for these types of programming are needed. Sometimes to save flash storage space bootloader (about 2kb) is omitted and chips are directly programmed. Did you use winavr for compiling ?

acemielektron commented 2 years ago

wsl2 -> windows subsystem for linux 2. As I have never used wsl2 I am not sure. But if you are using debian, package manager should be apt. Check if you have avrdude, if not try installing by typing "apt install avrdude" or "sudo apt install avrdude" on terminal. After that you need to figure out the serial port. On linux serial ports start with tty (eg.: /dev/tty0) and usb-serial ports are either ttyUSB or ttyACM on the other hand windows shows serial ports as COM (eg.: COM3). My guess is your serial port will be listed as tty under wsl2 so type "ls /dev/tty*" before and after connecting your Arduino nano, the new tty port added to the system should be the port your Arduino is connected. Then cd into the directory where your fddEMU.hex is and use avrdude -B 10 -p m328p -c arduino -P /dev/ttyX -U flash:w:fddEMU.hex just replace /dev/ttyX with the port your nano is connected. If this doesn't work you can always try the method in my first answer (using avrdude for windows).

thiagofalencar commented 2 years ago

Great! I'll try! Thanks!

thiagofalencar commented 2 years ago

Works! The problem was 2 parameters in my case.

I needed to set the baudrate and the partno is atmega328p in my case!

I got this information uploading an example code using Arduino IDE and enabling a verbose log to see the command line parameters to use in avrdude!

Again! Thank you so much! I'll update my protoboard with all the wires and tests!

acemielektron commented 2 years ago

Congratulations. I guess documenting your modified command line here might help other users.

thiagofalencar commented 2 years ago

Of course! Now I'll test with Macintosh 512K!

acemielektron commented 2 years ago

fddEMU emulates MFM, as far as I know Macintosh 512K uses GCR and not only that also uses a complicated 19 pin interface see BMOW floppy emulator