SPI communication

Hi @ all,

I was trying to send data to a motion controller via SPI with the FEZ Hydra+ and Reptor, but it doesn’t work.

So I analyzed the Protocol on the SPI lines (see Screenshot).
There I saw that there are a lot of spikes on the other lines (channel 0 in this screenshot) and also on the MOSI, MISO and CS lines, as you can see on all the small spikes in the signal, and that’s only a frequency of 1MHz. I want to use 8MHz clock speed.

Is that normal for these boards?

Boards:
FEZ Raptor .NET micro framework 4.3
FEZ Hydra+ .NET micro framework 4.3

Thanks
Patrick

Disconnect everything except your analyzer and send 0x55. Does everything look normal?

We know spi works but not sure what you are seeing.

Welcome to the community.

Thanks

Only the analyzer was and is connected to the board.
If I connect it to the motion controller there are much more spikes.

In the attachment is the screenshot for the 0x55 package.

Thanks
Patrick

Sorry about the stupid question but is ground connected?

That’s no stupid question.

But in this case the ground was connected.

On a second thought, miso should be ignored because it is an unconnected input. Everything else looks normal.

I think the Chip Select (CS) looks strange.
It should not have these spikes during the transmission, right?

Correct. I still think it is noise and bad grounding.

No. The spikes shouldn’t be at the CS line and also not at the line which I set LOW (channel 0). I have marked the spikes red in the screenshot.

I have try the same with an Arduino Due and it looks fine (Screenshot --> Unbenannt1.png).
On the Arduino Due I have modified the protocol (sending 5 bytes without breake).

Which pin is being used as CS?

PIN: PA13 (not the same connector as the SPI connector)

Code:
OutputPort Start = new OutputPort(GHI.Pins.G400.PA14, false);
//OutputPort CS = new OutputPort(GHI.Pins.G400.PA13, false);

SPI.Configuration MyConfig = new SPI.Configuration(GHI.Pins.G400.PA13, false, 0, 0, true, false, 1000, SPI.SPI_module.SPI1);
SPI MySPI = new SPI(MyConfig);

Start.Write(true);
//Thread.Sleep(1);
Start.Write(false);

byte[] tx_data = new byte[] { 0x55 };
byte[] rx_data = new byte[1];

//CS.Write(false);
MySPI.WriteRead(tx_data, rx_data);
//CS.Write(true);

while (true)
{
//CS.Write(true);
//Thread.Sleep(27);
//CS.Write(false);
//Thread.Sleep(11);
}

Disconnect everything. Connect the spi out pin to the input pin. Send some data and see if you are getting it correctly. Verify that the chip is powered properly.