Writting the 256 byte Buffer to MMC- please help

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
B4rzan
Posts: 6
Joined: Mon Oct 03, 2011 10:51 am
Has thanked: 1 time

Writting the 256 byte Buffer to MMC- please help

Post by B4rzan »

I have downloaded the MMC Programming Strategy for EB037 board. I am trying to write to the mmc using the write_MMC() function but I am not getting
the correct response from the car.

can you please tell me how you use the void write_Buffer(char address, char data) to copy the 256byte from the buffer and write it onto the MMC using the write_MMC(ad1,ad2,ad3,ad4).

I am confused as how to pass the correct parameters to these two functions write_Buffer() and write_MMC() functions.

Or if possible you can share the main() function to the mmc.hex, it would be a great guide line form the users.

I would really appreciate your replies.



I have approached it as follows:

Code: Select all

void writeSample()
{
        write_Buffer(0x02,sector1);       //"0x02" is the calculated sector address. LBA * 256
        write_Buffer(0x00,sector2);
        write_Buffer(0x00,sector3);
        write_Buffer(0x00,sector4);

         retval = write_MMC(sector1,sector2,sector3,sector4);      //


      //If there is  Error
        if (retval)
        {
                //Decision
                if (retval == 0xFF)
                {
                        //512 Byte Mode Error
                        PORTB= 0b10000000; // "Write Mode Failed"

                } else {
                        //Write Error
                        PORTB= 0b01000000;  //"MMC Write Error"
                }

        } else {
                //Write Done
                PORTB= 0b00100000; //"MMC Write Done"
        }

}

I am sure I am doing something wrong in passing the parameters to the write_Buffer() function and the write_MMC() function
thank u all.

Post Reply