Memory map of stm32f407x

Memory map of stm32f407x

Before going to memory map lets see about ARM-Cortex M4. It has a width of system bus is 32-bits. It says that I can produce 2^32 different address. The range of this is start from 0x0000_0000 and ends at 0xffff_ffff .In between this address we can find different peripheral addresses that points to a particular peripheral.
Lets go to the reference manual of stm2f407x and go to section called memory map there u can see table contaning the different peripheral attached to the different address for understating lets take a
Example –
If u want to use GPIOA then it is addresses lies from 0x4002_0000 to 0x4002_03FF that means all the register of GPIOA are lies between this address if the system bus produces the the base address of GPIOA(0x4002_0000) then the MCU is talking to GPIOA.
We can see in MEMORY MAP that it consists of ARM-Cortex M4 it can run at 168MHz and with the help of bus, the peripheral and arm communicate each other. The ARM consists of three bus named as I-bus(instruction bus), D-bus(data bus) and S-bus(system bus)
The use of I-bus is to fetch the instruction written in the code. And the purpose of D-bus is to fetch the data from the code so this two bus are connected to Flash.
The ARM cortex-M4 consists of ADVANCE HIGH-PERFORMANCE BUS(AHB) and ADVANCE PERIPHERAL BUS(APB)
According to ARM M-4 if the instruction are present in between the addresses 0x00000000 to 0x1FFFFFFC then it uses I-BUS. If the instruction are outside the address 0x00000000 to 0x1FFFFFFC then it use S-BUS. If the data are present in between the 0x00000000 to 0x1FFFFFFF then it uses D-BUS. If the data are outside the address 0x00000000 to 0x1FFFFFFF the it use S-BUS
By above block diagram we can see that s-bus is connected to SRAM and AHB1 bus so that all the peripheral falls to system bus that means If one peripheral communicate then other peripheral can’t communicate.
As we go deep into AHB1 bus it is connected to APB1 and APB2 bus and this two bus run with a low clock speed then AHB1 bus. And we have AHB2 this can be used when need to communicate with external like camera and USB.
Suppose if u want to talk with GPIOI then u mush enable the AHB bus then only your GPIO can communicate with the ARM and if u want to communicate with the SPI1 then u should enable the APB1 bus lets see how to enable this bus in further series.

CLOCKS
The heart of the MCU is clock without the clock there is no transfer of data. As we see in reference manual we can find it has three clock sources.
•HSI oscillator clock(RC oscillator)
•HSE oscillator clock(crystal oscillator)
•PLL clock(phase locked loop)
Crystal oscillator is connected to the external to the MCU. RC oscillator is connected internal to MCU. PLL is also connected internal to MCU.

As u can see in the above figure there is a multiplexer for clock source. By default the MCU runes with internal clock which is HIS. We the user need external clock he should enable with the program.
•Internal oscillator runes with fixed 16MHz
•External oscillator various from 4-26 MHz

SYSCLK
SYSCLK is the main clock for MCU. By which different peripheral are driven. Depending upon the requirement of clock for peripheral there is a prescaler (It reduces the clock by dividing). Example-
If u need to drive the AHB bus with 8MHz clock speed then u need to make the given SYSCLK clock divided with AHB prescaler by 2 so that it generate (16/2)=8MHz clock which is directly connected to AHB bus. So now AHB bus runes with 8MHz clock speed.