Show Posts
Pages: 1 ... 63 64 [65] 66 67 ... 99
961  Using Arduino / Storage / Re: 2 SD cards in parallel on: May 29, 2012, 05:08:44 pm
The SD card is always the slave but it controls timing through the protocol between it and the master.  That's why you need to understand the spec.

For example when you send a command to the card it delays by holding MISO high until it is ready to send status.  The master waits till it get something other than 0XFF.

The protocol is filled with stuff like this that allows the card to control the timing for all operations.  That's why you can't enable two card at the same time and run them in parallel.

SD fat supports multiple cards but only by accessing one card at a time.
962  Development / Other Software Development / ChibiOS/RT 2.4.1 RTOS update on: May 29, 2012, 08:18:04 am
I have updated the ChibiOS/RT library to version 2.4.1.

This library is a simple way to use the ChibiOS/RT RTOS on 328 and Mega Arduinos.

The download is at

ChibiOS 2.4.1 is a maintenance release fixing all known bugs. More details are available in the release note at the ChibiOS website.

I have made minor changes to examples and included a new version of the SdFat library.
963  Using Arduino / Storage / Re: 2 SD cards in parallel on: May 28, 2012, 08:11:26 pm
No this adapter does not write the SD cards in parallel.  It make two SD cards appear like a twice as large memory stick.

Read the SD spec - it is impossible to access two SD cards in parallel on one SPI bus.  Cards are not synchronous devices.  They go ready at random times and return status at random times.
964  Development / Other Software Development / Re: ChibiOS/RT 2.4.0 RTOS update on: May 28, 2012, 11:22:23 am
The Arduino delay function will block all lower priority threads or all threads if used in an interrupt routine.

Arduino delay is just a loop that does not release the CPU:
void delay(unsigned long ms)
uint16_t start = (uint16_t)micros();

while (ms > 0) {
if (((uint16_t)micros() - start) >= 1000) {
start += 1000;

You should use ChibiOS thread functions like:
void    chThdSleep (systime_t time)
    Suspends the invoking thread for the specified time.

void    chThdSleepUntil (systime_t time)
    Suspends the invoking thread until the system time arrives to the specified value.

You can use scheduler functions to put a thread to sleep or wake a thread.

You can often use synchronization functions in place of delay.

Documentation is here

965  Using Arduino / Storage / Re: sdfatlib + teensyduino + arduino v1.0.1 = compile error :( on: May 27, 2012, 08:10:12 am
Edit SdFatConfig.h and set USE_CXA_PURE_VIRTUAL to zero like this at about line 107.

 * The __cxa_pure_virtual function is an error handler that is invoked when
 * a pure virtual function is called.
966  Using Arduino / Storage / Re: Where are my datas? on: May 26, 2012, 03:10:56 pm
You will need special techniques to record a measurement every 0.025 sec.  SD cards occasionally have very long write latency.  The standard allows up to 200 ms and 100 ms is common.

You can check your card by running the SdFat bench example to find the maximum write latency.

Here is the result for an old blue SanDisk 2GB card with max latency of 0.139 sec:
Starting write test.  Please wait up to a minute
Write 193.80 KB/sec
Maximum latency: 139360 usec, Avg Latency: 511 usec

Here is the result for a SanDisk 4GB Extreme HD video card with max latency of 0.047 sec.
Starting write test.  Please wait up to a minute
Write 160.56 KB/sec
Maximum latency: 47028 usec, Avg Latency: 618 usec

The Extreme HD card is about as good as you can do and it is too slow for your measurements in a simple sketch.

I have posted several examples of fast data loggers here

The file examples uses interrupts for measurements and have extra buffering.

The file uses a real-time OS to run separate threads for measurement and writing to the SD.  These examples also use a buffer queue between threads.
967  Using Arduino / Storage / Re: Where are my datas? on: May 26, 2012, 12:24:41 pm
Close() followed by open() is the wrong way to go.  It take a long time to open a file and position to the end.

With SD.h flush() does exactly the same as a close() followed by open().  With SdFat use sync().

SD.h is a wrapper for SdFat so it calls the same close() function as SdFat.

Here is close():

uint8_t SdFile::close(void) {
  if (!sync())return false;
  return true;

As you can see, close() calls sync() and marks the file closed by setting type_.

You can call flush() or sync() as often as you like but it will cost 2048 bytes of I/O to the SD.  A 512 byte block will be written to update the data on the SD, a 512 byte block containing the directory entry  will be read, updated and written back, then the 512 byte data block will be read back into the block buffer.

I am the author of SdFat which is the base library for the official SD.h library.

968  Using Arduino / Storage / Re: Reading MicroSd Card, lots of problems on: May 24, 2012, 02:45:46 pm
How did you format the card?

The best way is to use SD Formatter

You can also use the SdFormatter sketch in the SdFat examples folder

If you use Mac, Linux, or Windows OS utilities you may format the SD with a GUID Partition Table (GPT).  These OSes and many phones work with GPT but it is not a valid standard SD format.  Only MBR partition tables are recognized by SD.h and SdFat.

969  Using Arduino / Storage / Re: MMC Connection Problems on: May 14, 2012, 03:34:24 pm
the SD.h and SdFat libraries do not support MMC cards.
970  Using Arduino / Storage / Re: FAT file name restrictions? on: May 08, 2012, 09:43:42 pm
Open fails unless its argument is a valid 8.3 filename.
971  Using Arduino / Storage / Re: FAT file name restrictions? on: May 08, 2012, 12:18:26 pm
SdFat and the arduino SD library which is a wrapper for SdFat are restricted to 8.3 names.

I am the author of SdFat and decided not to support long filenames since substantial memory is required for long file names.

Very few people have requested long file names so I have not added this feature.

Here is the Long Filename Specification  It is not straight forward since multiple 8.3 directory entries are used.

I am writing an ARM version of SdFat that will support long filenames and may make long filenames an option for avr arduinos.
972  Using Arduino / Storage / Re: SdFat: How to go to parent directory? on: April 23, 2012, 05:09:47 pm
There is not a supported way.

I wrote a function:
  /** experimental don't use */
  bool openParent(SdBaseFile* dir);

I made it private since I was not to happy with the design.  No one asked for it so I didn't follow up.

You could edit SdBaseFile.h at about line 358 and make it public.  I may not work since I wrote it a long time ago.
973  Using Arduino / Storage / Re: SPI multiple slaves - SD Card and another Arduino on: April 23, 2012, 04:35:21 pm
Which SD library are you using? 

The Arduino SD.h library is a wrapper for a very old version of SdFat that I designed years ago.  It has a lot of bugs and I have totally rewritten the low level SPI/SD part.

SD cards are tricky on the SPI bus.  They require extra clocks after chip select is high to release MISO to tri-state.
974  Using Arduino / Storage / Re: Any interest in an ARM version of SdFat on: April 23, 2012, 04:25:59 pm
MicroSD cards are SDIO devices. 

That's what the adapter you get with a MicroSD shows.  It connects the correct MicroSD pins to the SD connector and a PC/Mac used the SDIO to access it.
975  Using Arduino / Audio / Re: MP3 Player with LCD display and more... on: April 21, 2012, 03:13:18 pm

What do you suggest we do with these parts?

Should we use a DIP adapter and a bread board as you have shown in other projects? 

What I2S parts do you suggest using to complement this part?

Where do we download design files?
Pages: 1 ... 63 64 [65] 66 67 ... 99