jbilander / SDBox-Mini

SDBox Mini for Amiga, compatible with the new updated card-detect firmware
GNU General Public License v3.0
16 stars 1 forks source link

"Bad Number" issue #4

Closed youenchene closed 1 year ago

youenchene commented 1 year ago

Hi,

Tx a lot for your work.

I just solder my first SDBox Mini and trying to make it work. (rev2b)

I compiled the firmware from this source : https://github.com/jbilander/amiga-par-to-spi-adapter/blob/master/avr/main.c

I compiled it from my mac using vscode using platformio extension :

CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html PLATFORM: Atmel AVR (4.1.0) > Arduino Uno HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash DEBUG: Current (avr-stub) External (avr-stub, simavr) PACKAGES:

  • framework-arduino-avr @ 5.1.0
  • toolchain-atmelavr @ 1.70300.191015 (7.3.0) LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 5 compatible libraries Scanning dependencies... No dependencies Building in release mode Checking size .pio/build/uno/firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [ ] 0.4% (used 9 bytes from 2048 bytes) Flash: [ ] 1.4% (used 444 bytes from 32256 bytes) ============================================================================================= [SUCCESS] Took 0.57 seconds

Converted to hex :

avr-objcopy -O ihex ../.pio/build/uno/firmware.elf main.hex

And flashed the firmware :

avrdude -cttl232r -pm328p -P /dev/tty.usbserial-AB7ADN6F -v -Uflash:w:main.hex:i -Ulfuse:w:0xe6:m -Uhfuse:w:0xdf:m -Uefuse:w:0xfc:m

avrdude: Version 7.0 Copyright (c) Brian Dean, http://www.bdmicro.com/ Copyright (c) Joerg Wunsch

     System wide configuration file is "/opt/homebrew/etc/avrdude.conf"
     User configuration file is "/Users/youen/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/tty.usbserial-AB7ADN6F
     Using Programmer              : ttl232r

avrdude: ft245r_open(): no device identifier in portname, using default AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK Serial program mode : yes Parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 PollIndex : 3 PollValue : 0x53 Memory Detail :

                                       Block Poll               Page                       Polled
       Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00
       signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00

     Programmer Type : ftdi_syncbb
     Description     : FTDI TTL232R-5V with ICSP adapter
     Pin assignment  : 0..7 = DBUS0..7
       VCC     =  (not used)
       BUFF    =  (not used)
       RESET   =  0
       SCK     =  1
       MOSI    =  3
       MISO    =  2
       ERR LED =  (not used)
       RDY LED =  (not used)
       PGM LED =  (not used)
       VFY LED =  (not used)

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e950f (probably m328p) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "main.hex" avrdude: writing flash (444 bytes):

Writing | ################################################## | 100% 5.61s

avrdude: 444 bytes of flash written avrdude: verifying flash memory against main.hex:

Reading | ################################################## | 100% 5.55s

avrdude: 444 bytes of flash verified avrdude: reading input file "0xe6" avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0xe6:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse verified avrdude: reading input file "0xdf" avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written avrdude: verifying hfuse memory against 0xdf:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse verified avrdude: reading input file "0xfc" avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written avrdude: verifying efuse memory against 0xfc:

Reading | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse verified

avrdude done. Thank you.

Used the amiga.zip from there https://github.com/jbilander/SDBox-Mini/releases/download/v2a/Amiga.zip

(workbench 3.2.2)

And got the "Bad Number" error :

SD0: Bad Number (well in french on my screen)

I checked the voltage from your documentation and they are not the same (extra power supply ):

I rechecked all soldering and resistors.

Any idea to dig in?

jbilander commented 1 year ago

Hi, voltage levels are way too high. Check your power supply, try a different one. Maybe best is to take +5V from the Amigas floppy drive port pin 12.

Take the latest spisd.device from link below, also you can try with the main.hex from there but it doesn't have the activity LED blinking but should work.

https://github.com/niklasekstrom/amiga-par-to-spi-adapter/releases

Also don't forget to remove the jumper after having flashed the firmware to the ATmega328P.

youenchene commented 1 year ago

Update on voltage : I change the battery fo my voltmeter. It's the right voltage now.

youenchene commented 1 year ago

Ok, I did the test 3 times to be sure :

jbilander commented 1 year ago

Hi, probably it has to do with your compilation then because the code is identical to Niklas' repo except for driving the LED:

https://github.com/niklasekstrom/amiga-par-to-spi-adapter/commit/aeaf351bd57fc0b75dae18e1f8b91ef14cbc8c00

You can try and build using the script and the avr-gcc from Arduino IDE, like I did:

https://github.com/jbilander/SDBox-v2/blob/main/images/SDBox-v2_flashing_Nano_pic4.jpg

youenchene commented 1 year ago

Why do you not just share the compiled .hex in a release?

(And also for testing purpose, would be better to have known working .hex)

Le dim. 21 mai 2023 à 11:33, Jorgen Bilander @.***> a écrit :

Hi, probably it has to do with your compilation then because the code is identical to Niklas' repo except for driving the LED:

@.*** https://github.com/niklasekstrom/amiga-par-to-spi-adapter/commit/aeaf351bd57fc0b75dae18e1f8b91ef14cbc8c00

You can try and build using the script and the avrdude from Arduino IDE, like I did:

https://github.com/jbilander/SDBox-v2/blob/main/images/SDBox-v2_flashing_Nano_pic4.jpg

— Reply to this email directly, view it on GitHub https://github.com/jbilander/SDBox-Mini/issues/4#issuecomment-1556130854, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMIMTFOJOQE5KEINDZ52Q3XHHOORANCNFSM6AAAAAAYIS3CKY . You are receiving this because you authored the thread.Message ID: @.***>

jbilander commented 1 year ago

Because in order to flash the device you need the avr-toolchain (with avrdude) installed anyway and it's just one script to run to generate the file before flashing, pretty simple. And people expect everything to be served on a silver platter, well this is a DIY-project.

youenchene commented 1 year ago

Well I am a software developer too (more high level language).

I know it’s DIY.

I am just a « little » stubborn when there is a bug.

Here it can be :

If I can eliminate on the hypothesis (compilation tool chain) it can be great!

Le dim. 21 mai 2023 à 13:20, Jorgen Bilander @.***> a écrit :

Because in order to flash the device you need the avr-toolchain (with avrdude) installed anyway and it's just one script to run to generate the file before flashing, pretty simple. And people expect everything to be served on a silver platter, well this is a DIY-project.

— Reply to this email directly, view it on GitHub https://github.com/jbilander/SDBox-Mini/issues/4#issuecomment-1556153070, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMIMTFYPE4DJEB33XXUIGDXHH3AZANCNFSM6AAAAAAYIS3CKY . You are receiving this because you authored the thread.Message ID: @.***>

jbilander commented 1 year ago

I tried building with the latest and it generated the same hex (attached)

build main.zip

youenchene commented 1 year ago

Back,

This main.hex is working but no blinking.

We agree that the + of the LED on the bottom on the led hole? (parallel port on the top).

Le dim. 21 mai 2023 à 14:09, Jorgen Bilander @.***> a écrit :

I tried building with the latest and it generated the same hex (attached)

[image: build] https://user-images.githubusercontent.com/1673918/239739590-41ee01ac-80da-498d-8309-cb0bf68c848a.jpg main.zip https://github.com/jbilander/SDBox-Mini/files/11524517/main.zip

— Reply to this email directly, view it on GitHub https://github.com/jbilander/SDBox-Mini/issues/4#issuecomment-1556163779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMIMTHBA4ZJJP73JPSERZ3XHIAX5ANCNFSM6AAAAAAYIS3CKY . You are receiving this because you authored the thread.Message ID: @.***>

jbilander commented 1 year ago

Hi, you can look in the KiCAD...it is open source, perhaps you have accidentally put the LED with wrong orientation or the resistor is missing or too high value? Should be a 200 Ohm resistor or thereabout.

Screen Shot 2023-05-21 at 17 20 51
youenchene commented 1 year ago

150 ohm resistor and LED in the right direction (and working). I'll reinvestigate on the second one. (got 5 minimum pcb from pcbway you know.)

It's a silver version, it should work 😉

image

jbilander commented 1 year ago

Hi, try it without the shell on, it might be that the shell touches something (the LED leg) and shorts it out. I think those silver shells conducts electricity and since it grips the DB25-connector it gets grounded. Just to rule it out.

youenchene commented 1 year ago

I tested it before the shell.

The shell is just plastic.

Le dim. 21 mai 2023 à 19:29, Jorgen Bilander @.***> a écrit :

Hi, try it without the shell on, it might be that the shell touches something (the LED leg) and shorts it out. I think those silver shells conducts electricity and since it holds the DB23-connector it gets grounded. Just to rule it out.

— Reply to this email directly, view it on GitHub https://github.com/jbilander/SDBox-Mini/issues/4#issuecomment-1556233722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMIMTFY3673GVQANSYXI4LXHJGH3ANCNFSM6AAAAAAYIS3CKY . You are receiving this because you authored the thread.Message ID: @.***>

youenchene commented 1 year ago

Hi, go time to get back to the issue, now fully working with yourf firmware with the orange led blinking on sdcard activity.

The issue was ... a bad/broken 250 ohm resistor.