cancel
Showing results for 
Search instead for 
Did you mean: 

How To Using FMC Write?

Dlak
Associate II

I encountered a problem when trying to send more than 5 bytes of data using the FMC.

// impossible example -- #define SD_DATA (*(volatile unsigned char *)0x60000001) SD_DATA = 0x01; SD_DATA = 0x02; SD_DATA = 0x03;
 
Using this method, data is not transmitted to the same address without a delay.
However, it is possible to write data to the FMC if I change the address each time I transmit or use a delay.
 
// possible example -- 1 #define SD_DATA (*(volatile unsigned char *)0x60000001) SD_DATA = 0x01; HAL_Delay(1); SD_DATA = 0x02; HAL_Delay(1); SD_DATA = 0x03;
// possible example -- 2 #define SD_DATA1 (*(volatile unsigned char *)0x60000001) #define SD_DATA2 (*(volatile unsigned char *)0x60000002) #define SD_DATA3 (*(volatile unsigned char *)0x60000003) SD_DATA1 = 0x01; SD_DATA2 = 0x02; SD_DATA3 = 0x03;
 
What could be the problem?
 
We used the STM32F756, and the following is the FMC initialization.
static void MX_FMC_Init(void) { FMC_NORSRAM_TimingTypeDef Timing; /** Perform the NOR1 memory initialization sequence */ hnor1.Instance = FMC_NORSRAM_DEVICE; hnor1.Extended = FMC_NORSRAM_EXTENDED_DEVICE; /* hnor1.Init */ hnor1.Init.NSBank = FMC_NORSRAM_BANK1; hnor1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE; hnor1.Init.MemoryType = FMC_MEMORY_TYPE_NOR; hnor1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_8; hnor1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE; hnor1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW; hnor1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS; hnor1.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE; hnor1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE; hnor1.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE; hnor1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE; hnor1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE; hnor1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY; hnor1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE; hnor1.Init.PageSize = FMC_PAGE_SIZE_NONE; /* Timing */ Timing.AddressSetupTime = 15; Timing.AddressHoldTime = 15; Timing.DataSetupTime = 31; Timing.BusTurnAroundDuration = 8; Timing.CLKDivision = 16; Timing.DataLatency = 17; Timing.AccessMode = FMC_ACCESS_MODE_A; /* ExtTiming */ if (HAL_NOR_Init(&hnor1, &Timing, NULL) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } }
View more
13 REPLIES 13

> I have noticed that using BANK1 in FMC_Init causes a hard fault at addresses starting from 0x6000.0000.

After remap, you should not use 0x6000'0000 anymore.

JW

I used 0x6000.0000 before remapping, but if BANK2 is not used during the initialization process, a hard fault occurs. What could be the problem?

At this point, I am already lost in what exactly do you do.

Please give us a short summary, what is your actual hardware, what are the FMC settings, and upon which action does the fault occur.

JW

Dlak
Associate II

Due to repeated swap errors, I resolved the issue by clearing the cache.