I have seen a couple of threads like this but so far I don't understand the problem so I'm hoping somebody can help me troubleshoot. I'm following this article with an Uno breadboarded to a 23LC1024 SPI SRAM chip:
This is my pinout:
Arduino -- 23LC1024 (PDIP pin)
D13 <------> SCK (6)
D12 <------> MISO (2)
D11 <------> MOSI (5)
D10 <------> CS (1)
5V <------> VCC (8)
5V <------> HOLD (7)
GND <------> VSS (4)
Notice I omitted the pullup resistor (5V <-10KR-> CS) because 1) I don't have one at the moment, 2) he indicates in the comments that you don't need it unless you have multiple devices on the SPI bus. (As an aside, couldn't you just use the internal pullups?)
Anyway, I'm using the sketch on that page, modified only to print the number of times through the loop alongside the value, and I get this:
Though I've seen other posts or threads where users are having problems with read errors, I haven't been able to attribute it to anything. To troubleshoot, I tried another 23LC1024 and another SRAM library I found on github, with similar results. What gives? Any suggestions appreciated
Please post your sketch, mark it all in the post and hit the "#" button so it is shown as code. It's impossible to guess what's going wrong. The code could give some hints.
As you say your not the first to report problems with these chips but the two I have have worked flawlessly for me when connected into breadboard. Try slowing down the clock speed to see if the errors go away or maybe you need better decoupling.
Some of those examples claim being for 23LC1024 but use 16 bit addressing - which results in weird to no results.
Make sure your address is uint32_t. Shift it out correctly, after sending WRITE / READ command to the ram first address >> 16, then address >>8 and then address.
But that is impossible to tell while there is no code to look at.
So the address argument appears to be uint32_t. I'm not sure how to slow it down, would that be with the SPI library I guess? I'll try to slow it down and report back, thanks
Ok so I tried changing the SPI speed with SPI.setClockDivider(SPI_CLOCK_DIV4) and then tried the other speeds all the way down to 128 but they all yield the same results Thanks for the suggestion though.
capsid:
Ok so I tried changing the SPI speed with SPI.setClockDivider(SPI_CLOCK_DIV4) and then tried the other speeds all the way down to 128 but they all yield the same results Thanks for the suggestion though.
Else if the pins are correctly connected to the Arduino, it should work.
// Chip UNO MEGA NAME
// 1 10 53 SS (Hardware SS Pin (10 [Uno] or 53[Mega]) needs to remain output no matter what other pin you may for SS)
// 2 12 50 MISO
// 3 NC NC
// 4 GND GND Vss
// 5 11 51 MOSI
// 6 13 52 SCK
// 7 +5V +5V ~HOLD
// 8 +5V +5V Vcc
Edit: Did you setup SPI correctly? Most Significant Bit First, ...
Maybe try different, shorter wires. 8 MHz are already a bit fast and can lead to problems with "old used" and long cables.
Ugggggggh I just got my friend to solder a chip up to a Pro Mini and the sketches work just fine. I guess this is just breadboard crappiness. I've definitely used these breadboards for many projects recently, including SD communication, but maybe if you're testing this RAM you're better off making solder connections.