I've tried changing the clock speed (due has a faster clock and it can be divided by any number between 1 and ). but still can't see anything happening on the slave end.
then i've realized that with arduino 1.6 IDE there where some changes in the SPI library.
is there anyone that has tried this examples in the new IDE? i just seem unable to figure it out.
I'm trying to set up an SPI communication with an FPGA. which i don't have (it's someone else's proyect). but i do need to test it. so i've been trying to use a second arduino for this porpoise.
i'm using a level converter between the Arduinos. for all signals but GND (i don't think it was necessary)
This appears to be a new topic (about SPI on the Due) so I have split it from the original one.
I haven't tested on the Due. Can you state what you mean by "couldn't work out how to try any of the examples that are shown there"? You copied and pasted them, and then what?
try some changes in speed (on DUE), try the example with interrupts, dind't work either.
So, i try changing the SS pins
At the bottom of your blog, there is some comments on changes in the implementation of the SPI library. It appears that the instruction SPI.attachinterrupts, is not to be used, but i don't get exactly what it does and why is it necessary in the slave example.
i guess that fixing the slave code, and the speed setting, i should be able to make it work.
i post this question in the other topic, because i think my problem is regarding the slave code, I implement it on de Mega 1280. which i guess should work with your example.
i couldn't find any differences in the usage of the SPI library with the DUE.
Ok, But I still think my problem is mainly in the Mega, which is the one acting as a slave.
Have you try this example codes with the 1.6 IDE library? I wish to understand better what to change in those examples to make them work in the new version of the library
The hello world example with Due as master and Mega as slave from Gammon's site works OK 'as is'. I tried it before without using any level shifter. I only use a plain flat cable with two 2x3 connectors. Handshake 1-to-1.
Sorry, but, did you try to load this as it is with the 1.6 IDE version?
isn't it dangerous for the DUE not use a level converter? (as i see it, The Mega output is a 5V HIGH signal)
could this be the reason why this examples do not produce the expected results?
in the example with increased an decreased number, i get the exactly same numbers in both cases. so, i don't really know if the problem is with the signal out, or with the signal in. (could you explain that to me?)
iana:
isn't it dangerous for the DUE not use a level converter? (as i see it, The Mega output is a 5V HIGH signal)
You are completely right. SPI DUE IS NOT 5.0V tolerant but I did it for a quick test (about 6 months ago). I tried it with 1.58. Sadly I don't have a Mega at hand now (only Dues) but I can get one next week with a 4050. Thus, my recommendation is to try again the hello world example with the level shifter.
I did tried it with the level converter. and it didn't work, so i'm still thinking it has something to do with the IDE version. i think i'll try downloading an older version. just in case.
Make sure you have the proper connections, pin definitions and code on the Mega (I'm not familiar with it).
Note that SCK, MOSI and CS on the Due are outputs at 3.3V and should be sensed OK on the Mega. Only the MISO on the Mega is an output(5V) that needs level shifting or voltage divider. Don't forget to use the Due's extended SPI functions.
Do not set the SPI clock rate on the Mega ... SCK on the Mega is supposed to be an input when configured as a slave.
Suggest trying the default clock rate on the Due 4MHz or lower (1 or 2 MHz) to test.
Don't forget the GND connection between both boards.
The hello world example with Due as master and Mega as slave from Gammon's site works OK 'as is'. I tried it before without using any level shifter. I only use a plain flat cable with two 2x3 connectors. Handshake 1-to-1.
p
Hi,
Can you please share the link of the code with me?
Regards,
Abbas