Hi, I just started using MMC/SD and I notices something in the help:
In the helptext for the MMC libary there is a code example (program "MMC_Test") at the end of it. I have a few remarks about that:
1. The variable "SectorNo" is never initialised before it is used, perhaps this can be corrected in the help? Thanks in advance.
2. I had to (with a 2GB SD card from EMTEC, speed upto 60x) use the following SPI initialisation:
Code: Select all
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_LOW_2_HIGH);
Code: Select all
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV16, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
The only thing I had to change was "_SPI_CLK_IDLE_LOW" into "_SPI_CLK_IDLE_HIGH".
As you can see I can even use the highest clock frequency (...DIV4 with a 40Mhz CPU clock speed) with this new setting.
I work with the "MMC/SD CARD Proto".
Addendum: apparently setting AN4 to digital causes this problem if the AN4 pin (= RA5) is not set to output or is floating as input. Thanks yo2lio for the solution. So: "_SPI_CLK_IDLE_LOW" is OK provided AN4(RA5) is not floating.
3. The type of parameter for procedure "UART_Write_Line" should be (I think) "var uart_text : array[255] of byte" (or "var uart_text : string[255]"), the same as for routine "UART1_Write_Text", now it is simply a byte var parameter.
Code: Select all
procedure UART_Write_Line( var uart_text : byte ); // <----
begin
UART1_Write_Text(uart_text); // <----
...
Then a few remarks on the help content itself:
4. In mmc_init the help says:
The parameters (of the function) are not there. In stead global variables are used.Parameters:
port: chip select signal port address.
cspin: chip select pin.
Fixed in v2.50
5. In mmc_read_sector the help says:
The "data" parameter has an other name in the prototype (same in mmc_write_sector also).Parameters:
sector: MMC/SD card sector to be read.
data: buffer of minimum 512 bytes in length for data storage.
Fixed in v2.50
6. In mmc_fat_quickformat the help says:
Port and Pin are no longer there, they have been replaced by global variables.Parameters:
port: chip select signal port address.
pin: chip select pin.
mmc_fat_label:
Fixed in v2.50
Keep up the good work!
Thanks for the corrections done in v2.50!