Show Posts
Pages: 1 ... 63 64 [65] 66 67 ... 110
961  Using Arduino / Storage / Re: Accessing SD card at higher speeds. on: August 09, 2012, 06:21:52 pm
Sounds like you have lots of software bugs.  You need to look at the SPI mode protocol for access to the SD card.

Much of what you are seeing is due to not following the SD protocol.

For example the way an SD indicates busy for a read is to send repeated 0XFF.  It sends a start of data token when it is no longer busy.

You can't use SD mode since that requires hardware SDIO bus support and the ATxmega256D3 does not have a SDIO bus.

962  Using Arduino / Storage / Re: Anyone using SD.h with Leonardo? on: August 09, 2012, 09:03:53 am
The new version of SdFat now supports the Leonardo for both Hardware SPI and Software SPI.  It is sdfatlib20120719.zip at http://code.google.com/p/sdfatlib/downloads/list.

By default Software SPI supports the pin configuration for 328 shields with:
Code:
/** Software SPI Master Out Slave In pin */
uint8_t const SOFT_SPI_MOSI_PIN = 11;
/** Software SPI Master In Slave Out pin */
uint8_t const SOFT_SPI_MISO_PIN = 12;
/** Software SPI Clock pin */
uint8_t const SOFT_SPI_SCK_PIN = 13;

To use Software SPI on Leonardo and Hardware SPI with other CPUs, edit SdFatConfig.h at about line 121 like this:
Code:
#define LEONARDO_SOFT_SPI 1

963  Community / Bar Sport / Re: Curiosity - way too cool. Sunday. on: August 06, 2012, 06:25:55 pm
NASA requires DoD Category 1A Accreditation of Trust in addition to radiation-harding.  That make the RAD750 cost $200,000 each.

I am sure the Arduino doesn't have DoD Category 1A Accreditation of Trust.

Too bad the Raspberry Pi can't qualify since it would be more powerful at $35.  Actually the RAD750 has twice as much RAM as the Pi but that could be fixed.
964  Community / Bar Sport / Re: Curiosity - way too cool. Sunday. on: August 06, 2012, 02:32:19 pm
I can't believe JPL.  Most U.S. Mars missions have involved JPL and 14 of the 19 U.S. missions succeeded.

Only 2 of the 21 Mars missions by other countries have succeeded.  The score is now Earth 16 Mars 24.

http://mars.jpl.nasa.gov/msl/multimedia/images/?ImageID=4181

Not bad for a 27 year old RTOS on an old 200 MHz PowerPC 750 (Mac G3).  Curiosity has two RAD750 processors, one primary and one backup.  It's normal for computing technology to be way out of date when space missions fly.

JPL used the VxWorks RTOS on this mission.  I did a project in 1985 with VxWorks. 

Two of my colleagues quit the Lawrence Berkeley National Lab where we worked, formed Wind River Systems, and developed VxWorks.  I contracted with them for the first release of VxWorks and used it in a small project.

965  Using Arduino / Storage / Re: 1284p and SD datalogging on: August 06, 2012, 12:07:37 pm
Read this first http://arduino.cc/it/Reference/Libraries.  SdFat is a Contributed Library.

Also read this arduino.cc/en/Guide/Environment.  It explains where things are.

Once again, install the SdFat folder in the libraries sub-folder of your sketchbook folder.

Quote
To install third-party libraries, create a directory called libraries within your sketchbook directory. Then unzip the library there. For example, to install the DateTime library, its files should be in the /libraries/DateTime sub-folder of your sketchbook folder.

Please learn the basics of Arduino.  There are many articles on installing libraries.  Google for "installing arduino libraries".
966  Development / Other Software Development / Re: New fast digital I/O and Software SPI libraries on: August 05, 2012, 08:21:10 pm
Embedded programming standards don't have statements like:
Quote
would it not be suitable if users of the code are made fully aware of the behavior.

To often one user's code is another user's library and stuff like this gets lost and tragedies happen.

Nothing really matters with Arduino since it is a case study in bad practice and I often follow with bad practice in my Arduino libraries and programs since they are just toys.  I have some limits with Arduino and a factor of 30 in execution speed was too much.

Here is a typical coding standard for a critical system, The F35 Joint Strike Fighter http://www.jsf.mil/downloads/documents/JSF_AV_C++_Coding_Standards_Rev_C.doc.
967  Using Arduino / Storage / Re: 1284p and SD datalogging on: August 05, 2012, 07:40:16 pm
Looks like the SdFat folder is not in the libraries folder of your Arduino folder.

In my case on Windows 7 this is C:\Users\bill\Documents\Arduino\libraries\SdFat.

The SdFatAppend.pde is a very old example for backward compatibility tests.

Newer examples are in the SdFat/examples folder.

On Windows 7 this is C:\Users\bill\Documents\Arduino\libraries\SdFat\examples.

The new version is append.ino in the examples/append folder.
968  Using Arduino / Storage / Re: 1284p and SD datalogging on: August 05, 2012, 06:59:11 pm
SD.h is based on an very old version of SdFat.  I wrote SdFat but no longer support the version used as the base for SD.h.

You might want to try the latest version of SdFat.  Except for Software SPI, it uses the pin definitions in the Arduino hardware/variants folders so no edits should be needed for hardware SPI.

You probably won't use Software SPI.  For the 1284P, Software SPI uses the Sanguino pin map.

SdFat is here http://code.google.com/p/sdfatlib/downloads/list.
969  Development / Other Software Development / Re: New fast digital I/O and Software SPI libraries on: August 05, 2012, 06:43:18 pm
I don't like macro implementations and macros are not needed to use to use digitalWrite() or another function when the pin number is not a constant.

I produce an error when pin number is not a constant because most professional embedded programming standards consider having a function change execution speed by a factor of 30  when an argument is a constant to be poor practice.

You could do this to have a fast/slow digital write:
Code:
static inline __attribute__((always_inline))
void fastSlowWrite(uint8_t pin, bool value) {
  if (__builtin_constant_p(pin)) {
    fastBitWriteSafe(pinMap[pin].port, pinMap[pin].bit, value);
  } else {
    digitalWrite(pin, value);
  }
}

This compiles as 692 bytes and write is fast.
Code:
#include <DigitalPin.h>
const uint8_t PIN = 13;
void setup() {
  pinMode(PIN, OUTPUT);
  fastSlowWrite(PIN, 1);
}
void loop() {}
This compiles as 872 bytes and write is slow.
Code:
#include <DigitalPin.h>
uint8_t var = 13;
void setup() {
  pinMode(var, OUTPUT);
  fastSlowWrite(var, 1);
}
void loop() {}

I made DigitalPin a wrapper since it insures the static and class functions behave the same.  I almost used separate implementations since the template insures the pin number is a constant an much of the static function stuff is not needed.
970  Using Arduino / Storage / Re: Arduino Mega 2560 W5100 Ethernet Shield and SdFat library on: August 05, 2012, 10:13:58 am
Pulling pin 10 high is worth a try since SdFat does not set pin 10 high on the Mega. 

SdFat pulls pin 10 high on 328 boards to avoid problems but it can't do that on the Mega since SS is not pin 10 on the Mega.

It could be that the W5100 overpowers one SD on the SPI bus but not the other SD.

It's a problem with the cards SPI controller if you still get this.
Quote
SD errorCode: 0XA
SD errorData: 0X9
971  Development / Other Software Development / New fast digital I/O and Software SPI libraries on: August 05, 2012, 07:18:50 am
I posted new fast I/O libraries as DigitalPinBeta20120804.zip http://code.google.com/p/beta-lib/downloads/list.

The libraries support standard 168/328 Arduino, Mega, Leonardo, Teensy, Teensy++, and Sanguino.

The DigitalPin class provides very fast inline functions. DigitalPin is a template class and pin numbers must be specified at compile time. 

For 328 pins and low address Mega pins read(), toggle(), and write() execute in two cycles or 125 ns for a 16 MHz CPU.  This is about thirty times faster than digitalWrite() which executes in about 4 usec.

The main member functions for the DigitalPin class are:
Code:
void config (bool mode, bool level);
void high ();
void low ();
void mode (bool pinMode);
bool read ();
void toggle ();
void write (bool value);

The library also contains these static inline functions similar to digitalRead()/digitalWrite().  Pin number must be a constant.
Code:
static bool fastDigitalRead (uint8_t pin);
static void fastDigitalToggle (uint8_t pin);
static void fastDigitalWrite (uint8_t pin, bool level);
static void fastPinConfig (uint8_t pin, bool mode, bool level);
static void fastPinMode (uint8_t pin, bool mode);

There is also a Software SPI class that runs at about 2 MHz.  It is a template class with compile time pin numbers and SPI mode.  Modes 0 - 3 are supported MSB first.  LSB first would be easy to implement.

The member functions are:
Code:
void begin ();
uint8_t receive ();
void send (uint8_t data);
uint8_t transfer (uint8_t txData);

There is also a class, DigitalIO, with run-time pin numbers.  It is much slower than the  above DigitalPin class but is 3 - 4 times faster than the Arduino digitalRead()/digitalWrite() functions.
972  Development / Suggestions for the Arduino Project / Re: How about adding digitalToggle(pin)? on: August 04, 2012, 04:25:45 pm
I posted a new version of fast I/O libraries with toggle() as DigitalPinBeta20120804.zip http://code.google.com/p/beta-lib/downloads/list.

The libraries support standard 168/328 Arduino, Mega, Leonardo, Teensy, Teensy++, and Sanguino.

The DigitalPin class provides very fast inline functions. DigitalPin is a template class and pin numbers must be specified at compile time. 

For 328 pins and low address Mega pins read(), toggle(), and write() execute in two cycles or 125 ns for a 16 MHz CPU.

The main member functions for the DigitalPin class are:
Code:
void config (bool mode, bool level);
void high ();
void low ();
void mode (bool pinMode);
bool read ();
void toggle ();
void write (bool value);

The library also contains these static inline functions similar to digitalRead()/digitalWrite().  Pin number must be a constant.
Code:
static bool fastDigitalRead (uint8_t pin);
static void fastDigitalToggle (uint8_t pin);
static void fastDigitalWrite (uint8_t pin, bool level);
static void fastPinConfig (uint8_t pin, bool mode, bool level);
static void fastPinMode (uint8_t pin, bool mode);

There is also a Software SPI class that runs at about 2 MHz.  It is also a template class with compile time pin numbers and SPI mode.  Modes 0 - 3 are supported MSB first.  LSB first would be easy to implement.

The member functions are:
Code:
void begin ();
uint8_t receive ();
void send (uint8_t data);
uint8_t transfer (uint8_t txData);
973  Development / Other Hardware Development / Re: Pitolino - a small data logging gadget on: August 04, 2012, 02:56:50 pm
florinc,

I just posted a new version of the fast I/O libraries as DigitalPinBeta20120804.zip  http://code.google.com/p/beta-lib/downloads/list.

Standard 168/328, Mega, Teensy, Leonardo, Teensy++, and Sanguino are supported.
974  Using Arduino / Storage / Re: Arduino Mega 2560 W5100 Ethernet Shield and SdFat library on: August 04, 2012, 02:51:57 pm
I don't think a MMCmicro card will fit a microSD socket.

I looked at the status and the the reason ACMD41 failed is "com CRC error".  This should never happen since CRC is disabled by default for SPI access.

I have seen a similar problem with one card, an Eye-Fi card.

The latest SdFat supports CRC but it slows access.

Try editing SdFatConfig.h and make this change
Code:
#define USE_SD_CRC 2
975  Using Arduino / Storage / Re: Arduino Mega 2560 W5100 Ethernet Shield and SdFat library on: August 04, 2012, 01:10:09 pm
The error occurs in the card identification part of initialization.  The command that fails is called ACMD41. 

Any chance you are using a MMC card?

This command ACMD41 is not supported by MMC cards and the SdFat and SD.h libraries do not support MMC cards.
Pages: 1 ... 63 64 [65] 66 67 ... 110