Pages: 1 ... 6 7 [8] 9 10 ... 13   Go Down
Author Topic: SD card read/write with Arduino  (Read 88022 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 44
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody..

I would like to change the pin select  SS 10 (because 10,11,12,13 is yet busy );

for example define Slave Select 8

..do you know how to make this...?  
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Quote
Posted by: breenmachine
A few people have noticed that your writes to the card "dissappear" after restarting the Arduino. The block size is set up to be 512 bytes, and in the code on the first page, a 512 byte buffer is kept, once it is full, it is written out to the card.

This can be trivially disabled so that all writes are written to the card immediately (no buffering). Just open up "sd_raw_config.h" and look for the line:
#define SD_RAW_WRITE_BUFFERING 1
change it to
#define SD_RAW_WRITE_BUFFERING 0

and you should be all set...dunno if someone else already posted this but I saw the question asked and couldn't find the answer myself so I decided to take a look at the code.


If this is true you just saved me a lot of trouble  ;D
Can this be done with the read function as well? I think a 512 byte buffer gets filled there too.
« Last Edit: April 07, 2009, 10:33:41 pm by smelios » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried changing

#define SD_RAW_WRITE_BUFFERING 1
to
#define SD_RAW_WRITE_BUFFERING 0

with no luck, does that header file need to be recompiled or can i just change it and save?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

recompile recompile, restart the arduino IDE
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry im a noob when it comes to this stuff. I opened sd_raw_config.h in microsoft visual c++ 2005 and the option to recomplie isn't available. What should I do?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Err... I meant to restart the Arduino executable... that you use to write code and upload to the board with.
Logged

USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
ClockTHREE Rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You rock!

I just got this working out of the box.  Nice job and thanks!

Justin
smiley-grin
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

im wondering if would be possible to bootload the arduino from the SD card. The arduino recieves its sketch through the tx and rx pins right so theoretically if you had a 2 cores one to read the sketch and transmit it to the arduino and the arduino itself it could be used as a bootloader.
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What would be the benefit of this? The sketch residing on SD card instead of internal flash memory?
Logged

Denver
Offline Offline
God Member
*****
Karma: 19
Posts: 778
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I could think of one advantage. If you had a commercial product the users could upload "new versions" themselves. Dribbleware!  smiley-grin
Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Right, good point. A user upgrade would consist in copying the hex file on the SD card, easier than asking the user to go through the Arduino IDE.
Logged

From:0x000000
Offline Offline
Full Member
***
Karma: 0
Posts: 213
sudo make me a (bread+ham+lettuce+cheese+bread)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ummm...
I tried the example code after installing the library, and i get:
Code:
from D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:13:

D:\Program Files\arduino-0017\hardware\libraries\SDcard\/sd_raw_config.h:86:6: error: #error "no sd/mmc pin mapping available!"

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp: In function 'uint8_t sd_raw_init()':

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:167: error: 'configure_pin_mosi' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:168: error: 'configure_pin_sck' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:169: error: 'configure_pin_ss' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:170: error: 'configure_pin_miso' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:172: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:198: error: 'select_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp: In function 'uint8_t sd_raw_read(uint32_t, uint8_t*, uint16_t)':

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:418: error: 'select_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:423: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:455: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp: In function 'uint8_t sd_raw_write(uint32_t, const uint8_t*, uint16_t)':

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:663: error: 'select_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:668: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:689: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp: In function 'uint8_t sd_raw_get_info(sd_raw_info*)':

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:809: error: 'select_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:814: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:863: error: 'unselect_card' was not declared in this scope

D:\Program Files\arduino-0017\hardware\libraries\SDcard\sd_raw.cpp:908: error: 'unselect_card' was not declared in this scope

Its a Shame it didn't work...Can someone tell me what i did wrong?
Also, I have a question, What would happen if you disconnect the card and connect it into a card reader?
Would it show up as a TXT file or a file without extension or will you have to use a "disk editor" to manually see the bytes and sectors of the stick?
Logged

From:0x000000
Offline Offline
Full Member
***
Karma: 0
Posts: 213
sudo make me a (bread+ham+lettuce+cheese+bread)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And i have another question, How do i connect my SD card?
Do i need to buy one of the shields out there?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi ! I'm new in the forum.
First : thanks for this tutorial It looks like very easy to follow.
I just have 2 questions :
I have a handful of 470 and 180 Ohms resistors, is that possible to replace the 1.8kO by a 180O  and the 3.3kO by a 510O. In theory it's OK :
Vout = Vin x R2/(R2+R1)
Vout = 5 x 470/(470 + 180)
Vout = 3.62V

My 2nd question : Is the Arduino has a 3.3V output to connect the 4th pin of the SD card ?

Bye.
Montspy.
« Last Edit: September 26, 2009, 02:54:39 am by Montspy » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have followed the instructions 1:1, compiled the demo sketch, but can never manage to get over "MMC/SD initialization failed". Is there a problem with Arduino Duemilanove ATMega328?

The SD Card is fat16 formatted...

In desparate need for an answer,
fritz
Logged

Pages: 1 ... 6 7 [8] 9 10 ... 13   Go Up
Jump to: