Go Down

Topic: SPI or SD library problem? (Read 3933 times) previous topic - next topic


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.


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  |


Nov 06, 2012, 04:53 pm Last Edit: Nov 06, 2012, 04:58 pm by Baltasar Reason: 1
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.


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?


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.


I can't do the test because the example doesn't compile, besides I don't have an SD slot attached..
Code: [Select]

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'

Go Up