FAT32 library for MMC/SD cards

Discuss with MikroElektronika software developers about current library development.
Author
Message
User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: FAT32 library for MMC/SD cards

#46 Post by janko.kaljevic » 06 Dec 2012 13:20

Hello,

I was unable to reproduce the same compiling errors from the first picture on mikroBasci PRO for dsPIC v5.7.0
I confirm that I used Fat32_1.mcl and Fat32_2.mcl files from Dany's post above and StrngUtils.mcl downloaded from here:
http://www.libstock.com/projects/view/39/utilities

Errors from second picture I was able to reproduce only with SSA disabled, which is expected if Dany have built the library with SSA on.

Best regards.
Attachments
FAT32.JPG
FAT32.JPG (122.62 KiB) Viewed 14798 times

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: FAT32 library for MMC/SD cards

#47 Post by janko.kaljevic » 06 Dec 2012 13:21

Hello,

We'll contact Dany with this idea. He is a dedicated contributor, and we think that entire community may benefit of this. (of course Dany would have a lot more coding to do, to fulfill your expectations :) )

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: FAT32 library for MMC/SD cards

#48 Post by Dany » 06 Dec 2012 13:54

janko.kaljevic wrote:Hello,

I was unable to reproduce the same compiling errors from the first picture on mikroBasci PRO for dsPIC v5.7.0
I confirm that I used Fat32_1.mcl and Fat32_2.mcl files from Dany's post above and StrngUtils.mcl downloaded from here:
http://www.libstock.com/projects/view/39/utilities

Errors from second picture I was able to reproduce only with SSA disabled, which is expected if Dany have built the library with SSA on.

Best regards.
I discovered that Fat32_2 and StrngUtils were build with SSA off...

That seemed to be the reason of the problem: I get no "call signature" errors any more with attached versions of Fat32_1, Fat32_2 and StrngUtils, all build with SSA on. :D :D

In the mean time the my libraries in LibStock and on my website are updated. With my excuses for the inconvenience.. :oops:
Attachments
StrngUtils.zip
Library is built with SSA on
(61.11 KiB) Downloaded 469 times
Fat32_2.zip
Library is built with SSA on
(82.78 KiB) Downloaded 465 times
Fat32_1.zip
Library is built with SSA on
(77.66 KiB) Downloaded 475 times
Last edited by Dany on 07 Dec 2012 13:56, edited 2 times in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: FAT32 library for MMC/SD cards

#49 Post by Dany » 06 Dec 2012 14:05

janko.kaljevic wrote:Hello,

We'll contact Dany with this idea. He is a dedicated contributor, and we think that entire community may benefit of this. (of course Dany would have a lot more coding to do, to fulfill your expectations :) )
I feel honored. :oops:

I must admit however that I am not capable of translating projects/libraries written in one language to another one.
This would be relatively easy for mP <-> mB, but impossible for me if mC comes into focus... So I must disappoint you there, I am a Pascal user and I will always be one.

The only thing I could do extra then (using the proposed licenced compilers) is testing if e.g. libraries written in mP are also usable in mP or mC, if I can translate e.g. the mP testcases to e.g. mB.

Serkansatuk (http://www.mikroe.com/forum/viewtopic.php?f=146&t=51768) proposed to develop a tool for source code translation. This would be of course THE solution... :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

serkansatuk
Posts: 38
Joined: 31 May 2012 07:05

Re: FAT32 library for MMC/SD cards

#50 Post by serkansatuk » 06 Dec 2012 19:25

Thanks for your interest.
I disabled and enabled the SSA optimization, and the project has been compiled successfully.
Is this a bug for the compiler ???

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Re: FAT32 library for MMC/SD cards

#51 Post by LGR » 06 Dec 2012 20:04

I know how you feel, Dany. I'd rather crawl over broken glass than program in C, or any of it's derivatives such as Java. I had to do some Java programming for an Android app, and it was agony. If a modern OO language is needed, my first choice is Lazarus/Freepascal (very similar to Delphi), and second choice is Python.

After I finished, I learned that there's an excellent BASIC for Android called ... basic4android. :evil:
If you know what you're doing, you're not learning anything.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: FAT32 library for MMC/SD cards

#52 Post by Dany » 07 Dec 2012 13:01

serkansatuk wrote:Is this a bug for the compiler ???
No, it is'nt. It was my mistake :oops: , libraries should be compiled with SSA on. I will update the libstock content as soon as possible... (done on 2012-12-07)
I am happy the idea of the mP libs usage possibility in mB still holds... :D
Last edited by Dany on 07 Dec 2012 13:54, edited 1 time in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: FAT32 library for MMC/SD cards

#53 Post by Dany » 07 Dec 2012 13:03

LGR wrote:I'd rather crawl over broken glass than program in C, or any of it's derivatives such as Java.
:lol: :lol:
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: FAT32 library for MMC/SD cards

#54 Post by janko.kaljevic » 07 Dec 2012 15:12

Hello,

mB and mP are very compatible and the library built in one will work perfectly fine in other.
There should be no issues at all.

Also there is a great level of compatibility with C too. If user takes care about some C specific stuff and libraries (like string) it will work fine in all three compilers.

Best regards.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: FAT32 library for MMC/SD cards

#55 Post by Dany » 07 Dec 2012 18:07

janko.kaljevic wrote:Hello,

mB and mP are very compatible and the library built in one will work perfectly fine in other.
There should be no issues at all.

Also there is a great level of compatibility with C too. If user takes care about some C specific stuff and libraries (like string) it will work fine in all three compilers.

Best regards.
Nice! :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

borris
Posts: 219
Joined: 22 Aug 2011 07:13

Re: FAT32 library for MMC/SD cards

#56 Post by borris » 14 Dec 2012 08:31

Possibly a silly question but, do I need to re-initialize the FAT32_Init() function after removal and re-insertion of a SD card?

For instance: I have an interrupt listening when a card is removed or inserted. I have it running the init() function again and have found that everything is working, but, is that totally necessary?

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: FAT32 library for MMC/SD cards

#57 Post by dejan.odabasic » 14 Dec 2012 11:32

Hello,

Yes, you need to call FAT32_Init() when you swap the MMC cards.
Help file wrote:Initializes the storage device, reads FAT32 boot sector and extract necessary file system data required by the library.
Best regards.

borris
Posts: 219
Joined: 22 Aug 2011 07:13

Re: FAT32 library for MMC/SD cards

#58 Post by borris » 04 Jan 2013 09:32

Ok, have another question that might seem silly.

Once I assign a file handle to a file and open it. If I change directories, do I have to go back to that directory to close it?

If this is the case, is there anywhere in the library that the directory is stored for me?

I am also keeping the file handle as part of a struct that is holding all my socket data:

Code: Select all

struct webSocket_desc{
     SOCKET_28j60_Dsc *socket;     /*!< Socket for TCP connection */
     char mark;                    /*!< Mark if socket is in use or free */
     unsigned long position;       /*!< Position of where in the packet it has transmitted */
     char fileName[COMMANDSIZE];   /*!< The file name associated with the socket */
     short fileHandle;             /*!< Filehandle of the file used by FAT32 */
     unsigned long fileSize;       /*!< The file size in bytes */
     unsigned char buffer[DATABUFFERSIZE];  /*!< Buffer for reading from the file and ready to send */
     unsigned int bufPos;          /*!< Where in the buffer has it sent, when at the end, time for recharge if not EOF */
};
Another question: Is FAT32_Read a blocking function? Should I allow for time to "read" data into the buffer?

It would be neat if I could read the size of the buffer free on the Ethernet library and use it as my buffer that the FAT32_Read transfers data into directly instead of having 2 buffers...

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: FAT32 library for MMC/SD cards

#59 Post by dejan.odabasic » 10 Jan 2013 13:18

Hello,
borris wrote:Once I assign a file handle to a file and open it. If I change directories, do I have to go back to that directory to close it?
No you don't, file handler doesn't depend on "your" position in folder tree.
borris wrote:Is FAT32_Read a blocking function? Should I allow for time to "read" data into the buffer?
FAT32_Read function is blocking function, after the buffer is filled/data read, the application continues with execution (no need for delay after calling FAT32_Read).

Best regards.

juliozv
Posts: 20
Joined: 07 Nov 2010 18:28
Location: Mexico
Contact:

Re: FAT32 library for MMC/SD cards

#60 Post by juliozv » 20 May 2013 18:06

Hi,

I read the Mmc_Fat library but I don't understand well the next routine:

Mmc_Fat_Assing( filename , file_cre_attr)

in the part the "file_cre_attr" how is the configuraion of bits? in the example of mikroE has 0xA0 but I don't understand where this value.

thanks for your time..
JulioZV

PD. sorry for my english.

Post Reply

Return to “Library Development Discussion”