Pages: [1]   Go Down
Author Topic: SPI or SD library problem?  (Read 1591 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino DUE rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could figureout if the problem is related with the SPI or the SD library, but using the example sketch "listfiles" if a pinMode(53, OUTPUT); comand is on the code next time I try to upload any sketch I get this error:

No device found on COMx

I have to take the power from DUO out and in again so the upload works ok and all came back to normal.

If I have pinMode(52, OUTPUT); insted, them anything related to SD fails, so this example sketch gives me:

"Initializing SD card...initialization failed!"

Didn't try with further more pins to see what hapends.
Logged

Check all my projects based on Atmel/Arduino -> www.aqualed-light.com

Venezuela
Offline Offline
Sr. Member
****
Karma: 12
Posts: 433
Ground.......ground........always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hola Baltasar. Not sure but I think is a SPI issue.
According to DUO variant.h, SS pin is 77. I think you are playing with MEGA pins SCK(52) and SS(53). Try 77 and see.
Here SPI DUO MEGA for comparison:

 * DUE Board pin   |  PORT  |
 *  74       MISO  |  PA25  |
 *  75       MOSI  |  PA26  |
 *  76       SCLK  |  PA27  |
 *  77       NPCS0 |  PA28  |

 * MEGA Board pin   |  PORT |
 *  50       MISO   |  PB3  |
 *  51       MOSI   |  PB2  |
 *  52       SCK    |  PB1  |
 *  53       SS     |  PB0  |
Logged

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

Hi, I think I did not explain it correctly, the problem is not the SS pin for using the SD or any SPI comunication.

What I want to say is if apart your normal working code for SPI/SD by some extra need on your sketch you use those pins (53 or 52) on a pinMode comand those problems show up.

Just do the test or anyone else to understand better, open the "listfiles" example from SD library, them see it working, upload it again and still working ok? Them put on void setup this pinMode(53, OUTPUT); and upload again, stiill working right? Now reupload again the same code and you will get a "No device found on COMx" erro and couldn't upload any further sketch without power out the DUO first, thats it.
« Last Edit: November 06, 2012, 10:58:47 am by Baltasar » Logged

Check all my projects based on Atmel/Arduino -> www.aqualed-light.com

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using the programming port of the Due (the one next to the power plug, should work even if the ARM program has crashed) or the native port?
Logged

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

Yes I'm using the USB port near the power plug.

It's easy if someone can to do the test I said, like that I can confirm that is not only my problem and is really a general fault do the libraries or else.
Logged

Check all my projects based on Atmel/Arduino -> www.aqualed-light.com

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't do the test because the example doesn't compile, besides I don't have an SD slot attached..
Code:
listfiles:26: error: variable or field 'printDirectory' declared void
listfiles:26: error: 'File' was not declared in this scope
listfiles:26: error: expected primary-expression before 'int'
listfiles:23: error: 'File' does not name a type
listfiles.ino: In function 'void setup()':
listfiles:41: error: 'SD' was not declared in this scope
listfiles:47: error: 'root' was not declared in this scope
listfiles:47: error: 'SD' was not declared in this scope
listfiles:49: error: 'printDirectory' was not declared in this scope
listfiles.ino: At global scope:
listfiles:59: error: variable or field 'printDirectory' declared void
listfiles:59: error: 'File' was not declared in this scope
listfiles:59: error: expected primary-expression before 'int'
Logged

Pages: [1]   Go Up
Jump to: