Show Posts
Pages: 1 ... 55 56 [57] 58 59 ... 107
841  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 30, 2012, 07:46:03 pm
I don't think other configuration options will help.

If possible try the card in another Arduino and SD module.  This is a long shot since read operations seem to work with the Teensy.

It may be that the card has problems with single block write commands in SPI mode.
842  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 30, 2012, 03:04:29 pm
This card fails by returning an error status after a 512 byte data block is sent to the card during a write. The following error code is for a CRC error for the data block.  
Quote
error: write MBR
SD error: 13,b
SD cards should ignore a block's CRC by default in SPI mode.

Try enabling CRC checking by editing SdFatConfig.h and setting USE_SD_CRC to 1 or 2.
Code:
/**
 * To enable SD card CRC checking set USE_SD_CRC nonzero.
 *
 * Set USE_SD_CRC to 1 to use a smaller slower CRC-CCITT function.
 *
 * Set USE_SD_CRC to 2 to used a larger faster table driven CRC-CCITT function.
 */
#define USE_SD_CRC 0
Try the SdFormatter example again.  If this fixes the problem, the card does not function correctly in SPI mode.  The Arduino has no CRC hardware so enabling software CRC will reduce write performance.

Another possible cause is a bad MOSI SPI signal.  I don't think this is the problem with your 3.3V setup.
843  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 29, 2012, 07:13:40 pm
I wrote SdFat, Fat16, and the base code for SD.h.  These three libraries have similar code but the new beta of SdFat supports more SD cards than other libraries so download and install SdFatBeta20120825.zip http://code.google.com/p/beta-lib/downloads/list.

Run these three examples: QuickStart, SdInfo, and bench.

Post the error codes if any of the above examples fail.  Also post the results of the bench example if it runs without errors.

If all examples run O.K. change this line in bench.ino from this
Code:
#define FILE_SIZE_MB 5
to
Code:
#define FILE_SIZE_MB 25
And rerun it.  This should do a write stress test.
844  Using Arduino / Storage / Re: SD Card filesystem poblem on: September 14, 2012, 03:45:04 pm
Quote
I am not using SoftwareSerial, I am using the internal Serial object to communicate with the gprs.
HardwareSerial also uses lots of stack for interrupts.  I assumed SoftwareSerial since many gprs libraries use it.

Are you checking all SdFat calls for error returns?
845  Using Arduino / Storage / Re: SD Card filesystem poblem on: September 14, 2012, 11:40:10 am
Quote

I guess that the flash memory was not enough for SdFat buffers, everything crashed in a reset loop...

Flash use will not cause a crash in a reset loop.  If you are that close to running out of RAM, you will likely have a problem if you log data and run gprs at the same time.  A pin change interrupt in SoftwareSerial can cause a stack overflow while an SdFat function like remove() is executing.

If possible check the amount of free stack by adding this include:
Code:
#include <SdFatUtil.h>
And this print in setup()
Code:
  Serial.println(FreeRam());
You need 200-300 bytes of free RAM in addition to any you allocate in functions.

I looked at your SD module and these often fail. 

The problem is that these modules don't use proper level shifters on MOSI, SCK, and CS.  These signals should be converted from 5V to 3.3V with an IC based level shifter.  Most SD cards are not designed to accept 5V signals.

Too bad you can't use CRC on the SD to check for data transfer errors.  You can check for any detected SD problem like this:
Code:
if (sd.card()->errorCode()) {
  // print SD I/O error code
  Serial.println(sd.card()->errorCode(), HEX);
}

Here are typical SD modules with a level shifter in addition to a 3.3V regulator
http://www.gravitech.us/sdcaad.html
https://www.adafruit.com/products/254
http://www.pjrc.com/teensy/sd_adaptor.html
846  Using Arduino / Storage / Re: Small SDCard library on: September 13, 2012, 05:07:52 pm
The SD standard requires FAT16 formatted cards to be 2GB or less.

The standard requires SDHC cards, 4GB - 32GB, to be formatted FAT32.
847  Using Arduino / Storage / Re: SD Card filesystem poblem on: September 12, 2012, 11:59:47 am
Once the data gets into an SD card there just are not undetected write errors.

Noise on the SPI bus is be the only thing left. 

You can check that by enabling CRC on SPI transfers between the Arduino and SD. 

I added software CRC to SdFat so edit SdFatConfig.h at about line 35 and change USE_SD_CRC to 1 or 2.

Code:
/**
 * To enable SD card CRC checking set USE_SD_CRC nonzero.
 *
 * Set USE_SD_CRC to 1 to use a smaller slower CRC-CCITT function.
 *
 * Set USE_SD_CRC to 2 to used a larger faster table driven CRC-CCITT function.
 */
#define USE_SD_CRC 0

Then all transfers on the SPI bus will be CRC protected.  Calls to SdFat functions will fail with an error return.

848  Using Arduino / Storage / Re: SD ReadWrite example writes too often on: September 12, 2012, 10:17:27 am
An Arduino sketch starts when you power up or load a sketch.  The Arduino is reset when you open the serial monitor.  This means the sketch runs several times, not just once.

Change this:
Code:
Serial.print("Initializing SD card...");

To this:

Code:
Serial.println("Type any character");
 while (Serial.read() < 0);
 Serial.print("Initializing SD card...");

This will prevent writing to the SD before the serial monitor is running.

Then run the sketch and type a character when this message prints.
Quote
Type any character
849  Using Arduino / Storage / Re: SD Card filesystem poblem on: September 12, 2012, 10:04:50 am
Modern SD cards are very tolerant to voltage drops.  They don't commit writes when power is failing. 

The SD data blocks have very powerful ECC so hardware write errors would be detected when you read the Sd on a PC or Mac.

This is a software problem.

How do you run data logging while GPRS is working?

You can't have a file open more than once and you can't call SdFat functions in an ISR.
850  Using Arduino / Storage / Re: How robust is SDlib to other interrupts on: September 12, 2012, 09:14:12 am
SD cards seem to be very tolerant for delays in SPI transfers.  I have delayed for many milliseconds mid-transfer with no problem.

Many people call analogRead() for several pins in an ISR while data is being written to the SD with no problem.  Each call takes about 120 microseconds.

SdFat uses millis() to detect timeout errors so spending more than a millisecond in an ISR will cause millis() to drop counts.  This should just extend the length for a timeout error.
851  Using Arduino / Storage / Re: SD Card filesystem poblem on: September 11, 2012, 12:22:07 pm
Do you get corrupt files if you don't comment out the remove()?

If you still have the problem with remove(), is is likely something is writing over SdFat memory. 

Remove() needs to do lots of writes to the SD and would likely cause file-name problems if SdFat memory is overwritten.
852  Using Arduino / Storage / Re: SD Card filesystem poblem on: September 10, 2012, 05:10:21 pm
I am the author of SdFat which is also the base for SD.h. 

I have found most bugs that result in junk file-names are due to overwriting SdFat internal memory.  The SD cache often has a directory block with 16 directory entries so you get lots of junk names if it is over written.

Check loop indices, array dimensions, strings with no zero byte termination, bad pointers, and any other causes of overwriting memory.
853  Using Arduino / Storage / Re: Sd works in example append but fails in integration. on: September 10, 2012, 05:00:12 pm
SdFat only supports FAT 8.3 names.  This name has nine characters before the dot so is not valid.

Code:
char name[] = "GardenLog.TXT"
854  Development / Other Hardware Development / Re: Teensy 3.0 on: September 08, 2012, 12:16:41 pm
I wasn't very clear, I am sure you can generate a hex file with any Cortex M4 tool chain.

Here is my question.   How easy is it to load an arbitrary hex file?

I read this also
Quote
Teensy 3.0 features an off-chip bootloader design.  On Teensy 2.0 and all Arduino(R)** brand boards, the bootloader consumes a small portion of the available flash memory.  On most boards, the bootloader executes briefly before your own program.  By storing the bootloader in a separate chip, your code can use all of the flash memory.  Your code can also run immediately after a reset event, without bootloader interference.

I wonder how you start the boot loader?

My guess is that the button copies the boot-loader into RAM.  The boot-loader can then program all flash.

Perhaps the boot-loader uses FlexMemory.  I don't have a clear understanding of FlexMemory.

The next question is how do you send the hex file to the boot-loader?
855  Development / Other Hardware Development / Re: Teensy 3.0 on: September 08, 2012, 09:17:17 am
You should be able to use any tool chain that supports Cortex M4 processors.  

The only problem could be how Paul's boot-loader works on Teensy 3.0.  You need a hook to load you hex file.

The easy way is to use what ever Paul has packaged with his software.  His stuff is always easy to use and reliable.

I am hoping to make ChibiOS a library for Teensy 3.0 using his tools.  That way I can use his tools and have a RTOS.

I did that with the Arduino IDE for AVR processors.

I really like Freescale's documentation.  Here is a good overview of true bare metal use of the device http://cache.freescale.com/files/32bit/doc/quick_ref_guide/KQRUG.pdf.
Pages: 1 ... 55 56 [57] 58 59 ... 107