Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:50 04 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : SD card write issues

     Page 2 of 2    
Author Message
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 02:37am 12 Dec 2012
Copy link to clipboard 
Print this post

Improvements

1. Loop until you get an initial filename DDMMYY.LOG
2. Main Loop - append to file
3. Check for a minute change
4. Close off the file
5. Check if the date has changed
6. Append again
7. Loop

That way - the file is written to once a minute and the name of the file updated according to DDMMYY.LOG

- Andrew -
Andrew Rich VK4TEC
www.tech-software.net
 
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 12:38pm 12 Dec 2012
Copy link to clipboard 
Print this post

Being picky, you are likely to get data from the first minute of a new day mixed in with the data from the previous day.

How about:

1. Read first line of gps data and extract date. Save date to memory.
2. Work out file name based on gps date.
3. Set interrupt or second counter.
4. Open file yymmdd.log for append (easier to sort if in yymmdd format) (doesn't need 'file exist' error checking because a file opened for append will be created if it doesn't already exist).
5. Loop reading and writing gps data until second counter = 60 or interrupt or new date or exit condition
6. - Work out file name based on gps date.
7. - Update date stored in memory.
8. - Close file and open (possibly new day's) yymmdd.log for append.
9. - Reset interrupt or second counter.
10. Repeat until exit condition.

As Geoff says, the FAT will get hammered and the life of the SD card reduced if you do lots of opening and closing of the file. Once you get the program working reliably, consider testing it using periods longer than 60 seconds.

James
Edited by James_From_Canb 2012-12-13
My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 03:15pm 12 Dec 2012
Copy link to clipboard 
Print this post

I had these same problems with writing to an sd card.
I opted for writing data to an FRAM or NVSRAM (23LCV1024).
These are wonderful pieces of memory that you can access as much as you want, just like static ram, retain their data on power loss and have long lifespans.
A buffer for the data that you can dump to SD in one 'swoop'.
This will make your sd card last for years.

I have a few 23LCV1024 (http://ww1.microchip.com/downloads/en/DeviceDoc/25156A.pdf) in stock, they are only about 3-4US$.


Edited by TZAdvantage 2012-12-14
Microblocks. Build with logic.
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 04:49pm 12 Dec 2012
Copy link to clipboard 
Print this post

Thanks all for your generous help and suggestions

Not such a biggy if some data gets into another file.

What is important is reliability and keeping files manageable

- Andrew -
Andrew Rich VK4TEC
www.tech-software.net
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 04:50pm 12 Dec 2012
Copy link to clipboard 
Print this post

More than one sentence is written

GPRMC
GPGGA
GPGSV
GPGSA

Only GPRMC is used to check date / time

- Andrew -
Andrew Rich VK4TEC
www.tech-software.net
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024