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!!