Skip to main content
Rekha.k
Associate II
May 24, 2019
Question

How to interface STM32L151QD with MX25R6435F external flash memory using SPI?

  • May 24, 2019
  • 2 replies
  • 2666 views

interface STM32L151QD with MX25R6435F flash memory using SPI. But i found clock frequency of STM = 32MHz maximum and Flash mem frequency = 80MHz . so how to implement SPI interface between these two. Is it possible??? Do we have any example code???

This topic has been closed for replies.

2 replies

Andreas Bolsch
Lead III
May 25, 2019

Maybe read the flash's datasheet? Table 17 AC Characteristics says clearly: fSCLK from DC *UP TO* 33 MHz or DC *UP TO* to 80 Mhz depending on mode and instruction.

Rekha.k
Rekha.kAuthor
Associate II
May 26, 2019

Thank you Andreas. I read datasheet. it is clear now. but i am new to SPI implementation. Can you suggest how to start this activity???

Andreas Bolsch
Lead III
May 26, 2019

Depends on whether you want to learn or to copy: For the first option you could inspect the diagrams regarding RDID, RDSR, WREN, READ, CE and PP commands in the flash's datasheet carefully. Then implement SPI bitbanging (i. e. by using GPIOs only, without the hardware SPI!) first, in the order above: This way you will realize thoroughly how the SPI communication works. And only afterwards move to the hardware SPI (or as suggested below, QSPI on an F4/F7). Because without a good understanding of the SPI at bit level, it's hard to diagnose problems.

Starting with the RDID command is helpful, as the result is known: 0xC2, 0x28, 0x17. Then with RDSR and WREN check whether you can set the WEL bit successfully. READ, CE, PP can be tested only together, because without a known contents of the flash (distinct from the erased state) it's hard to tell whether the READ works as intended etc.

S.Ma
Principal
May 26, 2019

Would be easier to use an STM32 with QSPI support, then using a Discovery where a QSPI flash is present in SW project example, only reuse and tuning existing SW would be needed. QSPI will map the memory withiin the STM32 memory space by HW, allowing XIP (execute in place).

Rekha.k
Rekha.kAuthor
Associate II
May 27, 2019

sure i will try to adapt QSPI once after implementing generic SPI using GPIO.

Thank You...

MikeS1
Associate
October 6, 2020

Hi,

Can you share your implementation using the GPIO ?

I have the same problem using SPI.

Thanks,

Mikes

STM32F7