CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Filesystem PIC24 using SPI

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SergioMForster



Joined: 23 Jan 2019
Posts: 29
Location: Argentina

View user's profile Send private message

Filesystem PIC24 using SPI
PostPosted: Thu Dec 19, 2019 8:27 pm     Reply with quote

For a development that I am doing with PIC24EP512, I need to incorporate an SD memory, of the current ones in the market (4 to 64 GB SLC) , to exchange files with Windows PCs using an SPI port.

I would like to know the opinions of the forum of which of the filesystem mentioned below would be the most suitable for this case, or perhaps some recommendation of a purchased solution.

It is a logger type application that stores data in files (not many files whose maximum size I don't think exceed 10 mb each).

The microprocessor should also be able to read data and configuration files written by a Windows PC.

To take advantage of the size of the SD the filesystem it should be FAT32, it would be better if the library allows to use long filenames although it is not mandatory.

What is essential is that this library will be robust since it is an unattended equipment.

I was reading in the forum several interesting contributions about filesystem like the following (although I haven't tried any yet).


From Tomi http://www.ccsinfo.com/forum/viewtopic.php?t=23969&highlight=filesystem

From electr0dave http://www.ccsinfo.com/forum/viewtopic.php?t=53787&highlight=filesystem

From Miniman http://www.ccsinfo.com/forum/viewtopic.php?t=31532&highlight=filesystem

I have also seen a fchio.c Microchip library.

I also found a commercial solution of ElectroBrush.

I will thank you for giving me your opinion which would be the most appropriate in this case.

Thanks for your help.
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 2:56 am     Reply with quote

To go over 32GB on an SD, the driver needs to support ExFAT, not just FAT32.
Don't use long file names. This adds size/complexity, and runs into legality
issues with the MicroSoft patent on the system handling these.
Basically MS tried to patent both Fat32, and the LFN handling. However
the courts decided that Fat32 was a derivative of existing technologies
so couldn't be patented, but the LFN handling could.

The Brush Electronics drivers are very good. The author posts here
and will help you to get the code working.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 5:58 am     Reply with quote

Years ago I built a 'greenhouse data logger' and used a 'Vinculum' device which allows any size USB flashdrive to connect to a PIC serial port. Back then the hardware was about $40(?), maybe 2-3X SD 'parts'. While more money the pluses were:
0) premade hardware,no lost time design/build/rework HW.
1) worked right out ot the box, NO time spent cutting/testing interface code.
2) NO driver so more codespace for main().
3) every PC has a USB port, not all have SD readers.
4) it always worked as expected, test ran continuously for 3 years.
5) during testing, the data was sent to PC using same serial pins.

As far as data storage, I formatted the data (date, time, temps, humid, solar, etc.) into .CSV format. This 'Comma Separated Variables' is used by Excel spreadsheet program to import data files INSTANTLY into a spreadsheet. While this took more space in the Flashdrive, gee, flashdrives can hold TONS of data !
SergioMForster



Joined: 23 Jan 2019
Posts: 29
Location: Argentina

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 7:38 am     Reply with quote

Thank you very much Ttelmah for your response, always collaborating with your wise opinions

It would not be a problem to limit the maximum volume size to 32 Gb, so as not to leave the FAT32 standard, Nor would it be a problem to use the 8.3 standard

Given this, what is your opinion about the different driver alternatives that I mentioned in my question, could someone implement them without problems in any industrial project?
SergioMForster



Joined: 23 Jan 2019
Posts: 29
Location: Argentina

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 7:44 am     Reply with quote

Thank you very much temtronic for your response

I understand the advantages of having an OTG and pendrive, but unfortunately the cost of this solution is not compatible with the final cost of this product
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 9:31 am     Reply with quote

I've used the Brush Electronics FAT filesystem many times, and in industrial equipment. It has never failed me yet. It's money well spent.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 9:40 am     Reply with quote

hmm, I just checked a supplier...

https://www.banggood.com/3Pcs-Micro-SD-TF-Card-Memory-Shield-Module-SPI-Micro-SD-Adapter-For-Arduino-p-1003057.html?rmmds=search&cur_warehouse=CN

yeesh... $1.50 CDN for an adapter ! Complete, ready to use, no design,no PCB to make, no problems..... I can't buy the raw parts for that price. Probably less than $.50 US each in reasonable quantities.

There the HW is done..just decide on SW..

Things have sure changed in a short time !
SergioMForster



Joined: 23 Jan 2019
Posts: 29
Location: Argentina

View user's profile Send private message

PostPosted: Fri Dec 20, 2019 3:05 pm     Reply with quote

Thank you very much everyone for your comments, I just bought the Brush Electronics libraries, I will start working with them.

Temtronic, that board is interesting, but in my case as I am working with a 3.3v processor, I don't need the regulator or the TTL level shifter, just the socket.
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Fri Dec 20, 2019 6:16 pm     Reply with quote

I can also vouch for Brush Electronics FAT driver. The author, Andrew, is also very responsive and helpful when trying to get it to work. Better to spend the money up front on that driver then try to fart around, if you're on the clock.
benoitstjean



Joined: 30 Oct 2007
Posts: 566
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Fri Dec 27, 2019 4:27 pm     Reply with quote

if I can add my 10 cents, I've been using Brush Electronics driver on a PIC24EP512GP806 since 2016 and I can assure you it has worked flawlessly. At the moment I run the PIC with three opened files and it works like a charm. I use it to record 64kbps audio to an SD card and I've had it record 24 hours straight in 10 minute files without a glitch.

At the time when I bought it in 2016, it was around 150$USD and was a great investment.

And yes, above 32GB requires a license from Microsoft and that driver will not do it. Go with SLC cards for robustness at around 25$ a GB (I think...).

Good luck.

Ben
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sat Dec 28, 2019 3:42 am     Reply with quote

Actually lets just 'expand' a little.

Above 32GB, Windows defaults to using ExFAT, and supplied SSD's will
also normally use this. However you can perfectly well simply reformat to
use FAT32, and it'll work. The problem is that above 32GB, the standard
formatter in Windows won't allow this. However a third party tool will:

<http://www.ridgecrop.demon.co.uk/index.htm?guiformat.htm>

Once formatted using FAT32, the Brush driver will merrily handle the drive.
benoitstjean



Joined: 30 Oct 2007
Posts: 566
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Sat Dec 28, 2019 8:02 am     Reply with quote

Ah! So it was explained to me differently.

Thanks!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group