Go Down

Topic: SPI returns a constant value (Read 3583 times) previous topic - next topic

gery49

Hello everyone!

I'm trying to read an ADNS-3090 chip with SPI on the MKRZero. For some reason I get back 7 for any requested value. The same code works without a problem on a MiniPro. Any ideas what might be causing this?

gery49

I have made a few mesurements with an oscilloscope and found that there is no signal whatsoever on the MOSI and MISO pins. The SCLK is generating a signal but there is no followup on the other pins like on the working (ProMini) version. What could be the reason for this? Is it possible that the pins are not configured correctly for the MKRZero?

sandeepmistry

Hi @gery49,

Could you please share a photo of your wiring?

Also, the MKRZero operates at 3.3V does your Pro Mini do the same? Is the ADNS-3090 a 3.3V or 5V device?

gery49

Hey!
The ADNS3090 and the ProMini are both 3.3V devices too. I could make a picture of the wiring but there wouldn't be much to see. SCLK is connected to the SCLK pin on the schip, MOSI to MOSI and so on. The problem is that nothing appears on the MOSI and MISO pins of the MKRZero when I look at them with an oscilloscope.

sandeepmistry

Would you be able to share the sketch you are using?

gery49

I have managed to figure out what the problem was. The function that read the chip set the MOSI pin to output and back to input in its code. I didn't write this function, I don't know why it was there but it confused the Mkrzero. It's pretty weird that the ProMini worked fine like this. Anyway... After removing this two lines it works fine.

Thank you for your replies :)
Have a nice day!

Go Up