svofski / vector06cc

Вектор-06ц в ПЛИС / Vector-06c in FPGA
http://svofski.github.io/vector06cc/
Other
30 stars 6 forks source link

WXEDA SD Card mod #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SD card seems doesn't work (at least for me) on the WXEDA board.

1. I just soldered sd card adapter like described here: 
http://zx-pk.ru/showthread.php?t=8635&page=31
pin 1 to SD_DAT3
pin 2 to SD_CMD
pin 3 to GND
pin 4 to 3v3
pin 5 to SD_CLK
pin 6 to GND
pin 7 to SD_DAT
pin 8 - N/C
pin 9 - N/C
2. Added lines to code:
set_location_assignment PIN_3 -to SD_DAT3
set_location_assignment PIN_2 -to SD_CMD
set_location_assignment PIN_1 -to SD_CLK
set_location_assignment PIN_141 -to SD_DAT
3. Formatted SD card to fat16
4. Created a VECTOR06 directory with a few *.fdd files
5. When powering wxeda board, i see D5 and D2 blinking, while D4, D3 and D1 
continuous on.
When toggling "Scroll Lock" i see a message "INSERT CARD".
Navigation in the menu doesn't work (it always rolling back to DISK menu entry)

In the serial terminal i see just 
@                                                                             
    VECTOR-06C FPGA REPLICA                                                
(C)2008-14  VIACHESLAV SLAVINSKY@

;) Please help me debug SD card access. I have ability to use a logic analyzer 
to test SPI communications between FPGA and SD card. Probably my SD card is too 
slow or something like that.

Original issue reported on code.google.com by andy.kar...@gmail.com on 16 Aug 2014 at 10:54

GoogleCodeExporter commented 9 years ago
vector06cc.qsf already has all location assignments, you shouldn't have needed 
to add anything.

Regarding SD card, I can't be sure about what's going on, for me it worked on 
the first try. SD cards larger than 2GB are known to have problems. If yours is 
2Gb or smaller and all connections are fine, it should just work.

Original comment by svof...@gmail.com on 16 Aug 2014 at 11:04

GoogleCodeExporter commented 9 years ago
I've tried 2 different sd cards (2 and 8 Gb) - they didn't work for me.
I think pin 1 and pin 2 of my cyclone iv are probably died due to my incorrect 
first try with SD card mod.
Will try to swap them with pins 143 & 144 (both used for S-video), then will 
let you know. 

Original comment by andy.kar...@gmail.com on 17 Aug 2014 at 8:28

GoogleCodeExporter commented 9 years ago
This is strange, I hope the pins on your Cyclone are still alright. It's worth 
noting that attaching SD card the way I did is not a very good way of doing it 
because essentially they go in parallel with the resistor-diode networks that 
may affect the signals. But for me it worked so I did not have to remove any of 
the installed components or cut traces. Maybe trying to see what happens on 
those pins with a scope could shed some light on this.

S-Video pins are ok if you remove the corresponding resistor arrays, RP6 and 
RP15 if I'm not mistaken. There should be more free pins near the LEDs though, 
no? 

Original comment by svof...@gmail.com on 17 Aug 2014 at 10:19

GoogleCodeExporter commented 9 years ago
Please see attached screen from the logic analyzer.
It's seems SD_DAT pin is always high (that is strange).

Original comment by andy.kar...@gmail.com on 17 Aug 2014 at 10:53

Attachments:

GoogleCodeExporter commented 9 years ago
Yes. It's as if the card was ignoring all communications. It is unlikely, but 
could it be that there's a poor contact inside of the adapter? When I was 
making mine, I damaged one adapter by using too much heat. It deformed slightly 
and inserting/removing card was very difficult.

Original comment by svof...@gmail.com on 17 Aug 2014 at 12:50

GoogleCodeExporter commented 9 years ago
Hmm. just soldered another sd-card adapter (pcb based) - the same situation, 
card did not responded. What is the SPI clock rate used in the project ? Could 
it be too much for my sd cards?

Original comment by andy.kar...@gmail.com on 17 Aug 2014 at 1:36

GoogleCodeExporter commented 9 years ago
Maybe you are using SD-card without spi mode support? These cards working in 
other retrocomp projects with spi mode?

Original comment by ivagorRetrocomp on 17 Aug 2014 at 2:19

GoogleCodeExporter commented 9 years ago
Sure, i've even soldered a normal SD card adapter (instead of microSD) and 
tried there a 256M old school SD card that 100% works in retrocomps via SPI 
mode ;)
Also just desoldered R30/R29/R26/R25 from the pcb - no results also.
Also, as i see, there were RP11 resistor matrix (4x 330 Ohm) - all signals to 
the 7-segment indicator are going through these resistors. Could it be a 
problem ?

Original comment by andy.kar...@gmail.com on 17 Aug 2014 at 2:29

GoogleCodeExporter commented 9 years ago
It shouldn't but your setup obviously does not work so it's anyone's guess.

If I'm not mistaken, this is MISO output of SD card. Suppose it's Cyclone pin 
stuck at high level. What if you unsolder the wire from the PCB, will there be 
some signal at this output of SD card?

Original comment by svof...@gmail.com on 17 Aug 2014 at 3:49

GoogleCodeExporter commented 9 years ago
I think we have a HIGH level on MISO pin because of logic analyzer internal 
pull-ups ;)
All unused channels also HIGH by default.
With old SD card i see some responses on MISO pin, but SD card still doesn't 
work (i see INSERT CARD message in the osd menu). No ideas what's next.
I've already swapped SD_* pins with DSEN* pins, recompiles the sources, it 
still does not work for me.

Original comment by andy.kar...@gmail.com on 18 Aug 2014 at 10:12

Attachments:

GoogleCodeExporter commented 9 years ago
Could it be a problem of missing decoupling capacitors ?
People recommended to solder 0.1uF and 100uF capacitors as close as possible to 
the sd card to improve overall stability of the SD card SPI communications. 
Will try, anyway ;) 

Original comment by andy.kar...@gmail.com on 18 Aug 2014 at 10:22

GoogleCodeExporter commented 9 years ago
This board is notorious for not having any decoupling capacitors at all. Of 
course it would not hurt adding a few. Re: everything else, really can't 
recommend anything useful.

Original comment by svof...@gmail.com on 18 Aug 2014 at 10:26

GoogleCodeExporter commented 9 years ago
No luck, still :(

Original comment by andy.kar...@gmail.com on 18 Aug 2014 at 8:13

GoogleCodeExporter commented 9 years ago
I'm trying to find a way to slow down SPI, it isn't so easy as it turns out.

BTW, your second screenshot shows really strange SCK line. Or is it just a very 
small scale and each peak represents a packet of many?

Original comment by svof...@gmail.com on 18 Aug 2014 at 8:50

GoogleCodeExporter commented 9 years ago
Yes, it is a very small scale to fill all sequence of communication. Each pick 
represents a packet of clock data as well.

Original comment by andy.kar...@gmail.com on 18 Aug 2014 at 8:58

GoogleCodeExporter commented 9 years ago
Are the wires really short? At 25MHz an extra centimeter could make a 
difference.

Original comment by svof...@gmail.com on 18 Aug 2014 at 10:33

GoogleCodeExporter commented 9 years ago
I'm asking because I'm probing the signals on my board and I'm not liking what 
I'm seeing. I'd say it's a miracle that it works at all. So if your wires are 
longer compared to what you saw in my photo, maybe try making them shorter a 
bit.

Original comment by svof...@gmail.com on 18 Aug 2014 at 10:36

GoogleCodeExporter commented 9 years ago
Wires are short as possible, 1-2 cm max. 
But thanks, a good idea to check / replace them. 
I've used a tiny MGTF-2 0.03mm2 wire (like this one: 
http://www.e-voron.dp.ua/catalog/013135).
Also, is it possible somehow to decrease the spi clock from 25MHz to at least 
8MHz (or even to 400kHz) to improve stability ?

Original comment by andy.kar...@gmail.com on 19 Aug 2014 at 4:32

GoogleCodeExporter commented 9 years ago
Yeah, 1-2cm is same as mine, I don't see a problem then, though mine are 
actually fairly thick.

I'm trying to reduce SPI clock. The way it's implemented now it doesn't really 
allow that but it can be helped.

Original comment by svof...@gmail.com on 19 Aug 2014 at 4:46

GoogleCodeExporter commented 9 years ago
Try this file please, see if it works for you. The clock is divided by 4 here 
and it is the slowest I could get working. I guess slower speeds may result in 
some problems in the floppy cpu glue logic or DMA, can't be sure about that. 
But 6 MHz is practically DC :) If it doesn't work for you, it's not about the 
clock.

Original comment by svof...@gmail.com on 19 Aug 2014 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you very much, but i'm unable to try your modifications right now :( I'm 
in a business trip due to next tuesday. I hope it should/must work, finally ;)

Original comment by andy.kar...@gmail.com on 20 Aug 2014 at 6:39

GoogleCodeExporter commented 9 years ago
Just tried your improvements - it's still does not work for me.
Any ideas how to debug it properly ?
Can i put something on the usb serial port to troubleshoot SD SPI 
communications ?
AFAIK, not all SD cards supports SPI, but i've already tried 3 different cards, 
they all works nice on Speccy 2010 and UzeBox (all of them of course FAT16 
formatted).

Original comment by andy.kar...@gmail.com on 30 Aug 2014 at 8:13

GoogleCodeExporter commented 9 years ago
If you can compile the code (should be easy, see cc65-winbuild in trunk), you 
could add trace printing. MMC-realated stuff is in firmware/floppysrc/mmc.c

Original comment by svof...@gmail.com on 30 Aug 2014 at 11:31

GoogleCodeExporter commented 9 years ago
Hey, the problem has been solved magically & automatically after i did a clean 
checkout and recompile the project. So, thanks a lot for help and support, now 
i have a working Vector-06c based on WXEDA board!!! Thanks for a great project, 
this issue can be closed then.

Original comment by andy.kar...@gmail.com on 31 Aug 2014 at 6:03

GoogleCodeExporter commented 9 years ago
-HOORJ-

Original comment by svof...@gmail.com on 2 Sep 2014 at 7:58