sdspiqasm checktime question
parsko
Posts: 501
Tom,
I've hacked your sd driver to work with two SD cards on the same bus. But, I keep coming across a weird situation. Everytime I start it up fresh (after turning the power switch on), it takes me a few compiles to get it to actually start. It does not return a value, meaning it must be getting caught up in the routine, and not ending (stuck on line 57 "repeat while command"). It never sees command get written to "0" from "I". [noparse][[/noparse]note: I reference your original sdspiqasm driver for the line codes above, not my attached code!]
I think I have concluded the root cause to be the checktime routine. In my code, I have changed "clockfreq" from 80_000_000 to 80_000_000/250 (or 0.004 seconds). I gather that this may be too small. When I comment out my code to be back to your stock value of 80_000_000, it works, seemingly every time.
Is there a particular requirement in the SD protocol for the startup time to be 1 second (or something significantly higher than 0.004sec)?
I have thought about copying the parts of your code and placing them into the set_up section (which you may not recognize much anymore...), and simply living with the long startup times. Your cog has about 200 longs worth of codespace left, so this wouldn't be such a hassle. I'd simply like to understand things better.
I will gladly elaborate more upon request.
Any thoughts?
Thanks,
-Luke
I've hacked your sd driver to work with two SD cards on the same bus. But, I keep coming across a weird situation. Everytime I start it up fresh (after turning the power switch on), it takes me a few compiles to get it to actually start. It does not return a value, meaning it must be getting caught up in the routine, and not ending (stuck on line 57 "repeat while command"). It never sees command get written to "0" from "I". [noparse][[/noparse]note: I reference your original sdspiqasm driver for the line codes above, not my attached code!]
I think I have concluded the root cause to be the checktime routine. In my code, I have changed "clockfreq" from 80_000_000 to 80_000_000/250 (or 0.004 seconds). I gather that this may be too small. When I comment out my code to be back to your stock value of 80_000_000, it works, seemingly every time.
Is there a particular requirement in the SD protocol for the startup time to be 1 second (or something significantly higher than 0.004sec)?
I have thought about copying the parts of your code and placing them into the set_up section (which you may not recognize much anymore...), and simply living with the long startup times. Your cog has about 200 longs worth of codespace left, so this wouldn't be such a hassle. I'd simply like to understand things better.
I will gladly elaborate more upon request.
Any thoughts?
Thanks,
-Luke
Comments
up to a substantial fraction of a second. (This is my understanding anyway.) In particular, initialization may be quite slow.
If the problem you're trying to solve is slow startup, it is *possible* (though, perhaps, difficult) to start multiple cards in
parallel. Best would be to start the cards on boot or on insertion (if you want to support hot swap; note for this that there
are some power issues you'll have to address, and you'll need to detect insertion events).
Elaborate away. How slow are the startup times? The slowness should be coming from the cards and only the cards; you can
scope it and see, or you can add some logging (if the duration is > 0.1 second log that in a var, and check for a nonzero in
that var after every event).
I'm always happy to help but there may be little I can do. Certainly a timeout of 0.004 seconds will absolutely not work for
SD cards in general, not for startup, not for writes, and probably not even for reads.
Best email address for me is my username at gmail.
-tom