I'm currently trying to interface a CS5530 ADC to a raspberry pi 4b 8g using SPI. When I attempt to communicate with the ADC I repeatly get return bits that make no sense and am running out of ideas to trouble shoot. When using the Spidev-test script I'm recieving the following response:
spi mode: 0x4 bits per word: 8 max speed: 2000000 Hz (2000 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D
RX | FF FF FF FF FF FF FF F8 00 00 00 27 F8 00 00 00 27 F8 00 00 00 27 FF FF FF FF FF FF FF FF FF FF
As you can see there's something causing the MISO line to be recieving incorrect bits. If I use a jumper from MOSI to MISO to the bits return as should be expected. I've tried different clk speeds while staying under 2MHz as that is specified as the make clk speed in the cs5530 data sheet. I'm also recieving similar junk back using the spidev libary in python.
I'm thinking the most likely problem I have is for some reason the clk on the rpi isn't producing a proper signal. I don't own logic analyser (thinking I'll properlly have to order one) so I've mapped the signal the best I can using piscope.
I'm a novice at this sort of thing but it looks to me that the clk line is all over the show instead of regular sine wave you'd expect to see there. I'm not sure if this is what's casuing me issues or if it's due to the limitations of piscope.
So while I think I've found the cause of my issues I'm about out of ideas of what could be causing this issue and how to fix it. So far all the things I've tried when trying to troubleshoot this is:
- Swapping out Raspberry Pi's - Problem presists exactly the same.
- Swapping out cs5530
- checked all my solders on the prototyping board and continuity between all points, test resistor values and cap's are all at correct values. Swapped crystals due to not having a scope to test it.
- Tested the cs5530 at both 3v and 5v modes (using an external power supply)
- Grounded rpi to external power supply
- Tried running a cs5530 off rpi 3.3v supply
- set core_freq=250 on rpi
- set dvfs=2 to rpi to prevent any issues caused by core being under voltaged
- tested on spi0 (CE 0 and 1) and spi1
temp was 53 degrees when the tests in the pictures where done so I think I can rule out thermal throttling as well. At this point I'm completely out of ideas what else to try. Might be worth noting that I am booting off a high quality 16gb USB flash drive, I haven't bothered coping the img to a sd card just yet as I wouldn't have thought that this would be causing any problems but I might try it just to fully rule that possiblity out.
Thanks in advance for any help, hoping that there's someone much smarter than me out there that can shine some light on this for me.