You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Ok, I think I know your problem. You've connected CS0 to B10, but have left CS1 disconnected?

    From the board it looks like there is no pull-up, so if you leave it disconnected it could be any value at all, which means that the second chip is probably trying to use the data pin occasionally - which might also explain your occasional bad readings.

    Try connecting CS1 to 3.3v. And if it still fails try disconnecting CS0 from B10 and connect it to 3.3v as well. That will stop the sensor working, but it'd be interesting to see if the SD card started working.

    Just so you know though:

    • When you do digitalRead(B10) to check it in your example above, that turns the output back into an input - so the value you read may not be the value that was on the pin - and it'll also then allow the CS pin to go to random values.
    • You can always just use software SPI on any pins of the Pico. It might be easier than trying to share pins between the SD card and the sensor)
About

Avatar for Gordon @Gordon started