cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery FSMC not working in 8bit mode

sonurobots
Associate III
Posted on July 15, 2013 at 21:40

Hello I am working on a project that uses FSMC .Everything is fine when I use 16bit mode but in every write i need to shift the data <<8 to bring it on to the D8-D15 lines . I cant use DMA like this . so i need a way to write the data in 8bits. my LCD is 8 bits.

FSMC_MemoryDataWidth=FSMC_MemoryDataWidth_16b;
changed to
FSMC_MemoryDataWidth=FSMC_MemoryDataWidth_8b; but no sucess.
i have checked the hardware connections it seems all right. Thanks for any help. #fsmc-in-8-bit-not-working
7 REPLIES 7
Posted on July 16, 2013 at 09:33

Connect the LCD to D0-D7.

JW
sonurobots
Associate III
Posted on July 16, 2013 at 13:50

thanks for your replay  but i have Already done that but that doesn't work .can you please describe the differences that occur in 8 bit and 16 bit mode. 

sonurobots
Associate III
Posted on July 17, 2013 at 12:33

I solved it myself

1: declared 8 bit data width.

2:removed  R41 and R42

3:voltage levels on PE are little(3.00 while rest 2.90) higher than vdd added some registers to control it.

Posted on July 17, 2013 at 13:37

> 2:removed  R41 and R42

Strange.

I did use the STM32F4Discovery with a display through 8-bit FSMC, and did not remove R41 and R42, and experienced no problem with that.

How did you set the speed (GPIOx_OSPEEDR) on those pins?

JW

sonurobots
Associate III
Posted on July 19, 2013 at 07:51

pulling those pins UP makes a problem i,e they stay in high level even if i send zeros.

that's why i pulled those down and removed the registers.

  GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC);

  GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC);

  GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC);    //NWE

  GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC);

  GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC);

//  GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC);

//  GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC);

//  GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC);

//  GPIO_PinAFConfig(GPIOD, GPIO_PinSource11, GPIO_AF_FSMC);//required for fsmc line in lcd's  DC line

  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_5 |GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_14 |GPIO_Pin_15;//edit this line

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_DOWN;   //added

  GPIO_Init(GPIOD, &GPIO_InitStructure);

teachersslayer
Associate
Posted on November 28, 2013 at 15:19

Hello everyone,

I have a similar problem:

I'm trying to add some more SRAM memory to my STM32F4 Discovery board. It is 8Mb SRAM named AS6C8008-55ZIN with 8b data bus width. I connected it to my FSMC interface with multiplexed 8b data bus mode. A0-A7 is avaliable through 8b buffer 74HC573.

With this setup i couldn't write and read anything from my memory. I tried several timing's , checking all signals with oscyloscope , but everything was fine - still the memory was unable to show me anything.

I decided to change data bus width in fsmc settings to 16b , just to try it out. Guess what , it worked. The problem is : I can't get access to odd addresses starting from 0x60000001.  Even addresses are fine , i can write and read anything ( yet i'm still using 8b words) .

Is it the problem with R41 and R42? What am I doing wrong?

here is my fsmc config:

  FSMC_NORSRAMInitTypeDef        FSMC_NORSRAMInitStructure;

  FSMC_NORSRAMTimingInitTypeDef  FSMC_NORSRAMTimingInitStructure;

 

  //-----------------------------------------

  // Clock Enable

  //-----------------------------------------

  RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);  

 

  FSMC_NORSRAMTimingInitStructure.FSMC_AddressSetupTime = 4;

  FSMC_NORSRAMTimingInitStructure.FSMC_AddressHoldTime = 11;

  FSMC_NORSRAMTimingInitStructure.FSMC_DataSetupTime = 5;

  FSMC_NORSRAMTimingInitStructure.FSMC_BusTurnAroundDuration = 15;

  FSMC_NORSRAMTimingInitStructure.FSMC_CLKDivision = 0;

  FSMC_NORSRAMTimingInitStructure.FSMC_DataLatency = 0;

  FSMC_NORSRAMTimingInitStructure.FSMC_AccessMode = FSMC_AccessMode_A;

 

  FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;

  FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Enable;

  FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;

  FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;

  FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;

  FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;   

  FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;  

  FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;  

  FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;  

  FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;  

  FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;   

  FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;  

  FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;  

  FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;

  FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;

 

  FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);

 

  FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);

sonurobots
Associate III
Posted on December 09, 2013 at 16:52

fsmc works quite fast so always make sure to check the timings are OK.make a little delay (10cycles)  in between the commands and data .Thats what i did and it solved all the problems .now there is no problem with R41 R42.it all works with them and without them.