Go Down

Topic: Weird Result for same shiftin shiftout Sketch Between Arduino Zero and Uno (Read 367 times) previous topic - next topic

hhbcd

I need to control a sensor with weird SPI interface, which need 18 bits to write an internal register and more bits to read. I decided to use soft shiftout and shiftin.

I have proved my idea with arduino UNO on both digital PIN and analog PIN. It works perfectly for reading and writing.

However, when I changed my board to Arduino Zero, weird things happens.(I know the output voltage is different, I add a discrete level converter board to convert between 3.3 and 5V.)

The sketch complied without any warning and uploaded. However, It becames such a mess in the register. It is  just not right.... I used a oscilloscope to monitor the generated signal and it in the correct logic.   

At first I doubt that the soft SPI might be too fast since UNO works at 8MHZ and Zero at 48MHZ. I add a lot of delaymillisecond for bit shift yet it still does not works...

I am stucked here...  If any one knows any difference between these two board and what could cause these problem, millions thanks!!

Sulimarco

Hi,

I think you have to post some info:

1) Your sketch.
2) The schematic of the level converter.
3) Scope traces that show clk, cs, miso, mosi signals.
4) Info about the sensor that you are trying to interface.

Marco

hhbcd

First of all, thank you for your reply.

As for the sketch, it is pretty simple. No other library and stuff. Pure shiftin and shiftout. And as I said, it works on Arduino UNO, which is a proof that the code works.

Later, I even tried to use pure bit shift operation on the pin, still UNO is good but Zero isn't.

Tried both digital PIN and Analog PIN, no luck for me.

That's why I I wonder if anything is different between these two platform causes the trouble.

As for the level converter, I use the one from Sparkfun.



Hi,

I think you have to post some info:

1) Your sketch.
2) The schematic of the level converter.
3) Scope traces that show clk, cs, miso, mosi signals.
4) Info about the sensor that you are trying to interface.

Marco

Go Up