Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
772 Views

Writing to/ Reading from SD card - LED state indicator goes out

Hi all,  

 

Sorry if I've posted this in the wrong place, I wasn't sure where it should go. 

 

I have been trying to write to an SD card using a Terasic DE3 board. I decided I wanted the design of the SD card controller to be VHDL based so I could easily incorperate it into my existing design. I started with the design by Steven Merrifield (http://stevenmerrifield.com/tools/sd.vhd). After overcoming several problems with the code and adding a sustansial amount of my own VHDL the design tends to work well. But I keep experiencing one problem that has me beat. I have the SD controller as a component in a large design, when a component is busy a flag is taken low and the top level is halted to wait for the component to do it's thing. The components like the SD card controller set a value for the LEDs in each state of their state machines and when the busy flag is low this LED value is put out to the LEDs so I can tell where it is in the design and where it gets stuck. Sometimes though when the SD controller is busy the LEDs just go off and the whole thing appears to be stuck :(. I know its in the SD card controller as I also use the 7-seg to tell me which of the busy flags are set (btw the busy flags are dealt with by if , elsif statements on the clk rising edge to give the components priority so nothing else is going on here). But if its in the SD card controller it has to be in the state machine and therefore the LEDs should be assigned a value and that should be displayed :mad: I don't understand what would make them go off??? I never set them to be off. The only idea I could come up with is if there is a clash of states or setting of the LED output value which might lead to the bits being undefined?? But I've looked through the design and I can't see that being possible anywhere. The thing is it doesn't always happen sometimes the whole design works fine, seems as though it could be realted to the compilation?? If somethings been removed during complilation (I'm using Quartus II 64 bit V12.0) then it may not behave how I expect. Looking at the registers removed and registers invertered report I can't see anything... Is there anything else thats worth checking in this area?? 

 

Thanks in advance  

 

David
0 Kudos
0 Replies