Author Topic: STM32F4 and a 25Q128 (128MBit spi memory)  (Read 5011 times)

0 Members and 1 Guest are viewing this topic.

Offline MonostableTopic starter

  • Contributor
  • Posts: 18
  • Country: fr
STM32F4 and a 25Q128 (128MBit spi memory)
« on: October 13, 2015, 09:51:03 am »
Hello all

I am currently trying to add some memory to on of my project (using a STM32F4 Discovery), to do so, I ordered three 25Q128A, I printed three small adapter (see pictures 1).

I configured the SPI1 of the STM32F4  on the pins PA 5 6 7, and pin as an output to serve as CS (PE7), I placed the Pull-up / Pull Down resistor on the SClock and the CS as it was specified in the data-sheet.
The schematics are on picture 2.

I tried to read the manufacturer ID, and it just send back incoherent data (p36 of the data-sheet specify that it should output 0x20 and it just output whatever it wants).
Same goes for the Status Register.
As for the writting / reading it is even more random, I don't think I'm able to write in the memory.

At first I though it could be a cable disconnected or misplaced, so I got my oscilloscope and checked the signals (picture 3), and everything seems to be fine.
I tried on the three chips, so I guess the problem comes from me  :'(

I also included a link to the DATASHEET I use (there are two different but with similar content available on the internet)
I am starting to run out of things to try to make this chip work with my micro-controller, would you have any hint ?
 

Offline helius

  • Super Contributor
  • ***
  • Posts: 3642
  • Country: us
Re: STM32F4 and a 25Q128 (128MBit spi memory)
« Reply #1 on: October 13, 2015, 09:59:21 am »
How are you reading the SPI? The in and out bits are sent synchronously at the same time, so the MCU needs to send a byte of data to receive the response from the memory chip, after it has sent the command.
 

Offline MonostableTopic starter

  • Contributor
  • Posts: 18
  • Country: fr
Re: STM32F4 and a 25Q128 (128MBit spi memory)
« Reply #2 on: October 13, 2015, 10:02:05 am »
How are you reading the SPI? The in and out bits are sent synchronously at the same time, so the MCU needs to send a byte of data to receive the response from the memory chip, after it has sent the command.

I first send the command and then send a dummy byte, (as in picture 3, on this one the memory reply a simple 0x00)
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: STM32F4 and a 25Q128 (128MBit spi memory)
« Reply #3 on: October 13, 2015, 10:33:26 am »
Have you configured the STM32 to use the correct SPI mode for the 25Q128 (clock phase and polarity)?
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: STM32F4 and a 25Q128 (128MBit spi memory)
« Reply #4 on: October 13, 2015, 10:43:52 am »
Why the MOSI is so tiny wrt other?
 

Offline Scrts

  • Frequent Contributor
  • **
  • Posts: 797
  • Country: lt
Re: STM32F4 and a 25Q128 (128MBit spi memory)
« Reply #5 on: October 13, 2015, 01:27:29 pm »
Also chip select is set to high in the middle of the last clock cycle. It might push the SPI peripheral out of sync and it might be messy on the next transfer.
 

Offline MonostableTopic starter

  • Contributor
  • Posts: 18
  • Country: fr
Re: STM32F4 and a 25Q128 (128MBit spi memory)
« Reply #6 on: October 13, 2015, 02:02:39 pm »
Have you configured the STM32 to use the correct SPI mode for the 25Q128 (clock phase and polarity)?
Thank you so much! that was the problem !
I can't belive I overlooked that part ....
I feel so embarassed now.  :-[

Why the MOSI is so tiny wrt other?

The calibre is different, and I didn't bother changing it

Also chip select is set to high in the middle of the last clock cycle. It might push the SPI peripheral out of sync and it might be messy on the next transfer.
I have checked with cursor, and the CS goes high right after the last clock tick. (yellow signal)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf