Set up Microcontroller to save data to SD card using FAT file storage.

Thread Starter

MrAndrewBishop

Joined Jan 10, 2023
2
Hi there, I'm looking for help with a FAT filesystem project.

I have a special made measuring device with its own on board ARM MCU and RAM memory.
Its is essentially a device that measures impedance through a tungsten filament as that filament is drilled at high RPM through a non conductive material.
The purpose is to measure the saturation of the inner lining of a fiberglass pipe that contains corrosive industrial chemicals.

After this device runs a test I am left with a large RAM chip filled with impedance measurements over a distance.
What I would like to be able to do is store this raw data on an SD card as both a CSV and image file.

The CSV would be used for further analysis done by a software program.
The image file (I haven't decided on a format) would be used to place test results directly into a report.

I have been looking through the FATFs Module website (http://elm-chan.org/fsw/ff/00index_e.html) as a possible option, but I've never setup this type of system before.

I would like to know if FatFs is even a plausible option for this hardware and am I even barking up the right tree.
FatFs requires a lower level disk IO layer to be written so that it can interface with the SPI port, can anyone suggest advice or a example of this being implemented?
Is there a simpler way to do this? Is FatFs the right choice?

I can answer any additional questions if needed. Thank you.

Current devices used:
MCU: NXP, MKL14Z64VLK4, 64KB, ARM M0+
RAM: ISSI, IS62WV5128, 512K x 8
 

MrChips

Joined Oct 2, 2009
30,925
Welcome to AAC!

When developing around an ARM MCU it is easier to start with a development board and recommended software suite.
What board and platform are you using? Does the board come with a micro-SD slot?
Check your IDE platform and look for SD-card libraries. Search for code examples on the internet. The file format choice will come later. You can choose any standard file format for your selected application SW.
 

nsaspook

Joined Aug 27, 2009
13,414
I've used FatFs before. The SPI driver (with the assumption you already have a SD card socket and interface on the controller card) for it is simple if you already have hardware and embedded software experience. I wouldn't recommend it for a novice.
Can you post more information about measuring device like a PCB photo.

If you have a serial TTL/RS-232 connection it might be easier to send CSV data (A properly encoded image/binary file will also work) that way. If it has a onboard debug USB, that will usually have virtual serial port that can connect directly to a PC for data capture.
 

Thread Starter

MrAndrewBishop

Joined Jan 10, 2023
2
Thanks for responding.

This image shows how it is configured on my custom PCB.
Look at ports E16 through E21.
I can setup a breakout board and shield if you think a different configuration would work better.
I got my degree in electrical engineering in 2014 and have been working with this family of MCUs since then.
I certainly know how to setup a SPI bus.
I actually already have my own SPI.c file written for different projects I've done.
How to 'glue' that to the FatFs functions is where I am confused.

Thank you!
View attachment FatFs_PCB_Img.jpg
 
Top