cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4x9 FMC Speed Issues

ricardomadera
Associate II
Posted on December 08, 2016 at 19:01

So I finally got my IL9325 TFT display running via FMC but it is running much slower than I expected. The SPI based displays on arduinos seem to be performing better than this parallel setup. I measured my data pulse width to be around 20us. Is this the limit of the FMC(settings below)? I am running my clock at 168Mhz, HSE=24Mhz M = 12, N = 168 , P = 2, Q = 7, AHB =1, APB1 = 4, APB2 = 2. If the FMC should be running faster, what should I be looking into?

FMC_NORSRAMTimingInitStructure.FMC_AddressSetupTime = 15; /* Address Setup Time */  FMC_NORSRAMTimingInitStructure.FMC_AddressHoldTime = 0;  FMC_NORSRAMTimingInitStructure.FMC_DataSetupTime = 15; /* Data Setup Time */  FMC_NORSRAMTimingInitStructure.FMC_BusTurnAroundDuration = 0;  FMC_NORSRAMTimingInitStructure.FMC_CLKDivision = 0;  FMC_NORSRAMTimingInitStructure.FMC_DataLatency = 0;  FMC_NORSRAMTimingInitStructure.FMC_AccessMode = FMC_AccessMode_A; /* FSMC Access Mode */  FMC_NORSRAMInitStructure.FMC_Bank = FMC_Bank1_NORSRAM4;  FMC_NORSRAMInitStructure.FMC_DataAddressMux = FMC_DataAddressMux_Disable;  FMC_NORSRAMInitStructure.FMC_MemoryType = FMC_MemoryType_SRAM;  FMC_NORSRAMInitStructure.FMC_MemoryDataWidth = FMC_NORSRAM_MemoryDataWidth_16b;  FMC_NORSRAMInitStructure.FMC_BurstAccessMode = FMC_BurstAccessMode_Disable;  FMC_NORSRAMInitStructure.FMC_WaitSignalPolarity = FMC_WaitSignalPolarity_Low;  FMC_NORSRAMInitStructure.FMC_WrapMode = FMC_WrapMode_Disable;  FMC_NORSRAMInitStructure.FMC_WaitSignalActive = FMC_WaitSignalActive_BeforeWaitState;  FMC_NORSRAMInitStructure.FMC_WriteOperation = FMC_WriteOperation_Enable;  FMC_NORSRAMInitStructure.FMC_WaitSignal = FMC_WaitSignal_Disable;  FMC_NORSRAMInitStructure.FMC_AsynchronousWait = FMC_AsynchronousWait_Disable;  FMC_NORSRAMInitStructure.FMC_ExtendedMode = FMC_ExtendedMode_Disable;  FMC_NORSRAMInitStructure.FMC_WriteBurst = FMC_WriteBurst_Disable;  FMC_NORSRAMInitStructure.FMC_ReadWriteTimingStruct = &FMC_NORSRAMTimingInitStructure;  FMC_NORSRAMInit(&FMC_NORSRAMInitStructure);  /* FSMC Write Timing */  FMC_NORSRAMTimingInitStructure.FMC_AddressSetupTime = 5;//2;//1; /* Address Setup Time */  FMC_NORSRAMTimingInitStructure.FMC_AddressHoldTime = 0;  FMC_NORSRAMTimingInitStructure.FMC_DataSetupTime = 5;//2;//1; /* Data Setup Time */  FMC_NORSRAMTimingInitStructure.FMC_BusTurnAroundDuration = 0x00;  FMC_NORSRAMTimingInitStructure.FMC_CLKDivision = 0;  FMC_NORSRAMTimingInitStructure.FMC_DataLatency = 0x00;  FMC_NORSRAMTimingInitStructure.FMC_AccessMode = FMC_AccessMode_A; /* FSMC Access Mode */  FMC_NORSRAMInitStructure.FMC_WriteTimingStruct = &FMC_NORSRAMTimingInitStructure; FMC_NORSRAMInit(&FMC_NORSRAMInitStructure);�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

#fmc #stm32f429/39 #fmc-speed #fmc-setup

Note: this post was migrated and contained many threaded conversations, some content may be missing.
27 REPLIES 27
Posted on December 08, 2016 at 20:47

Well, this is strange, when I set my crystal to 24 MHz, select HSE as my clock source and set 180 into the box for Core clock, CubeMX calculates all the prescaler values properly. Not sure whether you are using other peripherals...

Well, HAL isn't that difficult. However if you insist on SPL, you don't need to use HAL after you make the project running with it. You just use it as a template... sometimes the code contains lines, which are not obvious from the documentation or are completely missing and the only persons who knows are from ST...

Renegade

Posted on December 08, 2016 at 20:52

Can you provide the datasheet of your memory?

Renegade

Posted on December 08, 2016 at 20:54

Yes that was odd. I just remade an identical project in CubeMX, gave the same values and it generated a set for 180.

Previously

I was getting the 180Mhz config could not be found, would you like to use 168Mhz instead?

Actually, It is because I also have USB_OTG_FS selected in my configuration which I plan to be making into a VCOM port. 

Posted on December 08, 2016 at 21:03

The data sheet to the TFT controller is here.

http://www.hpinfotech.ro/ILI9325.pdf

 

The purchased TFT is this one:

http://www.waveshare.com/product/modules/oleds-lcds/graphic-lcd/3.2inch-320x240-touch-lcd-c.htm

 
Posted on December 08, 2016 at 21:14

lampii,

How did you verify the system clock frequency? Output to MCO pin and measured with oscilloscope?

What exactly do you mean by 'data pulse' and how did you measure it?

Clive,

I don't SPL but IMO FMC_ExtendedMode_Disable means FMC_BCR.EXTMOD = 0, i.e. FMC_BWTR (the write timing) is ignored.

Posted on December 08, 2016 at 21:35

Correct, I enabled MC01 and MC02 and went through each of the clocks.

Here is a screen cap of the Oscilloscope measuring one of the data lines. Here the code is set to write 0xFFFF without delays in an infinite loop.0690X00000605oZQAQ.png0690X00000605otQAA.png

ST Renegade
Senior
Posted on December 08, 2016 at 22:45

I've made some research and taking a look into the application note AN2790 according to my calculations the AddressSetupTime should be 6 min and the DataSetupTime 11 min if running at 168 MHz. Also the access mode should be MODE_B (but here I'm not really sure). Use cube and have a look whether it works or not... afterwards you can adjust your SPL app.

I don't think this will help, but who knows... maybe wrong timing can cause these issues. As Jan said, what do you mean by 'data pulse' and how do you measure it?

Just out of curiousity, why don't you use the LTDC peripheral instead? :)

Good luck,

Renegade

ricardomadera
Associate II
Posted on December 08, 2016 at 23:27

Ohh hehe i meant just the LCD stuff. The rest of the project is pretty minimal since its just a systems check for all my features. I will chime back in later with what happens.

Posted on December 08, 2016 at 22:57

I will try and port the project to HAL tonight and see. Thanks for taking a look into my issue. I really appreciate it. 

I posted screen captures of the oscilloscope measuring the data pin above to show what I meant.

This panel does not provide the necessary sync and clock pins for the RGB interface.

I am working on another design for a new panel which will use the LTDC peripheral and perhaps some SDRAM.
Posted on December 08, 2016 at 23:13

Don't port anything to HAL, just generate a new project using CubeMX and try to paint something on the LCD to see, whether it works as intended. No reason to port the whole project imho. :)

Renegade