cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure SMT32F072x uC to access to NAND Flash memory?

Texram
Associate III

I'm using a STM32F072x uC and would want to read/write/erase NADN flash (NAND04GW3B2B).

A couple of questions:

  1. How to configure GOIP pins as an Input and Output Data Bus (D0 - D7 or I/O0 - I/O7) ?
  2. What are the exact sequences to read, write, erase, etc?

Dose anyone have some example code as reference?

I know STM32F100x and STM32F30xxD/E uCs have FSMC built-in, but I don't have the choice on these.

Your input will be appreciated in advance.

David

3 REPLIES 3

Should be decades worth of code examples about how to access NAND memories of this type, including stuff related the linux uboot, etc that can be found online. Plus I'm sure this stuff is documented/described in contemporary data sheets. The memory accesses like a hard drive, the address space is split into a command and data window, and the data sucked out in blocks by doing repeated reads to recover each byte/word. The data blocks can be relatively large at an erase level, but the data itself often goes in a 2048+64 byte type mix of data and ecc/management data.

On the F0 you're going to need to emulate the bus cycles, so driving and sequencing the Read, Write, Address and control signals via GPIO pins associated with each. drive them per timing diagrams in the memory data sheets, and how MCU memory buses are supposed to sequence. For the data bus you're going to have to adjust the input/output states at the GPIO peripheral level, perhaps using Open Drain mode, with pull-ups, and writing 0xFFFF out to get the bus into a read mode, or more actively define the Push-Pull/Input state of the bus based on whether you're emulating a read or write cycle on the simulated bus. I'd suggest mapping the data bus into a linear allocations of pins on a GPIO bank to ease the reading, decoding and mapping into bytes you copy into RAM.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Texram
Associate III

Hi Tesla,

Thanks for your inputs.

I was Googling around and searched in this community for the example code, and I only found the example code that use FSMC (flexible static

memory controller built-in F100xx or F30xxD/E) and HAL APIs to access NAND. I didn't see any example code that use non FSMC to configure IO and to access NAND.

Do you have any (web) links to the code examples that use other uC to access NAND?

Again, thank you in advance.

Probably start with embedded linux kernel code circa 2010's

>>I didn't see any example code that use non FSMC to configure IO and to access NAND.

Absent an actual external interface you're going to have "bit-bang" via GPIO pins, like you often see for 16x2 LCD displays or other such niche buses

Samsung, Micron, Intel, et al should have app notes

Perhaps looks for College Level Micro Controller / Computer interfacing.

Commands/Interfacing described in data sheet, typically this is sufficient for the HW/SW engineer assigned the task.

http://dl.btc.pl/kamami_wa/nand04g-b2d_nand08g-bxc.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..