Problem with SPI Flash AT25DF512C
-
Hi
I have a problem with a AT25DF512C SPI flash module. Using the SPIFlash library I can initialize the flash but when I try to read the device ID it is zero. Also if I write data and then read it back it is also zero.
I'm using an ATMega328P-AU TQFP. The flash CS is connected to A2 (16). MOSI, MISO and SCK connected normally. CS has a 4.7k pullup.
Any ideas why the SPI only returns zeros? Please see my schematic at: https://www.openhardware.io/view/348
//Martin
-
There is no obvious errors in the schematics, so a couple of things to do is:
- Check wiring, soldering etc.
- Verify DAC functionality (as it is using SPI bus as well).
-
I have checked wiring and soldering. The radio is working but I will for sure verify the DAC.
-
sorry, yes.. Radio is also on the SPI bus..
Then I'm out of ideas..
-
The DAC worked as well so there is only a problem with the SPI Flash. I even replaced the chip but get the same result. Maybe a software issue then.
-
what address do you use for it in the SPIFlash lib example?
For this chip, this should be 0x1F65 or you can remove the address, it works too.
But with Mysensors, it should work out of the box.
Works for me for both libs.
Then, it's hardware. but i would bet your problem is the address..
-
@scalz if I add the address I get "Init FAIL".
-
SPI flash does not use an address to select the chip, as it has the CS line..
It's an JEDEC id, that identifies the chip vendor etc, and it seems that the SPIFlash library disables access, if the chip isn't identified correctly, according to this line in the spiflash library
@mardah try setting the jedec id to 0.
-
@tbowmo I'm getting pass the initialize which returns true. Since I don't provide a jeedec id it defaults to 0. When I later try to read jeedec I'd from the flash it returns 0 as well.
-
have you tried with another board, but with only the at25 populated on the spi bus?
-
I hooked up a logic analyzer and discovered that there was no activity on SCK, MOSI and MISO when trying to use the SPI Flash.
Wrote my own sketch that only reads the jedec id from the SPI Flash and it worked. Must be something with the SPIFlash lib version.
Attaching a screenshot from the logic analyzer showing the jedec id read from the SPI Flash.
-
I found the problem: https://github.com/LowPowerLab/SPIFlash/issues/16
The sketch I used to verify the SPI Flash was missing a SPI.begin() in setup().