SD/MMC memory

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

Post Reply
Kumaran
Posts: 73
Joined: Tue Apr 08, 2008 5:23 pm
Been thanked: 1 time
Contact:

SD/MMC memory

Post by Kumaran »

How to program for SD/MMC memory using flowcode? any examples are their?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD/MMC memory

Post by Benj »

Hello

There is a beta version of the FAT driver for the MMC and SD cards available from here.

http://www.matrixmultimedia.com/Flowcode_Components.php

Kumaran
Posts: 73
Joined: Tue Apr 08, 2008 5:23 pm
Been thanked: 1 time
Contact:

Re: SD/MMC memory

Post by Kumaran »

I have downloaded the beta component. It is configured for PIC18445 circuit. How to configure it for other circuits? I am using the sample circuit provided in proteus.
The circuit bitmap is attached
Attachments
massstoragedevice.pdf
(19.55 KiB) Downloaded 581 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD/MMC memory

Post by Benj »

Hello

The SD/MMC pin connections are defined inside the properties of the custom component. The target chip can be changed by going to Chip -> Target.

I have attached the latest version of the custom component code file as I have removed a couple of minor bugs that occur when dealing with larger files. This will be available from the FAT16 beta component download on Monday 2nd June.
Attachments
Custom_Code.c
(38.6 KiB) Downloaded 474 times

Kumaran
Posts: 73
Joined: Tue Apr 08, 2008 5:23 pm
Been thanked: 1 time
Contact:

Re: SD/MMC memory

Post by Kumaran »

I got struck, When I tried to change the connections for the microchip AN circuit. In that circuit MMC is connected to portb & C. but in the custom component I could configure only one port. how to sort out this issue. One more thing is when I run the beta fat16 component example create.fcf, the simulation mode shows it created the file. but actual hard disk I could not find the file.

Could you please help me to program for the attached circuit in the earlier post?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD/MMC memory

Post by Benj »

Hello

Currently the custom component supports only one port. It is bit banged so you can use any pins you like as long as they are all on the same port. It should be a fairly simple task to modify the C driver file to use a second port and tris. If you need help doing this then let me know as its probably nothing of a job. If you can change the hardware to a single port then no edits are required.

Currently there is no simulation for the FAT16 component so this is the reason you are not finding files. We are still unsure as whether this will require doing. Therefore if anyone out there wants simulation of a FAT16 mmc/sd card then drop us a post.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD/MMC memory

Post by Benj »

Hello

I have made the edits to the code file and attached to this post for reference.

Here are the new definitions.

//Flowcode Defines
#define MX_CARD_PORT portb
#define MX_CARD_TRIS trisb
#define MX_CARD_CS 3
#define MX_CARD_SCK 1
#define MX_CARD_SDI 0
#define MX_CARD_SDO 7
#define MX_CARD_PORT2 portc
#define MX_CARD_TRIS2 trisc

Also note that the custom component properties will not be used for these details. The last 2 properties (creation date and time) from the example files will still be needed.

You will need to rename the attached file to Custom_Code.c and then drop into your component directory.

Any problems or queries then let me know.
Attachments
Custom_Code_Hardwired.c
(38.67 KiB) Downloaded 454 times

Kumaran
Posts: 73
Joined: Tue Apr 08, 2008 5:23 pm
Been thanked: 1 time
Contact:

Re: SD/MMC memory

Post by Kumaran »

I have tried with your last post custom component.c, Now I could simulate micro chip AN circuit in Proteus. But it is not complete I have experienced following things

1. In Proteus simulation all the time I am getting file exists output in LCD. In Flow code I have not got this message at any simulation
2. In flow code simulation, most of the time file is getting created. Sometimes it is just running the while loop continuously with the message of "waiting for card".
3. It would be great if MMC/SD card is also be simulated and if provided with the example of microchip AN. So that using flow code the single device can be programed as a USB mass storage device, as a general memory feature in stand alone operation and both togather.


Thank you

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD/MMC memory

Post by Benj »

Hello

The simulation could be a possibility but for now there is no simulation of the FAT16 at all. This is why the program is saying waiting for card etc. It is just following the variables that are returned. Since it cannot simulate these variable operations the variables are returning uninitialized and this is why your simulation is doing odd things.

Proteus uses a bottom up approach to the simulation. Eg the simulation is actually running a PIC core on your PC. This is why this will simulate better. However this also will have its limits. This cannot currently be done with Flowcode as it would be a monumental task to develop cores for all of the supported microcontroller targets. The best way to test the software is to use the actual hardware.

Kumaran
Posts: 73
Joined: Tue Apr 08, 2008 5:23 pm
Been thanked: 1 time
Contact:

Re: SD/MMC memory

Post by Kumaran »

Hello

As you said, I will try programing the hardware then post the observations.

Thanks

manish12
Posts: 2
Joined: Tue Jan 20, 2009 10:59 am
Contact:

Re: SD/MMC memory

Post by manish12 »

did any one test the fat16 comp,
if so , plz give some information about the hw , such as chip number , xtal,etc.

i hope at last fc give full mmc access.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD/MMC memory

Post by Benj »

Hello

Yes the code was tested. I have made a few wav streaming examples as well as some data logging examples. The chip type and clock speed are not important as the FAT16 component will work all this out for you. The only thing you do have to ensure is that the card is formatted with FAT type file system and not FAT32. See these article for more information on the SD and MMC card reader examples.

Datalogger example
http://www.matrixmultimedia.com/mmforum ... =26&t=4794

Wav streaming example
http://www.matrixmultimedia.com/mmforum ... =26&t=4850

Post Reply