Kranvonkyln:
digitalWrite(SS, LOW);
for (const char *p="Hello\n"; c = *p; p++){
SPI.transfer(c);
digitalWrite(SS, HIGH);
delay (500);
}
Looking at this piece of code, you pull SS low, transfer code, pull SS high, transfer code again, pull SS high, etc. You never pull SS low again, so you wouldn't be able to transfer anything.
pylon:
Mega2560 and M0 have different voltage levels. Do you use level converter for all SPI signals?
If you connected them directly check the pins on the M0 for damage as the 5V of the Mega2560 are over specs.
What do you mean with different voltage levels? No I'm not using level converter.
aapatil:
Looking at this piece of code, you pull SS low, transfer code, pull SS high, transfer code again, pull SS high, etc. You never pull SS low again, so you wouldn't be able to transfer anything.
Yes, my bad. I took SS high out of for loop but it didn't help.
What do you mean with different voltage levels? No I'm not using level converter.
The Mega2560 runs on 5V so do all of it's IO signals. The M0 runs on 3V3 and so do all it's IO signals. If you put 5V to one of the pins of the M0 you might fry it.
BTW: we haven't seen your wiring diagram yet. Did you connect the GNDs?
Yes i connected the GND, I'm posting my wiring. That's M0 and Mega 2560 in my program there is no M0.
About voltage level, M0 works fine so I think i didn't fry it. Can the different voltage level be the issue ?
I feel so stupid, thank you very much, I've used wrong Pins. Now when I'm using ICSP it works. Can I ask one more question? Over SPI go 8Bit how can I transfer 12 Bit?