cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 FMC/FSMC Sub-Banks' Addresses/Offsets

Zaher
Senior II
Posted on December 27, 2017 at 05:12

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.

0690X0000060PFaQAM.jpg

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?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on January 05, 2018 at 14:44

1MB=0x10'0000

64MB=0x400'0000

Thus, 0x6000'0000+0x400'0000=0x6400'0000 for NE2-controlled bank.

0x6000'0000=1536MB=1.5GB

(It would be more correct to write

https://en.wikipedia.org/wiki/Mebibyte

/GiB)

JW

View solution in original post

2 REPLIES 2
Posted on January 05, 2018 at 14:44

1MB=0x10'0000

64MB=0x400'0000

Thus, 0x6000'0000+0x400'0000=0x6400'0000 for NE2-controlled bank.

0x6000'0000=1536MB=1.5GB

(It would be more correct to write

https://en.wikipedia.org/wiki/Mebibyte

/GiB)

JW

Posted on January 05, 2018 at 19:26

Yep, that was correct, and I got it now! I wasn't multiplying by 1048576 (1MB), therefore I got a wrong value. Now, 1024*1024 = 

1048576 = 2^20. 

1048576 * 64  = 67108864 = 0x4000000. When added to the base address, we get 

0x64000000 for NE2. 

Thanks