SD Card and FAT FS for FreeEMS

Official FreeEMS vanilla firmware development, the heart and soul of the system!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SD Card and FAT FS for FreeEMS

Post by Fred »

Curiosity cloned the cat, urr, I mean git! :-)

"We recommend adding a README to this repository. Visit github/markup for details on what formats we support. "

That's got as much code in it as the rest of FreeEMS all put together :-) You work fast.

For testing, just overwrite unused main table paged ram blocks freely. Optimise last, use up to 4k in one BIG block first :-)

Is the SPI stuff GP enough to use for knock too?

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Spudmn
LQFP112 - Up with the play
Posts: 232
Joined: Thu Feb 10, 2011 12:27 am
Location: Auckland, NZ

Re: SD Card and FAT FS for FreeEMS

Post by Spudmn »

Fred wrote:
"We recommend adding a README to this repository. Visit github/markup for details on what formats we support. "
Will do.
Fred wrote: That's got as much code in it as the rest of FreeEMS all put together :-) You work fast.
I can't take the credit. It is all Chan's work and a full copy of this source and web pages. It also has a 32M disk image.
Fred wrote: Is the SPI stuff GP enough to use for knock too?
I will keep that in mind when I code the SPI.
User avatar
Spudmn
LQFP112 - Up with the play
Posts: 232
Joined: Thu Feb 10, 2011 12:27 am
Location: Auckland, NZ

Re: SD Card and FAT FS for FreeEMS

Post by Spudmn »

I have done a small amount of research on the so called FAT32 patents. My limited understanding of the patents, is that they all relate to long file names and the way in which the long and short file name is stored together. Now I think that software patents are BS, but the fact remains that MS actively go after companies that use Linux with these patents.

Here are 2 options.

Use only short file names. This probably wont be a big issue for FreeEMS users and we can use directors to sort the data in to logical blocks.

Use only Long File names. There is a Linux patch that does this type of thing. I would assume that Linux users would not have a problem reading the files on the SD card, but Windows I don't know.

To make it easier to get the code out there and start to be used I will code the data logging code to use 8.3 file names only. If later we want to use long file names we can revisit a possible solution.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SD Card and FAT FS for FreeEMS

Post by Fred »

Perfect! Sequential numbering, then. Perhaps start with a lastname.txt file and store the number of the last log file in it? Just a hacky idea, feel free to reject it wholesale :-)
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
DaWaN
QFP80 - Contributor
Posts: 62
Joined: Thu Oct 30, 2008 10:35 am
Location: Benschop, Netherlands

Re: SD Card and FAT FS for FreeEMS

Post by DaWaN »

As far as I remember the long filenames are complex for an embedded aplication and take some RAM, so not using long file names also has technical benefits
User avatar
Spudmn
LQFP112 - Up with the play
Posts: 232
Joined: Thu Feb 10, 2011 12:27 am
Location: Auckland, NZ

Re: SD Card and FAT FS for FreeEMS

Post by Spudmn »

DaWaN wrote:As far as I remember the long filenames are complex for an embedded aplication and take some RAM, so not using long file names also has technical benefits

You are correct. It will use 255 bytes of extra RAM.
User avatar
Spudmn
LQFP112 - Up with the play
Posts: 232
Joined: Thu Feb 10, 2011 12:27 am
Location: Auckland, NZ

Re: SD Card and FAT FS for FreeEMS

Post by Spudmn »

I have an event coming up next weekend and I wanted to get some FreeEMS logs of it. I didn't want to drive around the track with my laptop in the car as it would be very hard to make it safe. (Motor sport rules. You have to strap down heavy items). Because the Puma has a USB interface I didn't have many other options. If my Raspberry Pi had arrived I could have used that, but I am waiting like every body else. I decided to run a wire from the micros serial port before it enters the USB chip.

I then run this wire through a RS232 converter and I now have a serial stream that I can log with a micro. I brought out my old GPS data logger and reconfigured it for 115200. Unfortunately a 11Mhz 8051 micro bit banging a SD card wasn't going to keep up with FreeEMS data. I then found a PIC32MX board that I could use. I hooked up a SD Card slot and sorted out some software for it. I happy to say that it works great and I will be able to use it next weekend.

The code is based on Chans work and can be found here

http://www.microchip.com/stellent/idcpl ... e=en539236

I just added the serial coms and fixed up a few bugs.

One thing that stumped me for a while was that I was saving the files with a .TXT extension. I found that Open Log Viewer treats .TXT files differently to .BIN files. I changed the extension to .BIN and now it works better.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SD Card and FAT FS for FreeEMS

Post by Fred »

OLV needs fixing lol :-)

You can turn the serial speed down in the firmware and in mtx if you want to go back to the PIC. High speed logging is very nice, though. At least you don't have to poll, parse and store as text or encode it. Just dumping it straight down is sufficient :-)

Will this be the first motorsport event for FreeEMS ? Looking forward to reviewing these logs! :-)

Will you be running a sticker on the glass? Will there be in-car and/or out-of-car video of it?

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Spudmn
LQFP112 - Up with the play
Posts: 232
Joined: Thu Feb 10, 2011 12:27 am
Location: Auckland, NZ

Re: SD Card and FAT FS for FreeEMS

Post by Spudmn »

Fred wrote:
You can turn the serial speed down in the firmware and in mtx if you want to go back to the PIC. High speed logging is very nice, though. At least you don't have to poll, parse and store as text or encode it. Just dumping it straight down is sufficient :-)
The faster the better. It is working great, all the logs I have done this week end have been dumped straight to the SD Card at 115200. When it is part of FreeEMS I hope that we can log even more data.

Fred wrote: Will this be the first motorsport event for FreeEMS ? Looking forward to reviewing these logs! :-)

Will you be running a sticker on the glass? Will there be in-car and/or out-of-car video of it?

Fred.
Yes it will be. I will have to find the sticker and sort that out. If I have time I will put the video camera back into the car. I have lots to do and not much time. I will see what I can do.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SD Card and FAT FS for FreeEMS

Post by Fred »

I'll put the call out for stickers and see if I can you one ASAP :-)
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply