void setup (void)
{
// have to send on master in, *slave out*
pinMode(MISO, OUTPUT);
// turn on SPI in slave mode
SPCR |= _BV(SPE);
} // end of setup
SPE bit just enables the SPI. You need to clear bit MSTR to set the slave mode.
The initial value of MSTR bit is 0 so by default the chip starts in slave mode.Well, yes, but I'm personally not sure that Arduino does not do something weird there.
The initial value of MSTR bit is 0 so by default the chip starts in slave mode.Well, yes, but I'm personally not sure that Arduino does not do something weird there.
Right not it look like you are fighting against another output driven to low level.
void setup (void)
{
// have to send on master in, *slave out*
pinMode(MISO, OUTPUT);
// SPI in slave mode
SPCR &= ~(_BV(MSTR));
// turn on SPI
SPCR |= _BV(SPE);
} // end of setupbut the signal is still loaded, faulty pin perhaps?I would not blame the hardware. Unless you have connected something wrong.
but the signal is still loaded, faulty pin perhaps?I would not blame the hardware. Unless you have connected something wrong.
Try making this device a master and check if it can output the clock on that pin.
Try enabling pull-up register (or use external one) on that pin when it is not connected to anything and measure a voltage. If pull-up manages to bring it all the way to 5V, then it is indeed an input.
It almost never hurts to put series resistors in uC outputs. I usually use 330 Ohm resistors.
These resistors make up for a log of misuses of outputs.
The slave should be configured as a slave and never drive the clock. The master should drive the clock and CS'. The slave needs to see CS'' to properly frame the transaction.
I'd check if this board has something else sitting on that pin. It looks like it is pulled low, but not hard, as MCU would. It looks like there is a pull-down resistor.
I'd check if this board has something else sitting on that pin. It looks like it is pulled low, but not hard, as MCU would. It looks like there is a pull-down resistor.
Then it is an output. And someone makes it this way.
Try with empty setup() and loop() functions.
It may be also set up by the bootloader.
If you are using Arduino UNO board, then SCK(PB5) pin is connected to some yellow LED. It may be a source if the problem.
I have Aruduino NanoIt has that LED as well.
but when I put a 1K resistor in series the clock now only drops by 0.2VoltsI'd just remove that LED.
I have Aruduino NanoIt has that LED as well.but when I put a 1K resistor in series the clock now only drops by 0.2VoltsI'd just remove that LED.
It's wierd that no one else complained and also there is no info on the net about this issue?I have no idea. It is too late and I'm too tired to figure out hoe exactly that LED affects things. I guess the issue is aggravated by the fact that you have LEDs on both sides, and not a lot of people connect arduinos like that.
It's wierd that no one else complained and also there is no info on the net about this issue?I have no idea. It is too late and I'm too tired to figure out hoe exactly that LED affects things. I guess the issue is aggravated by the fact that you have LEDs on both sides, and not a lot of people connect arduinos like that.
And it will probably work as is with lower level anyway. Lower level would be a concern if it was due to MCUs fighting. In this case it is due to LEDs, so not that important really.
I removed the 1K of one board but the problem still presists!! Its still loading the clock signal...I'd remove the other one as well.
As a side note, I wouldn't ever apply 5v, even through a resistor, to a 3.3V uC. The pins may be 5V tolerant under some circumstances but not under for all possible actions.Arduinos are 5V systems.
What happens with the clock when you completely disconnect the slave? At least you can isolate which board is causing the problem.
I know I have used Arduino Uno's for SPI and had no problems so there is something weird about your setup. The fact that you can't find similar topics on the Internet pretty much tells you that the problem is all yours. Nobody else is having this problem.
As a side note, I wouldn't ever apply 5v, even through a resistor, to a 3.3V uC. The pins may be 5V tolerant under some circumstances but not under for all possible actions.