Show Posts
Pages: 1 ... 70 71 [72] 73 74 ... 111
1066  Using Arduino / Storage / Re: Windows Errors on opening SD card file on: July 16, 2012, 03:08:01 pm
Wow!  Looks like you are hitting every pothole.  The SYLK trap is a good one.
1067  Using Arduino / Storage / Re: Windows Errors on opening SD card file on: July 16, 2012, 01:20:28 pm
If you remove the SD without closing the file you will most likely have a corrupt file.  Closing the file updates the directory entry for the file and insures the SD file structures are consistent.

If you check the SD for errors with the windows, the volume will probably have problems.

In Windows right click on the SD and select properties then click on the tools tab then click "Check now..."  under Error-checking.

If closing the file before removing the SD doesn't fix the problem post the exact Windows message and describe the app that was used to open the file
1068  Using Arduino / Storage / Re: Logging 100 ksps with the Arduino internal ADC on: July 16, 2012, 12:46:35 pm
I did some tests but mostly looked at other people's work.

This is a good article on the AVR ADC and agrees with other tests

Here are the results of the SNR tests expressed as ENOB.

ENOB = (SNR – 1.76dB)/6.02dB

At 100 ksps I must clock the ADC at 2 MHz so the above test says I get an ENOB of a little under 7.5.  Not too bad since I am recording 8-bit data.

At rates lower than about 70 ksps I can use 1 MHz for the ADC clock for better SNR/ENOB.

The ATmega datasheet makes it sound like an ADC clock above 200 kHz will kill accuracy but all test I find give results like the above for the 328p.

1069  Using Arduino / Storage / Re: SD Card Initialization Fail 70% Of the time..... on: July 16, 2012, 12:00:03 pm
You could have used almost any pin for chip select and got the same result.

When a pin is uninitialized it may float low.  To enable a SPI device you pull chip select low.  So your uninitialized pin 4 was mostly enabling the SD.

You are not the first have this happen and you won't be the last.
1070  Using Arduino / Storage / Re: SD Card Initialization Fail 70% Of the time..... on: July 16, 2012, 11:34:12 am
The wireless shield uses pin 4 for SD chip select if you are using this shield

See the SDCS at pin 4 on the shield.

Edit SdFormatter  to use pin 4 as above and try it.

You must use pin 4 as SD chip select in all sketches.

The shield works some times because pin 4 is not initialize and floats low.  The shield will fail if pin 4 floats high.
1071  Using Arduino / Storage / Re: SD Card Initialization Fail 70% Of the time..... on: July 16, 2012, 11:11:36 am
It appears that your shield uses pin 4 as SD chip select.

Are you always using pin 4 as SD chip select in begin() and init() calls?

Some SD modules/shields almost work when the wrong chip select pin is used since pin 4 may float low most of the time.

Your errors are occurring at random times, not just at initialization time.  This indicates use of the wrong CS pin, noise or bad SPI bus signals or a second SPI device interfering with the SD.

It does not appear that you have any other SPI devices.

Do you have anything connected to the SPI pins 10, 11, 12, 13?

Did you edit SdFormatter and define chipselect like this?
const uint8_t chipSelect = 4;
1072  Using Arduino / Storage / Re: SD Card Initialization Fail 70% Of the time..... on: July 15, 2012, 09:10:54 pm
You need to run the QuickStart or SdInfo examples in the SdFat/examples folder.  The Arduino group didn't include these examples so you need to download SdFat here

QuickStart's output looks like this with the errorCode at the end:
SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is chipSelect set to the correct value?
Is there a wiring/soldering problem?
errorCode: 0x2, errorData: 0xff

SdInfo's output looks like this:
card.init failed
SD errorCode: 0X2
SD errorData: 0X20

1073  Using Arduino / Storage / Re: DfFat for dataflash and others on: July 15, 2012, 02:48:18 pm

You need to read the datasheet.  Many people have been tricked by the "ping-pong" thing.

Here are some times (typical and max)
Page erase and programming time (512-/528-bytes) 17 40 ms
Page programming time (512/528 bytes) 3 6 ms
Page erase time (512/528 bytes) 15 35 ms
Block erase time (4,096/4,224 bytes) 45 100 ms
Sector erase time (131,072/135,168 bytes) 1.6 5 s

So you can ping-pong write a block at typical 17 ms for a block or about 30 KB/sec.  Programing time is horrible.  3 ms typical 6 ms max.

If you are streaming to the part you face this:
The erase and the programming of the page are internally self-timed, and should take place in a maximum time of tEP. During this time, the status register and the RDY/BUSY pin will indicate that the part is busy.

So the ping-pong thing does little good.  Or as some people say Dataflash is slow as molasses.

Most MTD flash memory devices have a real downside when used for file systems.  That's why all popular flash devices for file systems, like SD cards and SSDs, have a block erase/wear controller.

I have not pursued F-RAM since the parts are low density so a file system makes less sense.  Dataflash at 32 Mbit is about the minimum density suitable for a file system.

1074  Using Arduino / Storage / Re: SD Card Initialization Fail 70% Of the time..... on: July 15, 2012, 10:08:13 am
SD.h is SdFat.  SD.h is just an API translation layer for an old version of SdFat.  The Adruino group wanted a "simpler API".

Does it fail you run the SdFat QuickStart or SdInfo examples?  If it fails what are the error codes?
1075  Using Arduino / Storage / Re: DfFat for dataflash and others on: July 15, 2012, 08:27:26 am
Yes it would be possible.  I have played with the idea for several years.  I bought some 32 Mbit Dataflash parts but never pursued the idea.

To get any advantage over an SD you need a special filesystem.  The problem is rewrite takes forever on Dataflash and there is no wear-leveling.

You need something like JFFS2, LogFS, UBIFS, or YAFFS.  I think JFFS2 is best for devices up to 64MB.
1076  Using Arduino / Storage / Re: writing time on SD on: July 14, 2012, 02:50:23 pm
It is possible to log data to an SD at 20 bytes every millisecond if you use special techniques.

I recently wrote a program to log one byte samples at 100,000 samples per second

I have not posted this program but it is a modification of the binaryLogger example in here

These programs use SD streaming write commands to write data to a pre-allocated contiguous file.  the data is captured in an interrupt routine.

20 byte samples at 1000 samples per second should be easily possible.
1077  Using Arduino / Storage / Re: SD Timestamp read? on: July 14, 2012, 12:58:21 pm
Here is a sketch for the SdFat library that opens each file in the root directory and prints

file_name year-month-day hour:minute:second

for the last write date and time.
 * Open all files in the root dir and print their filename
#include <SdFat.h>

// SD chip select pin
const uint8_t chipSelect = SS;

// file system object
SdFat sd;

SdFile file;

// define a serial output stream
ArduinoOutStream cout(Serial);
void setup() {
  dir_t dir;
  char name[13];


  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  // breadboards.  use SPI_FULL_SPEED for better performance.
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();

  // open next file in root.  The volume working directory, vwd, is root
  while (file.openNext(sd.vwd(), O_READ)) {
    cout << name << ' ';
    cout << FAT_YEAR(dir.lastWriteDate) << '-' << setfill('0');
    cout << setw(2) << (int)FAT_MONTH(dir.lastWriteDate) << '-';
    cout << setw(2) << (int)FAT_DAY(dir.lastWriteDate) << ' ';
    cout << setw(2) << (int)FAT_HOUR(dir.lastWriteTime) << ':';
    cout << setw(2) << (int)FAT_MINUTE(dir.lastWriteTime) << ':';
    cout << setw(2) << (int)FAT_SECOND(dir.lastWriteTime) << endl;
  cout << "Done" << endl;
void loop() {

Here is example output:
LOGFILE.BIN 2000-01-01 01:00:00
DATE.TXT 2012-07-14 10:39:32

The time-stamp has not been set on the first file.
1078  Using Arduino / Storage / Re: writing time on SD on: July 14, 2012, 11:45:07 am
As PaulS said there is no simple answer to this question.  It depends on how you write the 20 bytes.  The most efficient way to write 20 bytes is to make a call like this which will work with both the Arduino SD.h library and the SdFat library.
  file.write(array, 20);
I ran my benchmark program which timed 250,000 writes of 20 bytes each. I ran the test on two SD cards.  The results are.

SanDisk 2GB Extreme:
Maximum latency: 81960 usec, Min Latency: 44 usec, Avg Latency: 128 usec
Write rate 148.34 KB/sec

SanDisk 2GB standard:
Maximum latency: 66660 usec, Min Latency: 44 usec, Avg Latency: 197 usec
Write write rate 98.01 KB/sec

So the time for the above write to complete varies from 44 microseconds to 81960 microseconds.

The maximum time occurs because the card occasionally blocks operations while it erases a region of flash memory.

So the answer is the time to do a write has a huge range.
1079  Using Arduino / Storage / Re: SdFat for bigger RAMs on: July 14, 2012, 09:27:53 am
You can use as much memory as you want with the fast logger examples.  It's just a constant.  I use the SdFat cache buffer also so you get an additional block buffer.  That's how why the total is 13.
|| defined(__AVR_ATmega2560__)
// Mega - use total of 13 512 byte buffers
const uint8_t BUFFER_BLOCK_COUNT = 12;
1080  Development / Other Software Development / Re: ChibiOS/RT 2.4.1 RTOS update on: July 13, 2012, 10:22:47 pm
The programs stop on the while(1) when they are done.

If you have an SD, analog data will be logged from when you enter the first character until you enter the second character.
Pages: 1 ... 70 71 [72] 73 74 ... 111