Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Problem with SPI Flash AT25DF512C
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

Problem with SPI Flash AT25DF512C

Scheduled Pinned Locked Moved Hardware
12 Posts 3 Posters 2.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mardah
    Hardware Contributor
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • tbowmoT Offline
      tbowmoT Offline
      tbowmo
      Admin
      wrote on last edited by
      #2

      @mardah

      There is no obvious errors in the schematics, so a couple of things to do is:

      1. Check wiring, soldering etc.
      2. Verify DAC functionality (as it is using SPI bus as well).
      1 Reply Last reply
      0
      • M Offline
        M Offline
        mardah
        Hardware Contributor
        wrote on last edited by
        #3

        I have checked wiring and soldering. The radio is working but I will for sure verify the DAC.

        1 Reply Last reply
        0
        • tbowmoT Offline
          tbowmoT Offline
          tbowmo
          Admin
          wrote on last edited by
          #4

          sorry, yes.. Radio is also on the SPI bus..

          Then I'm out of ideas..

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mardah
            Hardware Contributor
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • scalzS Offline
              scalzS Offline
              scalz
              Hardware Contributor
              wrote on last edited by
              #6

              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..

              M 1 Reply Last reply
              0
              • scalzS scalz

                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..

                M Offline
                M Offline
                mardah
                Hardware Contributor
                wrote on last edited by
                #7

                @scalz if I add the address I get "Init FAIL".

                1 Reply Last reply
                0
                • tbowmoT Offline
                  tbowmoT Offline
                  tbowmo
                  Admin
                  wrote on last edited by
                  #8

                  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.

                  M 1 Reply Last reply
                  0
                  • tbowmoT tbowmo

                    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.

                    M Offline
                    M Offline
                    mardah
                    Hardware Contributor
                    wrote on last edited by
                    #9

                    @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.

                    1 Reply Last reply
                    0
                    • scalzS Offline
                      scalzS Offline
                      scalz
                      Hardware Contributor
                      wrote on last edited by
                      #10

                      have you tried with another board, but with only the at25 populated on the spi bus?

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mardah
                        Hardware Contributor
                        wrote on last edited by
                        #11

                        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.

                        0_1488979635928_Skärmavbild 2017-03-08 kl. 14.24.04.png

                        1 Reply Last reply
                        2
                        • M Offline
                          M Offline
                          mardah
                          Hardware Contributor
                          wrote on last edited by
                          #12

                          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().

                          1 Reply Last reply
                          3
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          10

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.0k

                          Posts


                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • OpenHardware.io
                          • Categories
                          • Recent
                          • Tags
                          • Popular