Data exchange problem

Then you need level converters or you will (or already have) damage your ChipworkX module.

Hello Gus,

We ordered some level converters. Thank you for you’re help.

Hello,

We received our level converter today, but are still having problems using SPI. We ordered the level converter at one of you’re dealers [url]http://www.antratek.nl/3V-converters.html[/url].

I connected an scope and see the some image as yesterday. I also changed the CWX processor to check if SPI is broken. But nothing helps…

Are there any other problems we don’t know about?

I looked a bit further in solving our problem and found out, that the Microchip Pictail MCP2515 Daugther board can also work on VCC instead of VSS. So I tried using 3V3 instead of 5V, but still nothing happens. Can somebody help me?

Hello,

I now used again the same code on the FEZ, but with the difference that I use 3V3 instead of 5V. And this also works!

Well I don’t have the board you use that is connected to the SPI bus, so I can’t help you directly.

What I might try to take a look at is the RLP code. I found the code you are using on the Wiki but I’m not sure exactly what you replaced and how you modified the make file. Maybe you could post your code as a .zip file link so I could take a look?

When working with RLP it really helps to have a jtag adapter with that you can also just run the elf binary with some test code to see if it’s doing what you want it to do. If you need to debug SPI and CAN bus transfers I really suggest you get a logic analyzer… I got mine for 99€ including 30 free bus protocols http://tinyurl.com/blt3up9 (the list of modules is a bit dated, they now have USB2.0 as well for example),it’s a lot faster than using a DSO.

Today we finally got our new testing equipment and we hooked it up to check our SPI problem.

When wiring the MCP2525 PICTAIL daughterboard to our FEZ domino, we see the expected data on the SPI interface.
Please take a look at these screenshots from our analyzer:
[url]http://www.panjer.it/FEZ_Reset.png[/url]
[url]http://www.panjer.it/FEZ_ConfigMode.png[/url]
[url]http://www.panjer.it/FEZ_CNF1.png[/url]
[url]http://www.panjer.it/FEZ_CNF2.png[/url]
[url]http://www.panjer.it/FEZ_CNF3.png[/url]

However, if we wire the PICTAIL to CWX, I get what I expect on MOSI, but MISO is a different story. For some reason, the data received is different than the data sent. Please see the CWX screenshots as well:
[url]http://www.panjer.it/CWX_Reset.png[/url]
[url]http://www.panjer.it/CWX_ConfigMode.png[/url]
[url]http://www.panjer.it/CWX_CNF1.png[/url]
[url]http://www.panjer.it/CWX_CNF2.png[/url]
[url]http://www.panjer.it/CWX_CNF3.png[/url]

we have already spent the entire day on this problem and dont know what we are missing here.
We are using the same code for FEZ as CWX, with the exception of the SPI pins. The code we use can be found here:

[url]http://www.panjer.it/MCP2515_v0.40.rar[/url]

Thaks for all your help!

Please disconnect whatever you have on SPI, write a simple program that sends a known set of data the observe the data one domino and on chipworkX and let us know (with example code) if you see data corruption.

Just out of curiosity, what’s the logic analyzer you are using?

Since the communication you have problems with is the pictail → CWX direction I don’t think I can help you with anything unfortunately… at least unless I get the same board you are using.

I might actually be interested in this project since I ordered (at lextronic.fr) a Panda II which I’m planning to use as a CWX extension. I was initially thinking to use RS485 for intercommunication (it’s available on both without extra HW) but I might consider trying the same CAN approach you took.

I assume you are using this CAN shield from Sparkfun? http://www.sparkfun.com/products/10039

I’d really appreciate if you keep us informed about your project and should I get these components anytime soon (lextronic.fr is unfortunately very slow on delivery) I’d be happy to help you out.

Hi Xycon,

I will post my experiences on this board.

The analyzer is the Logic16 from Saleae: Logic Analyzers from Saleae - #1 with Professional Engineers
The pictail board is not the one you have ordered, but this one:
http://ww1.microchip.com/downloads/en/DeviceDoc/51762a.pdf

Pretty much the same thing you’e ordered right?

If there is anything you could think of, please let me know. This is driving me crazy!

Thanks!

I’m affraid I don’t understand. How can I reproduce the problem when there is nothing on the SPI interface? I mean, what device is going to send something back? As you can see in the screenshots, the MOSI data is correct. It’s the received data on MISO that is diffrent.

Good, so data out is fine along with clock signal. Now connect your slave and show us where the problem is please.

I think you can see this by comparing these two screenshots:

[url]http://www.panjer.it/FEZ_ConfigMode.png[/url]

and

[url]http://www.panjer.it/CWX_ConfigMode.png[/url]

Pay attention: due to my own stupidity, I swapped MISO and MOSI pins on the analyser.

I use the same code to send the data; just commenting / uncommenting these lines:



//var config = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.IO3, LOW, 0, 0, LOW, HIGH, 4000, SPI.SPI_module.SPI2);

var config = new SPI.Configuration((Cpu.Pin)ChipworkX.Pin.PA22, LOW, 0, 0, LOW, HIGH, 4000, SPI.SPI_module.SPI2);


Any thoughts?

It doesn’t look like it is the same data being transmitted on both screen shots you posted. MOSI pin is an input on your slave so if you have something connected or not, it should NEVER change the data coming out from the master.

I don’t understand what you mean.
In the Fez screenshot, you see 0x3, 0xE, 0xE on MOSI.
On MISO, you get 0x3, 0xE , 0x80 as a response. According to the datasheet of the MCP2515, this is correct.

If you take a look at the CWX screenshot, you also see 0x3, 0xE, 0xE on MOSI, but on MISO I get 0x00, 0x00, 0x80.

So unless I’m wrong, the same data is beeing send out of both masters, but the response is diffrent.
The MISO data is beeing generated by the slave, isn’t it?

How could this happen? ???

You are right. I am not sure how I saw it different!

Is your slave powered with 3.3V or 5V

The MCP2515 works on 5V and 3V3. So we tried both.

I will make some new screenshots when the slave is connected to 3V3.

Well, the screenshots are viewable at:

http://www.panjer.it/CWX_Reset_3v3.jpg
http://www.panjer.it/CWX_ConfigMode_3v3.jpg
http://www.panjer.it/CWX_CNF1_3v3.jpg
http://www.panjer.it/CWX_CNF2_3v3.jpg
http://www.panjer.it/CWX_CNF3_3v3.jpg
http://www.panjer.it/CWX_SetCanControl_3v3.jpg
http://www.panjer.it/CWX_ReadCanStatus_3v3.jpg

The result is the same.

For those who are interested:

I have discussed this issue directly with Gus. In order for him to reproduce this behaviour, he needs a MCP2515 PICTAIL Daughterboard like mine.

I have ordered this board today from Digikey and had it shiped to GHI directly.

Hopefully they can come up with a solution.

I will post on the forum again as things progress.

Is it this board you are using?

http://tinyurl.com/cp6sfxq

I will actually have to order it from digi-key as the other one I linked earlier isn’t available at my hardware vendor until the new year.