Page 1 of 1
MMC Eblock, only with MMC or also with SD?
Posted: Fri Oct 29, 2010 2:21 pm
by MJU
I bought the Eblock Card Reader board, but it seems that the MMC cards are not easy to get.
Someone told me that a SD (Secure Digital) card is the same for this purpose.
Is this true?
I haven't had the time to look into this, but maybe some here can help me.
Re: MMC Eblock, only with MMC or also with SD?
Posted: Fri Oct 29, 2010 2:30 pm
by Benj
Hello,
SD cards work fine as long as they have an embedded SPI interface and have a sector size of 512 bytes. I think all new SD cards have to stick to this specification but older cards may vary a bit.
This topic may also be of interest.
http://www.matrixmultimedia.com/mmforum ... =29&t=7461
Re: MMC Eblock, only with MMC or also with SD?
Posted: Fri Oct 29, 2010 3:42 pm
by MJU
Benj wrote:Hello,
SD cards work fine as long as they have an embedded SPI interface and have a sector size of 512 bytes. I think all new SD cards have to stick to this specification but older cards may vary a bit.
This topic may also be of interest.
http://www.matrixmultimedia.com/mmforum ... =29&t=7461
Thank you very much BenJ!
Maybe a good time to change the datasheet for this board with this information.
The link to the MMC specs on the datasheet for the card reader board doesn't exist anymore.
Thanks
Re: MMC Eblock, only with MMC or also with SD?
Posted: Mon Nov 01, 2010 10:30 am
by Benj
Hello,
Thanks for your comments. I have now updated the datasheet with some more relative information.
http://www.matrixmultimedia.com/datashe ... 7-30-1.pdf
Re: MMC Eblock, only with MMC or also with SD?
Posted: Sun Mar 20, 2011 9:47 pm
by JohnCrow
I bought a couple of cards from Matrix when I bought the card reader, these work fine.
Sandisk 2GB class 2
I also got a couple of cards from the local camera shop.
Panasonic 2GB class 4
Although these have a 512 sector size they are not recognised by the reader.
I Believe the class is to do with the speed of the card.
The local computer shop only has class 6 cards. Class 2 seem to be getting rare.
Re: MMC Eblock, only with MMC or also with SD?
Posted: Mon Mar 21, 2011 11:28 am
by Benj
Hello John,
When you use the newer cards what happens? Are they simply not recognised or does the initialise function lock up?
Re: MMC Eblock, only with MMC or also with SD?
Posted: Mon Mar 21, 2011 9:04 pm
by JohnCrow
Hi Ben
Using the GPS Tracker program off the forum
With the cards I bought from you it works fine
Waiting for card
Plug in card - Card ok
File open
Writing header
The date is stored correctly
Using the Panasonic class 4 cards
It wont detect the card, just keeps showing waiting for card
Looks like these cards are not compatible.
Apologies if I have double posted, the first time I sent this it didn't seem to upload.
Re: MMC Eblock, only with MMC or also with SD?
Posted: Tue Mar 22, 2011 10:58 am
by Benj
Hello,
I've had a bit of a dig around and can't seem to find any reasons for the class 4 cards not to work correctly.
The init macro returns a number which must be 0 for the program to continue to the "File Open" stage. Any chance you can send the return number to the LCD so we can tell where the init routine is bailing out on the class 4 cards?
Re: MMC Eblock, only with MMC or also with SD?
Posted: Tue Mar 22, 2011 8:17 pm
by JohnCrow
Hi Ben
Thanks for having a look at this problem
As you say, the sandisk cards return a 0 when the init macro is called
The panasonic return 254
with no card in the reader it returns 255
Hardware Setup
Card reader is on port A
LCD is on port B
Using an ECIO40 on the base board
All settings to default
Flowcode version 4.3.7.63
Windows 7 x64
Re: MMC Eblock, only with MMC or also with SD?
Posted: Wed Mar 23, 2011 11:19 am
by Benj
Hello,
Ok thanks for getting back with the info,
255 - is the no card error so this is working ok.
254 - is the no response from card error.
This is the routine for trying to get the card to respond, there are 512 attempts to start-up the card before the routine bails out.
Code: Select all
//Command 1 - Send Operating Condition - Reports the status of the card
i = 512;
while ((RetVal != 0) && (i)) //Loop while processing command 1
{
i = i - 1;
set_bit(MX_CARD_PORT, MX_CARD_CS); //CARD-Disabled
MX_SPI_BYTE(0xFF);
MX_SPI_BYTE(0xFF);
clear_bit(MX_CARD_PORT, MX_CARD_CS);//CARD-Enabled - Command 0 complete
MX_SPI_BYTE(0x41); //Send Command 1
MX_SPI_BYTE(0x00); //Arg3
MX_SPI_BYTE(0x00); //Arg2
MX_SPI_BYTE(0x00); //Arg1
MX_SPI_BYTE(0x00); //Arg0
MX_SPI_BYTE(0xFF); //CRC
MX_SPI_BYTE(0xFF);
RetVal = MX_SPI_BYTE(0xFF); //Check Response
}
set_bit(MX_CARD_PORT, MX_CARD_CS); //CARD-Disabled
if (i == 0)
return MX_ERR_NORESP; //Card not responding
This code is in the Init Card macro. So using code customization you should be able to modify the function to get it working.
One thing I found regarding this is to simply send the command out once and then poll for the return.
Code: Select all
//Command 1 - Send Operating Condition - Reports the status of the card
i = 512;
set_bit(MX_CARD_PORT, MX_CARD_CS); //CARD-Disabled
MX_SPI_BYTE(0xFF);
MX_SPI_BYTE(0xFF);
clear_bit(MX_CARD_PORT, MX_CARD_CS);//CARD-Enabled - Command 0 complete
MX_SPI_BYTE(0x41); //Send Command 1
MX_SPI_BYTE(0x00); //Arg3
MX_SPI_BYTE(0x00); //Arg2
MX_SPI_BYTE(0x00); //Arg1
MX_SPI_BYTE(0x00); //Arg0
MX_SPI_BYTE(0xFF); //CRC
MX_SPI_BYTE(0xFF);
while ((RetVal != 0) && (i)) //Loop while processing command 1
{
i = i - 1;
RetVal = MX_SPI_BYTE(0xFF); //Check Response
}
set_bit(MX_CARD_PORT, MX_CARD_CS); //CARD-Disabled
if (i == 0)
return MX_ERR_NORESP; //Card not responding
Another things would be to try and slow down the speed of the SPI bus by inserting delays into the MX_SPI_BYTE macro. Seems odd that a class 2 card would be faster then a class 4 though.
Let me know if you have any problems getting this to work and if it does work with your class 4 card.
Re: MMC Eblock, only with MMC or also with SD?
Posted: Wed Mar 23, 2011 8:56 pm
by JohnCrow
Hi Ben
Changing the Init card macro actually made things worse, the system didnt work with the class 2 cards either
So I tried your other suggustion of inserting a delay in the MX_SPI_BYTE macro
There is actually a 1us delay in that code already , so i tried increasing it. 10us was found to work
The system will now read both types of card.
Tried the Matrix GPS logger and the excel file is written to the card correctly as well.
I'll see if I can get hold of a class 6 card see if it works at this setting or if it needs a bigger delay)
It seems that the change is only for the actual flowcode program I'm working on, when I load another program I have to change it again?
I examined the FAT16 component and changed the delay statement in there. All seems to be working.
Many thanks for the help
Re: MMC Eblock, only with MMC or also with SD?
Posted: Fri Mar 25, 2011 12:55 pm
by Benj
Hello,
Good work, glad its working correctly for you now. Who would have thought a higher class card would require slower communications.
Thanks for letting us know.
It seems that the change is only for the actual flowcode program I'm working on, when I load another program I have to change it again?
Yes using code customization you would have to do this to every program.
I think you have already found the fix for this but I'll say for anyone else having problems. To permanently fix this in the component you would just have to edit the component C file in the "Prog Files/Matrix Multimedia/Flowcode vx/Components" directory. You may want to make a backup of the C file first so you can go back to a clean copy if you ever need to go back to the default component.