We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: Rares Dorin Porutiu
Last Updated: 2016-02-25
Package Version: 1.0.0.3
Category: Storage
Downloaded: 1380 times
Followed by: 2 users
License: MIT license
Replacements for the libraries MMCFAT16 and MMC included in Mikropascal fo PIC 5.61
This is a BETA TEST version, please report your results - see blog
Advantages :
RMMC : SPI direct, faster approach (currently compiled for SPI1)
RMMC_FAT : FAT16 and FAT32 support, Speed, intelligent read/write cache
Do you want to subscribe in order to receive notifications regarding "RMMC_FAT , RMMC" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "RMMC_FAT , RMMC" changes.
Do you want to report abuse regarding "RMMC_FAT , RMMC".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
1350808380_rmmc_fat___rmmc_mikropascal_pic.rar [402.08KB] | mikroPascal PRO for PIC |
|
Important :
You can see there is no help or list of declaration for these libraries, because they are INCLUDED in the Mikroe HELP. The same names are used by the MMC and MMC_FAT libraries included in the compiler !!! I changed only in the Directory handling routines the NAME parameters that were declared as ^byte with var STRING, but it works with the examples in compiler's HELP.
PLEASE report your results - positive or negative - leaving a comment here or on my email or forum - to help me remove bugs or make it work for your platforms. I keep making new verions whenever bugs are fixed until it works all :) . Thank you !
I am working to boost performance of the microcontrollers.
I like to work in Mikropascal (PIC and AVR) and I like best the PIC18F97J60 and the ATMEGA644P controllers.
For PIC I have built a platfom with external 512K of static RAM and I develop without writing the Flash of the chip, that is why you will see an option in the example to compile for external RAM.
You can delete the all refference to MMC_npower if you don't have a circuit to cut the power to the MMC/SD card. I have implemented a hardware reset in case card does not respond to software reset, just to make sure I can reset the card.
Also in the example please modify MMC_chip_select and direction to your hardware configuration and select your desired baudrate.
I wrote some projects and some libraries that fill some gaps in the existing software that I have seen published.
One by one I will publish them and encourage programmers to test them an report their conclusions and wishes to me, on the forum or on my e-mails.
Published :
RMMC_FAT, RMMC
These are replacements for the libraries MMCFAT16 and MMC included in Mikropascal fo PIC 5.61
They can replace separately each of these libraries or BOTH at once.
Declaration of the exported functions is the same as in the original libraries, except a few necessary modifications that were not consistent with the examples in HELP.
Advantages :
RMMC : SPI direct, faster approach, works only at _SPI_MASTER_OSC_DIV4 after Init
RMMC_FAT : FAT16 and 32 support, Speed, intelligent read/write cache
All my libraries are written so that they don't create the GOTO table in the beginning of the code.
Preparing :
Replacement for Ethernet Internal - application Httpserver with MMC/SD card
Modbus Master-Slave
Serial Buffered Library on Interrupts with optional 485 control
Considerations while creating the RMMC_FAT:
1. When you write a software for a microcontroller that needs to access a MMC/SD card is inconvenient to limit the card to FAT16 or FAT32 and more practical to support both without adapting procedure names, compiling and flashing the chip in between. So I created routines that can work on both file systems.
2. I experimented with the FAT16 included in the compiler and found out that while reading works decently fast, writing works very slow. So I designed my routines to overcome this situation getting the best I could wthout consuming extra cache memory.
I did the following optimizations :
Read Cache - a sector that is read or written remains in the buffer and it is not read again if the sector number is identical
Write Cache - while writing in the same sector, data is written in the buffer, a flag is set that sector has been changed, but no actual writing occurs until flushSector is called. Any read of another sector calls first flushSector and does the actual writing.
FAT Cache - besides the Read and Write cache in the sectors of the FAT table I have implemented another optimization that I call : Liniar_Clusters_Ahead. Once I have the sector from a FAT table in the buffer, I test if after the cluster that has been requested are any consecutive clusters following, and if there are , I remember it in the OpenedFiles table. Result is that I reduce over 100 times the reading in the cluster area for big files, and can read them very fast. This also applies when writing in an already allocated space.
These tricks can speed up to 100x times the writing process of a file from 4 bytes chunks, as seen in the example. Take care to set the files of the original library and of the RMMC_FAT to equal sizes , and test them !