AnsweredAssumed Answered

STM32F746 - Problems with FMC

Question asked by MWP on Apr 16, 2016
Latest reply on Jul 12, 2016 by vigelette.george.002
Hi all,
I'm trying to use a LCD via the FMC, but as yet i haven't been able to get any output from the FMC module at all. Using normal GPIO pin writes works just fine.

Im using this test code to diagnose the issue.
As far as i can tell, i should be seeing activity on the FMC pins, but im getting nothing at all.
Any ideas??

01.__FMC_CLK_ENABLE();
02.__HAL_RCC_GPIOE_CLK_ENABLE();
03.__HAL_RCC_GPIOD_CLK_ENABLE();
04. 
05.GPIO_InitTypeDef GPIO_InitStruct;
06.GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10
07.        | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14
08.        | GPIO_PIN_15;
09.GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
10.GPIO_InitStruct.Pull = GPIO_PULLUP;
11.GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
12.GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
13.HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
14. 
15.GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11
16.        | GPIO_PIN_14 | GPIO_PIN_15 | GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4
17.        | GPIO_PIN_5 | GPIO_PIN_7;
18.GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
19.GPIO_InitStruct.Pull = GPIO_PULLUP;
20.GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
21.GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
22.HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
23. 
24.FMC_NORSRAM_TimingTypeDef Timing;
25.FMC_NORSRAM_TimingTypeDef ExtTiming;
26. 
27.hsram1.Instance = FMC_NORSRAM_DEVICE;
28.hsram1.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
29./* hsram1.Init */
30.hsram1.Init.NSBank = FMC_NORSRAM_BANK1;
31.hsram1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
32.hsram1.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
33.hsram1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_16;
34.hsram1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE;
35.hsram1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
36.hsram1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS;
37.hsram1.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE;
38.hsram1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE;
39.hsram1.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE; //FMC_EXTENDED_MODE_ENABLE;
40.hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE;
41.hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
42.hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
43.hsram1.Init.WriteFifo = FMC_WRITE_FIFO_DISABLE;
44.hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE;
45./* Timing */
46.Timing.AddressSetupTime = 15;
47.Timing.AddressHoldTime = 15;
48.Timing.DataSetupTime = 255;
49.Timing.BusTurnAroundDuration = 15;
50.Timing.CLKDivision = 16;
51.Timing.DataLatency = 17;
52.Timing.AccessMode = FMC_ACCESS_MODE_A;
53./* ExtTiming */
54.ExtTiming.AddressSetupTime = 15;
55.ExtTiming.AddressHoldTime = 15;
56.ExtTiming.DataSetupTime = 255;
57.ExtTiming.BusTurnAroundDuration = 15;
58.ExtTiming.CLKDivision = 16;
59.ExtTiming.DataLatency = 17;
60.ExtTiming.AccessMode = FMC_ACCESS_MODE_A;
61.HAL_SRAM_Init(&hsram1, &Timing, &ExtTiming);
62. 
63.while (1)
64.{
65.    *(volatile uint16_t*)(0x60000000) = 0b0101010101010101;
66.    HAL_Delay(10);
67.    HAL_GPIO_TogglePin(LCD_BL_GPIO_Port, LCD_BL_Pin);
68. 
69.    *(volatile uint16_t*)(0x60000000) = 0b1010101010101010;
70.    HAL_Delay(10);
71.    HAL_GPIO_TogglePin(LCD_BL_GPIO_Port, LCD_BL_Pin);
72.}

Outcomes