SD-Card Interface problems

Topics regarding the Uzebox hardware/AVCore/BaseBoard (i.e: PCB, resistors, connectors, part list, schematics, hardware issues, etc.) should go here.
User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: SD-Card Interface -- problems solved

Post by uze6666 » Fri Sep 19, 2008 4:08 am

After I put it together I can start on an Ethernet interface.
Perfect timing then. As you saw, there is none in there. I'll concentrate on making cool stuff with the SD. Along with Havoks' multi-joystick strategy/SD, we got the top 3 most wanted features covered. Very cool! :D

Uze

havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: SD-Card Interface -- problems solved

Post by havok1919 » Fri Sep 19, 2008 4:19 am

uze6666 wrote:That's *exactly* what I am experiencing! So I guess I just blew 35$ on an AVRISP :(. I tried putting pull-up on all the SPI lines, no luck, same results. It seem's like the card would need to have have it's power cut down during programming (when reset line=zero).
Well, on the bright side, you might be able to program a whole lot faster with the AVRISP. (I don't ever remember being able to program and verify a Mega644 in less than a second when using the STK500!)
Perhaps that could easily be done with a transistor or something very cheap? I'll have a try. What do you think?
You do see a lot of designs with switchable power to the card. I always figured it was for eliminating quiescent power drain, but it might also be useful for recovering 'brain-dead card'. I do kinda worry that if the card isn't powered it might try to draw power over the MOSI/SCK/CS lines and just get in an ever worse state...

See what you can come up with-- Unfortunately I'm *really* stuck for space on the AVCore board. Hmmmm... Now that having been said... The 3.3v regulator on the AVCore that would normally power the SD Card-- it has an 'enable' input. That would certainly work for a 5V design, but I was starting to warm up to a 3.3V only version. ;-) Let us know if you get it working better with switching that power line...

-Clay
Last edited by havok1919 on Fri Sep 19, 2008 6:14 am, edited 1 time in total.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: SD-Card Interface -- problems solved

Post by uze6666 » Fri Sep 19, 2008 4:39 am

Well, on the bright side, you might be able to program a whole lot faster with the AVRISP.
:P You're damn right, this thing can't go over 1.8Mhz, most probably due to the old serial interface. Now it take ~6-8 seconds to program the Megatris rom (64K)!

I'll try a few thing and let you know (keeping in mind the 3.3v goal ;) ).

Cheers,

Uze

havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: SD-Card Interface -- problems solved

Post by havok1919 » Fri Sep 19, 2008 4:51 am

uze6666 wrote: I'll try a few thing and let you know (keeping in mind the 3.3v goal ;) ).
Hah!!! :mrgreen:

So I thought about it some more and it was bugging me that the card would seem to be reacting to bus traffic when it should have been deselected...

I decided to have a look at the card select line-- it was always low. To make a long story short, on my no-frills baseboard PCB's I had a soldersplash that had shorted my SD_CS to ground. So, yes, the card was definitely responding to the ISP traffic!

Anyway, the good news. Now that I fixed that, I can leave the card in, program the '644 with ISP and as soon as the programming is done the code runs (just fine). So, it seems to be working OK at this point on the AVCore + Baseboard combo @ 3.3V (card left in while reprogramming the MCU = OK!).

-Clay

havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: SD-Card Interface -- problems solved

Post by havok1919 » Fri Sep 19, 2008 4:56 am

Oh, just a datapoint-- your tetris.hex file programming ~4MHz on the ISPMKII... Just under 2 seconds without verify!

-Clay

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: SD-Card Interface -- problems solved

Post by uze6666 » Fri Sep 19, 2008 5:10 am

I decided to have a look at the card select line-- it was always low.
Hmmm... now that you mention this, you know what? On all the freebees drivers I found, they let the CS line active forever upon initialization. Interesting. Could it be a simple software fix in this case? Another thing to try...tomorrow! :)
your tetris.hex file programming ~4MHz on the ISPMKII... Just under 2 seconds without verify!
Woa! I'll see that tomorrow too... 8-)

Uze

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: SD-Card Interface problems

Post by uze6666 » Sat Sep 20, 2008 1:05 am

Well, nothing works now with AVRISP on my prototype. I absolutely need to disconnect the ISP for the SD card to read anything. :( I really don't know what is going on if it works fine for you. I'll use plan B, a 4 pole relay to really cut the ISP off the circuit!

However it's definitively faster now!

Uze

havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: SD-Card Interface problems

Post by havok1919 » Sat Sep 20, 2008 2:25 am

uze6666 wrote:Well, nothing works now with AVRISP on my prototype. I absolutely need to disconnect the ISP for the SD card to read anything. :( I really don't know what is going on if it works fine for you. I'll use plan B, a 4 pole relay to really cut the ISP off the circuit!
Hmmmm... Have you tried a different SD card?

How do you have the signals connected to the card? (I havd SCK going through a 47ohm resistor to the SD card, but the ISP going directly to the AVR. Then MOSI goes through a 330ohm resistor to the SD card with the ISP directly to the AVR. MISO goes straight to the card and ISP. My SPI chip select also goes straight to the card.)

My microSD test pool is a little shallow compared to my SD/MMC collection, but I've tried Kingston 1G and 2G cards, Sandisk 2G, and a 'Centron' or some such gibberish no-name 2G card. All seem to work OK and all can remain plugged in while the ISPMKII programs the AVR...

I'm using AVRStudio to do the programming, not that that should matter.
However it's definitively faster now!
Well that's good at least. ;-)

-Clay

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: SD-Card Interface problems

Post by uze6666 » Sat Sep 20, 2008 5:36 am

Yep, tried two brands, same results. Now I just broke one of those playing with pull-ups, I pulled lines on 5V by mistake and the damn card is kaput! :? About resistors, where should I put them, since I have voltage dividers for the SD pins?

Before I blew up my card, I happened to just leave a ISP cable plugged in my uzebox without the other end beign connected to the programmer. And the sd read error still happened! When I remove this cable everything is ok!!! WTH? Very short one seems ok, longer one causes issues. Could it be that It catches noise or what? Seems weird indeed. For sure I have much more "mileage" of wire on by board than yours! ;) More potential cause of problems I guess. Anyhow I 'll live with it for the moment and blame the lousy wire-wrap!

Uze

havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: SD-Card Interface problems

Post by havok1919 » Sat Sep 20, 2008 7:10 am

uze6666 wrote:Yep, tried two brands, same results. Now I just broke one of those playing with pull-ups, I pulled lines on 5V by mistake and the damn card is kaput! :? About resistors, where should I put them, since I have voltage dividers for the SD pins?
I didn't really have a specific 'should go' in mind-- just looking for differences between yours and mine... On mine, the ISP goes directly to the AVR, with the resistors I mentioned before effective between the ISP leads and the card. You could also try to stick some series resistors on the ISP lines going to the AVR in your setup-- could do 100 ohm (or more) and maybe drop the ISP datarate if need be.
Before I blew up my card, I happened to just leave a ISP cable plugged in my uzebox without the other end beign connected to the programmer. And the sd read error still happened! When I remove this cable everything is ok!!! WTH? Very short one seems ok, longer one causes issues. Could it be that It catches noise or what? Seems weird indeed. For sure I have much more "mileage" of wire on by board than yours! ;) More potential cause of problems I guess. Anyhow I 'll live with it for the moment and blame the lousy wire-wrap!
Ahhh, that *is* interesting. It would seem that you've made yourself quite the antenna! Series resistors might help in that case-- the other thing to do is to literally wrap the cable in tinfoil (or copper foil) and ground that. Could also try one of those little clamp-on ferrite cores (like come with some monitor cables and USB cables) and loop the ISP cable through it once. Similarly, you could try some small caps on the SCK/MISO/MOSI lines-- maybe ~10-47pF to ground. Again, just trying to detune that antenna and damp out any ringing or funny business going on. (Might need to drop the ISP rate there too. I'd probably start with the ground/shielded cable, then try the caps to ground, then try the series resistors. If anything totally stops working, drop the datarate down to KHz range and see if you've just snubbed the "good" part of the signal too far!)

The AVCore should be really quiet compared to wire-wrap (no trace is more than about 2" long, and they're sandwitched inside three ground pours), so it probably just is line length/EMI effects.

-Clay

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests