Show Posts
Pages: 1 ... 55 56 [57] 58 59 ... 107
841  Development / Other Software Development / Re: how to go to STM32 / Arm on: October 05, 2012, 08:17:08 am
I suggest you try Teensy 3.0 http://www.pjrc.com/store/teensy3.html also http://www.kickstarter.com/projects/paulstoffregen/teensy-30-32-bit-arm-cortex-m4-usable-in-arduino-a.

I have one and it uses the Arduino IDE with gnu ARM tools.  It's real easy to use.  You just unzip the IDE like the standard Arduino IDE.

Soon, October 22, Arduino will release the Due http://hackadaycom.files.wordpress.com/2012/10/due.pdf.  I suspect it will also be easy to install and use.
842  Development / Other Software Development / Re: New fast digital I/O and Software SPI libraries on: October 05, 2012, 08:07:59 am
Rob,

If you hangout here long enough, you will become one of us and reliably won't matter.  I speak from experience, my standards are slipping.

For most programmers reliably is is handled by taking out the debug checks when software is released so the code is smaller and runs faster.

Here is a quote from long ago:
Quote
Turning off dynamic semantic checks once you've finished debugging your program is like taking off your seat belt once you've left the driveway.

This quote is wrong, modern programmers don't believe in seat belts or airbags.  We are at the level of automobiles 60 years ago, there are no seat belts.

Modern programmers don't diagnose and fix bugs, they turn Bohrbugs into Heisenbugs. One way to make life better for users is to convert Bohrbugs into Heisenbugs.

Quote
This is good enough because Bohrbugs are showstoppers for users: every time the user does the same thing, he or she will encounter the same bug. With Heisenbugs, on the other hand, the bugs often go away when you run the program again. This is a perfect match for the way users already behave on the Web. If they go to a Web page and it fails to respond, they just click “refresh” and that usually solves the problem.

Here is a definition:
Quote
Jim Gray drew a distinction between two kinds of bugs. The first kind are bugs that behave predictably and repeatedly—that is, they occur every time the program encounters the same inputs and goes through the same sequence of steps. These are Bohrbugs, named for the Bohr atom, by analogy with the classical atomic model where electrons circle around the nucleus in planetary-like orbits. Bohrbugs are great when debugging a program, since they are easier to reproduce and find their root causes.

The second kind of bug is the Heisenbug, named for Heisenberg’s Uncertainty Principle and meant to connote the inherit uncertainty in quantum mechanics, which are unpredictable and cannot be reliably reproduced. The most common Heisenbugs these days are concurrency errors (a.k.a. race conditions), which depend on the order and timing of scheduling events to appear. Heisenbugs are also often sensitive to the observer effect; attempts to find the bug by inserting debugging code or running in a debugger often disrupt the sequence of events that led to the bug, making it go away.
Jim Gray wrote this in 1985 and not much has changed.  http://www.hpl.hp.com/techreports/tandem/TR-85.7.pdf
843  Development / Other Software Development / Re: New fast digital I/O and Software SPI libraries on: October 04, 2012, 09:56:07 pm
How are you looking at the pins?

If you connect pin 34 to pin 36 and run the "T - Transfer" command does "AA" print?

If you set pin 36 to GND, does the "R - Receive" command print 0?  If pin 36 is set to 5V, "R - Receive" should print FF.

SS is needed for hardware SPI to work.  SS must be set to an output in master mode so it is often used as chip select.

For software SPI in master mode no SS signal is needed.  You can use any pin for chip select.
844  Using Arduino / Storage / Re: itdb02 sd card : unable to do working on: October 04, 2012, 03:43:09 pm
The card does not return a valid response to a read.  It must not be a true SD card.

SDFormatter 3.1 also rejects it so it won't work in some SD devices.

Windows accepts cards released before the official SD spec and MMC cards.

I didn't add code for these cards to the Arduino libraries since it would increase the size of the libraries and these old cards are now rarely used.
845  Using Arduino / Storage / Re: itdb02 sd card : unable to do working on: October 04, 2012, 12:12:05 pm
Most likely your 16MB card is formatted FAT12.

You can force it to be FAT16 by using the SdFat SdFormatter example located in SdFat/examples/SdFormatter.

All SD cards support SPI.  If your 16MB card is an MMC card, it won't be supported by SdFat or the Arduino SD.h library.
846  Using Arduino / Storage / Re: MicroSD: New Card Issues on: October 01, 2012, 06:00:32 pm
The methods are documented in html generated by doxygen.  

Click on SdFat.html in the unzipped SdFatBeta20120825 directory and explore the Classes tab.

Most of the important methods are illustrated in the examples in the SdFat/examples folder.

There are also examples in the SdFatBeta20120825/extras/exampleV1 folder.  These are older but demonstrate rewrite, seek, remove, and other basic methods.
847  Using Arduino / Storage / Re: MicroSD: New Card Issues on: October 01, 2012, 04:47:10 pm
O.K. - I have seen the CRC problem with other cheap cards.

You can enable CRC with any card and it will increase reliability a great deal.  Data is protected by a 16-bit CRC so SPI errors will be detected. 

Performance for all cards will be reduced since calculating CRC requires CPU cycles.  Run bench using a good card with and without CRC to see the hit.

I suspect that the performance of these new cards is very low.  Edit bench.ino and decrease the file size to one MB by changing FILE_SIZE_MB like this:

Code:
#define FILE_SIZE_MB 1
#define FILE_SIZE (1000000UL*FILE_SIZE_MB)

bench.ino should run in 1/5 the time.  Wait at least three minutes.
848  Using Arduino / Storage / Re: MicroSD: New Card Issues on: October 01, 2012, 01:19:58 pm
Ordering new cards seems like a good idea.

I noticed that BENCH.DAT was created even though open failed.  This means data was written to the card but a failed status was returned.

I am curious to see what happens if you edit Sd2Card.cpp to accept the incorrect return status.

At about line 670 of Sd2Card.cpp change this
Code:
  status_ = spiRec();
  if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) {
    error(SD_CARD_ERROR_WRITE);
    goto fail;
  }
  return true;
to this
Code:
  status_ = spiRec();
  return true;  // Ignore write response
  if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) {
    error(SD_CARD_ERROR_WRITE);
    goto fail;
  }
  return true;

Run bench and see if BENCH.DAT contains text lines like this:
Quote
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST
849  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.
850  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.
851  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.
852  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?
853  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
854  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.
855  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.

Pages: 1 ... 55 56 [57] 58 59 ... 107