AnsweredAssumed Answered

STM32F4 FMC/FSMC Sub-Banks' Addresses/Offsets

Question asked by Zaher on Dec 27, 2017
Latest reply on Jan 5, 2018 by Zaher

Hello STers,


First of all, I would like to take this opportunity to wish you a Merry Christmas and a Happy New Year full of success and prosperity.


Well, as I'm starting to utilize the FMC/FSMC peripheral in one of my projects (interfacing a legacy chip), I have got some questions and would appreciate your help answering them. 


According to the datasheet (memory mapping), each bank is divided into 4-sub banks, 64 MBytes each. 


Aside from the fact that each bank assigns a unique Chip Select signal (CS), I couldn't find any reference to how one could calculate the offsets of these banks? 


For example, 0x6400 0000 is the base address for the second bank (NE2), but how was that obtained? I mean, adding 64MB to the base address of 0x60000000 has resulted to something around 67MB. 


For writing/reading, I'm using the following functions:


uint8_t SRAM_ReadReg()
return *(uint8_t*)SRAM_ADDR; // Address defined earlier 0x60000000

void SRAM_WriteReg(uint8_t RegValue)
*(uint8_t*)SRAM_ADDR = RegValue;

I have used the first bank (NE1) for these. Is there any better approach?