FSMC NAND flash problem with community driver

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

FSMC NAND flash problem with community driver

Postby king2 » Sat Mar 25, 2017 6:08 pm

Hi!
First, big thanks to @barthess for great driver!

I'm using TE-STM32F437 board (https://www.terraelectronica.ru/catalog ... DE=1327703, sorry only russian there),
but its schematic can be found at http://king2.net/files/TE-STM32F437/TE- ... _sheet.pdf, example project at http://king2.net/files/TE-STM32F437/demo.zip.

My module uses STM32F437ZGT6 (works), MT45W8MW16BGX as PSRAM (works) and SAMSUNG K9F4G08U0E (not works).

I'm initializing NAND flash driver with following code (time parameters was taken from example project of this board and may be errorneous, but I have not enough knowledge to check this):

Code: Select all

#define FSMCNAND_TIME_SET         ((uint32_t) 0x04)
#define FSMCNAND_TIME_WAIT        ((uint32_t) 0x12)
#define FSMCNAND_TIME_HOLD        ((uint32_t) 0x08)
#define FSMCNAND_TIME_HIZ         ((uint32_t) 0x04)

#define NAND_BLOCKS_COUNT         2048
#define NAND_PAGE_DATA_SIZE       2048
#define NAND_PAGE_SPARE_SIZE      64
#define NAND_PAGE_SIZE            (NAND_PAGE_SPARE_SIZE + NAND_PAGE_DATA_SIZE)
#define NAND_PAGES_PER_BLOCK      64
#define NAND_ROW_WRITE_CYCLES     3
#define NAND_COL_WRITE_CYCLES     2

static const NANDConfig nandcfg = {
    NAND_BLOCKS_COUNT,
    NAND_PAGE_DATA_SIZE,
    NAND_PAGE_SPARE_SIZE,
    NAND_PAGES_PER_BLOCK,
    NAND_ROW_WRITE_CYCLES,
    NAND_COL_WRITE_CYCLES,
    // stm32 specific fields
    ((FSMCNAND_TIME_HIZ << 24) | (FSMCNAND_TIME_HOLD << 16) | \
                                 (FSMCNAND_TIME_WAIT << 8) | FSMCNAND_TIME_SET)
};
nandStart(&NANDD1, &nandcfg, NULL);  // it can make errormap


Additionally, example project was done with ST's library and have

Code: Select all

FSMC_NANDInitStructure.FSMC_TCLRSetupTime = 0x3;
FSMC_NANDInitStructure.FSMC_TARSetupTime = 0x3;

that was not used in ChibiOS driver (as I understand, zeroes will be places into PCR register instead).

Then, driver sends first command to NAND, suspends thread and that's all. I have placed breakpoint to CH_IRQ_HANDLER(STM32_FSMC_HANDLER), it is not firing, just waits somewhere inside ChibiOS.

My NAND R/B pin connected to PG6 port (FSMC INT2), i have configured this pin as FSCM alternative function, and, as I understand, this should fire interrupt when NAND will be ready for next command/data, but this not happens..

Please, forgive me my newbiew question and help me to get it to work!
Thanks you in advance!

p.s. It this will be more suitable, my skype is oleg_king2, I can show debugger window by screen sharing.
p.p.s. Please forgive my not-so-good english, i'm not native speaker.

king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

Re: FSMC NAND flash problem with community driver

Postby king2 » Sat Mar 25, 2017 7:44 pm

I have found the error.
Error was in PCB routing, TE connected NCE3 and INT2 to NAND flash in their module, so it fired interrupt, but it was not respected by FSMC module as it belongs to another bank. :)


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 22 guests