[En-Nut-Discussion] Ethernut 3 PHAT MMC Card solved

ml mludwig at adc-elektronik.de
Mon Aug 18 17:47:51 CEST 2008


Deja Vu,

and again it doesn´t work. I don´t now how it run´s last time but now with
ise 9.204 and above (aktual 10.1)  it couldn´t run. May be it depends on the
phase of the moon or so. 
The _open function fails because of the cpld. It always produce a stable,
never ending mclk signal instead of an 8 clock burst. 
after some testing is think that the cpld compiler may have a problem with
this code

==>       if (mmc_creg <  8) begin
                mmc_sreg <= {mmc_sreg[6:0], MDAT0};
==>           mmc_creg = mmc_creg + 1;
                if (mmc_creg == 7) begin
                    mmc_ireg = 1;
                end
            end

i decide to get an extra register for signaling the end of the 8 clock´s.
looking to the code i found  

//    reg MMC_CLK_DIS;

someone (Harald ?) walked this way before ?
so i use this reg and change the code to


    always @(posedge mmc_coreg or negedge mmc_nwe) begin
        if (mmc_nwe == 0) begin
            // NRESET MMC Register wird auf 0 gesetzt mmc_creg wird auf 8
gesetzt damit der MMC_CLK gestopt wird
            if(NRESET == 0) begin
                mmc_sreg <= 8'h00;
//                mmc_creg <= 8;
                MMC_CLK_DIS <=1;
                mmc_ireg <= 0;
            end
            // NWE Daten werden in's reg_MMC geschrieben mmc_creg wird auf 0
gesetzt  MMC_CLK wird aktiviert
            else 
            begin
                mmc_sreg <= D;
                MMC_CLK_DIS <=0;
                mmc_creg <= 0;
                mmc_ireg <= 0;
            end
        end
        // Daten werden von der MMC in reg_MMC geschrieben
        else if (mmc_coreg == 1) begin
            if (MMC_CLK_DIS == 0) begin
                mmc_sreg <= {mmc_sreg[6:0], MDAT0};
                mmc_creg <= mmc_creg + 1; 
                if (mmc_creg == 7) begin
                    mmc_ireg <= 1;
                end
                if (mmc_creg == 7) begin
                    MMC_CLK_DIS <= 1;
                end
            end
        end
    end

    // MMC Clock
    always @(negedge PLCLK1) begin
        if ((MMC_CLK_DIS == 0) & (mmc_nwe == 1)) begin
            mmc_coreg <= mmc_coreg + 1; 
        end
        else begin
            mmc_coreg <= 1;
        end
    end

    // MMC Schreiben
    always @(negedge mmc_coreg) begin
        if (MMC_CLK_DIS == 0) begin
            mmc_doreg = mmc_sreg[7];
        end
    end
    
    assign MCMD = mmc_doreg;
    assign MCLK = mmc_coreg;


with this code the mmc works with every version of ise. May be there is any
cpld-magician who can explain that thing. i can´t, but im realy happy that
it works. 
I´m wondering what happens with MMC_CLK_DIS. 

martin




Harald Kipp wrote:
> 
> ml wrote:
>> Harald,
>> 
>> my ISE Version is 9.2.04i. I´ve downloaded it yesterday and it updates
>> itself from the web to
>> this version. i try it yet with the original npl30e.v instead of my own
>> enhanced version and it
>> works very well with the cpld.
> 
> 
> Unfortunately no luck. I used the npl30e.v and npl30e.ucf from
> enut30npl-20071207.zip
> 
> With ISE 9.2.04i the mount fails. When switching back to 7.1.04i, it
> works.
> 
> I also get a couple of warnings in xst.log, but they appear in both 
> release. (Except the use_dps48 warning in 9.2, but that seems to be a 
> well known bug of that release.)
> 
> I modified the Makefiles, so I can use 'make burn' with Turtelizer 2. 
> May be I should compare these changes.
> 
> Harald
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> 
> 

-- 
View this message in context: http://www.nabble.com/Ethernut-3-PHAT-MMC-Card-tp15720204p19034398.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.




More information about the En-Nut-Discussion mailing list