Libstock exclusive: FAT32 and Network Ethernet Libraries

General discussion on Libstock website & codes posted on this website.
Author
Message
lucaTFI
Posts: 4
Joined: 19 Jan 2012 14:46

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#31 Post by lucaTFI » 20 Sep 2012 16:24

OK, I thought you'd reconnected who I was, saw the post test that I had written on the format function is not working.
The micro is the 18F46J50 used to 8MHz

Fat32 is initialized earlier in the code, however I have found that it is a problem of the number of characters in the name of the new file. You declare standard is 8.3, but in the function "rename" you get to 7.3 and everything works. You probably have a problem in the library on the length of the file name. I wanted to tell also that the function "FAT32_WRITE" occasionally has problems and arrives to trigger the WDT, if not spaced of 100ms between the function "FAT32_EXISTS", the function "FAT32_Open" and the function "FAT32_WRITE". Please check the library, because it is very important for many projects. When do you plan to release a new version? I can possibly test a new beta version?
thanks

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

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#32 Post by Dany » 01 Oct 2012 11:12

Hi,

The possibility exists now to use the Fat32 library of mE together with the USB MSD host library (see http://www.mikroe.com/forum/viewtopic.p ... 50#p197339), making it possible to access files on a USB memory stick:

Adapted the hardware driver for the Fat32 library of MikroElektronika to be able to handle the USB stick software, see http://www.rosseeld.be/DRO/PIC/__Lib_FAT32_Driver.mpas.
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)

relinquished
Posts: 222
Joined: 09 Apr 2011 11:08
Location: ITALY / NAPOLI

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#33 Post by relinquished » 19 Dec 2012 21:55

Hi, I would like to know if there are any examples for these new libraries.

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

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#34 Post by Dany » 24 Dec 2012 14:10

relinquished wrote:Hi, I would like to know if there are any examples for these new libraries.
Examples can always be found in the "examples" directories in the libraries packages.
They can be viewed with the package manager, and after installation of the package they are to be found in
<installation directory>\Packages\<package name>\examples\
Last edited by Dany on 06 Mar 2013 18:14, 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)

carit
Posts: 41
Joined: 18 Dec 2012 13:21

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#35 Post by carit » 06 Mar 2013 15:55

Hi; mikroelektronika support team :D

I am using LV 32MX V6 development board
http://www.mikroe.com/products/view/462 ... nt-system/
and mikroC pro for pic32
FAT32 library FAT32_Seek not working

Code: Select all

#include "__Lib_FAT32.h"
sbit Mmc_Chip_Select           at LATG9_bit;  // for writing to output pin always use latch
sbit Mmc_Chip_Select_Direction at TRISG9_bit;

short fhandle;

void main() {
 TRISB=0;
 PORTB=0;
 AD1PCFG = 0xFFFF;                      // configure AN pins as digital I/O
 SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 64, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
   if (0 == FAT32_Init())
       portb=0xFFFF;
 SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 8, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
      
      fhandle = FAT32_Open("X_FILES.TXT", FILE_APPEND);
      FAT32_Write(fhandle,"mikroC PRO for pic32",21);
      fhandle = FAT32_Open("X_FILES.TXT",  FILE_APPEND);
       FAT32_Seek(fhandle, 200);
      FAT32_Write(fhandle,"Mikroelektronika development tools",34);
      FAT32_Close(fhandle);
}
created text file;

Mikroelektronika development tools

cursor not seeking
trying else code

Code: Select all

#include "__Lib_FAT32.h"
sbit Mmc_Chip_Select           at LATG9_bit;  // for writing to output pin always use latch
sbit Mmc_Chip_Select_Direction at TRISG9_bit;

short fhandle;

void main() {
 TRISB=0;
 PORTB=0;
 AD1PCFG = 0xFFFF;                      // configure AN pins as digital I/O
 SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 64, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
   if (0 == FAT32_Init())
       portb=0xFFFF;
 SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 8, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
      
      fhandle = FAT32_Open("X_FILES.TXT", FILE_APPEND);
      FAT32_Write(fhandle,"mikroC PRO for pic32",21);
       FAT32_Close(fhandle);
     fhandle = FAT32_Open("X_FILES.TXT", FILE_WRITE);
     FAT32_Seek(fhandle, 1000);
     FAT32_Close(fhandle);
       fhandle = FAT32_Open("X_FILES.TXT", FILE_APPEND);
      FAT32_Write(fhandle,"Mikroelektronika development tools",34);
      FAT32_Close(fhandle);

}
created text file;

mikroC PRO for pic32 Mikroelektronika development tools

cursor not seeking

carit
Posts: 41
Joined: 18 Dec 2012 13:21

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#36 Post by carit » 31 Mar 2013 10:18

the problem is solved thanks dejan odabasic :D :D :D

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

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#37 Post by LGR » 04 Apr 2013 16:47

Maybe this is obvious, and already in the plans, but...

You have all the elements between the Net_Ethernet and FAT32 libraries necessary for a file server. It would be nice to have this built in, so that when a properly formed GET request arrives in the Ethernet buffer, it attempts to find and send the file.

I would think that this would be easy to implement as a library routine that is called from inside of the UserTCP function.
If you know what you're doing, you're not learning anything.

sairfan1
Posts: 79
Joined: 10 Jan 2010 17:02
Location: Regina, SK.
Contact:

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#38 Post by sairfan1 » 09 Apr 2013 10:29

wow, its really very helpful, thanks to mikroe team.
irfulabs

Ing.Giovanni.Vitale
Posts: 5
Joined: 12 Mar 2014 13:02

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#39 Post by Ing.Giovanni.Vitale » 13 Mar 2014 13:36

Hello, I would like to know if they are available for the library ehternet mikromedia 5 for Tiva, and a working example. I wish I could display on the TFT screen images from an ip cam with static ip connected with a cross cable tive.
thanks for the help

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#40 Post by filip » 14 Mar 2014 09:42

Hi,

I believe we have the same correspondence via e-mail, so lets please continue there.

Regards,
Filip.

Ing.Giovanni.Vitale
Posts: 5
Joined: 12 Mar 2014 13:02

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#41 Post by Ing.Giovanni.Vitale » 17 Mar 2014 12:29

Yes, we have a correspondence via email. I was hoping that other users could help me, maybe someone managed to make something that worked with the library to tiva129. I have compiled 3 example programs, adapted to mikromedia for TIVA with its associated library, as there is a working example as for the wifi. Where is made available to the full sample WiFi_Camera. I thank the staf of Mikroelektronika, but still have not solved the problem and I have a sense of urgency to finish this work. All the examples I've changed give me the same problem, the hardware ethernet does not communicate, and do not turn on the LEDs to communicate status of the communication. I can not understand whether it is due to a programming error made ​​by me, or if you have to effetttuare the GPIO settings for which they are not aware of.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#42 Post by filip » 18 Mar 2014 13:34

Hi,

I have sent you the requested project on the e-mail, please check your inbox.

Regards,
Filip.

robfaz
Posts: 31
Joined: 26 Apr 2009 13:20
Location: Italia

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#43 Post by robfaz » 08 May 2014 15:51

Hi,
I'm using the fat32 libstock library routines to write a file on an sd card and everything is ok, but if I add in the program setting spdr for communication via spi with other devices happens that new program write operations on files are not complete and more precisely "mmc_error : = FAT32_Write (fHandle , @bufferr, 100); " Returns mmc_error = 255.
I have done numerous tests and the problem occurs after the first time after the first time you perform an assignment operation to spdr for example spdr: = c.
I attached a picture of the code.
Attachments
in this mode the runtime operation after the first write operation return error code=255.
in this mode the runtime operation after the first write operation return error code=255.
ko.JPG (35.37 KiB) Viewed 146619 times
in this mode it's all well and the program write and no errors.
in this mode it's all well and the program write and no errors.
ok.JPG (35.41 KiB) Viewed 146619 times
« Tutti gli esseri umani nascono liberi ed eguali in dignità e diritti.
Essi sono dotati di ragione e di coscienza e devono agire gli uni verso gli altri in spirito di fratellanza. »

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#44 Post by marina.petrovic » 09 May 2014 14:39

Hi,

I believe that I answered you on this question on this forum topic:
http://www.mikroe.com/forum/viewtopic.p ... 82#p237982

Best regards,
Marina

Stiive
Posts: 7
Joined: 22 Feb 2014 05:33

Re: Libstock exclusive: FAT32 and Network Ethernet Libraries

#45 Post by Stiive » 19 May 2014 03:53

Hi,
I'm having a problem with the FAT32 library on the Mikromedia plus STM32.

I am datalogging using swap files.
Once I fill up the amount of sectors available in the swap file, I create a new swap file and continue logging to the new file.

Everything works well until I have created about ~125 logs, and then the system freezes on the FAT32_MakeSwap command and the SDcard becomes corrupted.

I am using a 8Gb SD card, there is plenty of room remaining on the SD card when this happens. As a test, I have changed the amount of sectors per swap file, so the total amount of data written is very different - yet is still freezes somewhere between 123 and 126 swap log files created. I guess this removes the possibility of a bad sector causing the freeze.

When I remove the SDCard while its frozen - it then exits the MakeSwap function and returns the error -36 (file is not opened). (FYI - I open the file after the making the swap file otherwise my code doesn't work at all). Once I have removed the card after it had frozen, the data is generally corrupted and I can't see any of the swap files or they are all blank. I have assigned all my values to uint16/32, so should not be caused by an overflow, unless it is something internal to the MakeSwap function (signed short?). Sometimes, If i remove the SD card before the error, and then reset the application, it will make it to about ~255logs and then freeze (e.g logging starts at swap file number 120, then 121, 122... etc). Weird.

Any thoughts?
If this cause of this problem is unknown, it would be great if this function could include a timeout?

At the moment, I am not rewriting the file from swap to normal fat32 as I can see it fine on the PC anyway and download the data. Is there any issues with doing this?

Cheers

Post Reply

Return to “Libstock Discussion”