cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32f4]FSMC bank problem

Wasilewski.Piotr
Associate III
Posted on August 06, 2015 at 15:52

Hello again!

I have a problem with FSMC on STM32f407VGT6 microcontroller. I use it to control LCD through a 8-bit bus. As it was working just fine on STM32f103 on STM32f407 there's this issue. When I set for example bank 2 (nand memory) and in the end I enable the bank the whole program stops after first data write. But when I enable bank 3 instead of 2 the write works fine. Here's the code to visualise the issue:

////defines ( bank 3 adress must be written to get it working)
#define Bank2_NAND_ADDR ((uint32_t)0x80000000)
#define DATA_AREA ((u32)0x00000000)
#define CMD_AREA (u32)(1<<16)
#define LCD_WRITE_COMMAND *(vu8 *)(Bank_NAND_ADDR | DATA_AREA)
#define LCD_WRITE_DATA *(vu8 *)(Bank_NAND_ADDR | CMD_AREA) 
///////////////////////////////////////////////////////////////////////////////////////
FSMC_Bank2->PCR2|=FSMC_ECCPageSize_8192Bytes; 
//page 8192 bytres
FSMC_Bank2->PCR2&=~FSMC_PCR2_PWID; 
//bus width 8b
FSMC_Bank2->PCR2|=FSMC_PCR2_PWAITEN; 
//pwait enable
// FSMC_Bank2->PCR2|=FSMC_PCR2_PBKEN; //do not turn on this bank
FSMC_Bank3->PCR3|=FSMC_PCR3_PBKEN; 
// turn on bank 3 instead and it works !
FSMC_Bank2->PMEM2=FSMC_PMEM2_MEMHIZ2_0;
FSMC_Bank2->PMEM2=FSMC_PMEM2_MEMHOLD2_0;
FSMC_Bank2->PMEM2=FSMC_PMEM2_MEMSET2_0;
FSMC_Bank2->PMEM2=FSMC_PMEM2_MEMWAIT2_0;
FSMC_Bank2->PATT2=FSMC_PMEM2_MEMHIZ2_0;
FSMC_Bank2->PATT2=FSMC_PMEM2_MEMHOLD2_0;
FSMC_Bank2->PATT2=FSMC_PMEM2_MEMSET2_0;
FSMC_Bank2->PATT2=FSMC_PMEM2_MEMWAIT2_0;
FSMC_Bank3->PMEM3=FSMC_PMEM3_MEMHIZ3_0;
FSMC_Bank3->PMEM3=FSMC_PMEM3_MEMHOLD3_0;
FSMC_Bank3->PMEM3=FSMC_PMEM3_MEMSET3_0;
FSMC_Bank3->PMEM3=FSMC_PMEM3_MEMWAIT3_0;
FSMC_Bank3->PATT3=FSMC_PMEM3_MEMHIZ3_0;
FSMC_Bank3->PATT3=FSMC_PMEM3_MEMHOLD3_0;
FSMC_Bank3->PATT3=FSMC_PMEM3_MEMSET3_0;
FSMC_Bank3->PATT3=FSMC_PMEM3_MEMWAIT3_0;

I've read the errata sheet, but haven't found anythinf like that... Maybe You do know what is going on ? greetings, Peter #fsmc #8-bit
1 REPLY 1
eduardo2
Associate II
Posted on September 18, 2015 at 17:15

Hi Peter:

Unfortunately I can't answer your question, but may be you can help me. I am trying to connect a TFT display with a built in SSD1963 controller that uses 8-bit interface, to a STM32F217 using FSMC.

How did you configured the FSMC bus to work on 8-bit???

Any examples codes? (most of the examples I saw are 16-bit interface)

Thanks,

Ed