Go Down

Topic: Dataflash issues with Due (Read 928 times) previous topic - next topic

joshuaj

Using 1.5.2 IDE with a Due.

Code won't compile:

Code: [Select]
#include <SPI.h>
#include <DataFlash.h>
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:
 
}



I get these errors:
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp: In member function 'void DataFlash::setup(int8_t, int8_t, int8_t)':
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp:151: error: 'SPSR' was not declared in this scope
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp:151: error: 'SPI_2XCLOCK_MASK' was not declared in this scope
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp:152: error: 'SPCR' was not declared in this scope
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp: In member function 'void DataFlash::begin()':
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp:176: error: 'SPCR' was not declared in this scope
C:\Arduino\arduino-1.5.2\libraries\dataflash\DataFlash.cpp:177: error: 'SPSR' was not declared in this scope

Anyone successfully using this library with Due? Thanks for any help!

Grumpy_Mike


joshuaj

#2
Mar 21, 2013, 06:18 pm Last Edit: Mar 21, 2013, 06:26 pm by joshuaj Reason: 1
https://github.com/BlockoS/arduino-dataflash

Grumpy_Mike

Thanks.

It seems to use the normal SPI library and the problem with that is that it is talking directly to the hardware registers of the processor. On the Due those registers are simply not present in the same location with the same bit meanings.
To further complecate the matter the Due's SPI pins are not on the same pins as a normal Arduino but are on a pin header, the one just above the Arduino Logo.

So the whole thing needs a bit of a rewrite I am afraid.  That is the problem with libraries that talk direct to hardware, when the hardware changes the rug is pulled from underneath it.

joshuaj

Thanks for looking at that Mike.

So I'm using the SPI library for other devices on the Due currently and that works. The 1.5.2 IDE takes into account weather you are using an AVR or SAM device and includes the proper library..  Dataflash includes SPI but the compiler does not find it so I #included it.. Seems like there's a linking problem but I don't have any expertise here..

Thanks!
Josh

Grumpy_Mike

I get
Quote
ataFlash_test.cpp:4:24: error: test/Dummy.h: No such file or directory

When I compile the sector erase example with 1.5.1
And the same when I try it with 1.0.3 for a Uno. I just think it is a rubbish piece of code.

Go Up