ibrahim03
Full Member level 1
I am trying to store some data in a mmc card using the ATMEGA8515L microcontroller. I studied the code from the following site :
http://www.captain.at/electronic-atmega-mmc.php
My problem is that the card initializes properly(as indicated by the LED) but the writeramtommc() method is not executed because the card gives an incorrect response to the write command.
The trouble is that I am using ATMEGA8515L instead of mega32 and it has only 512 bytes os SRAM so I cannot write a sector of 512 bytes instead I have reduced it to 256 bytes, is that ok?
Also I have some confusion about the address in the write command. Did the guy who wrote the original code give the address of 512 in the write command because he was writing a 512 byte sector ? I think it can be anything, right ?
Also there is a question about the speed of the SPI port in the original code ,when initializing the MMC to the SPI interface, the speed of the SPI was decreased( by setting the bits in SPCR register) but after initialization the speed was never increased. Should it not be increased again.
Another thing, in the 'fillram()' method in the for loop:
for (i=0;i<=512;i++)
it should be
for (i=0;i<512;i++)
because the data block is 512 bytes and not 513 bytes.
I think there really are some bugs in this code !!
http://www.captain.at/electronic-atmega-mmc.php
My problem is that the card initializes properly(as indicated by the LED) but the writeramtommc() method is not executed because the card gives an incorrect response to the write command.
The trouble is that I am using ATMEGA8515L instead of mega32 and it has only 512 bytes os SRAM so I cannot write a sector of 512 bytes instead I have reduced it to 256 bytes, is that ok?
Also I have some confusion about the address in the write command. Did the guy who wrote the original code give the address of 512 in the write command because he was writing a 512 byte sector ? I think it can be anything, right ?
Also there is a question about the speed of the SPI port in the original code ,when initializing the MMC to the SPI interface, the speed of the SPI was decreased( by setting the bits in SPCR register) but after initialization the speed was never increased. Should it not be increased again.
Another thing, in the 'fillram()' method in the for loop:
for (i=0;i<=512;i++)
it should be
for (i=0;i<512;i++)
because the data block is 512 bytes and not 513 bytes.
I think there really are some bugs in this code !!