AnsweredAssumed Answered

[STM32f4]FSMC bank problem

Question asked by Wasilewski.Piotr on Aug 6, 2015
Latest reply on Sep 18, 2015 by ed@mtrx
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


Outcomes