Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FMC SDRAM for STM32H7x3 chip #22

Merged
merged 12 commits into from
Jan 2, 2020
6 changes: 3 additions & 3 deletions arch/arm/include/stm32h7/chip.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@
# define STM32H7_NETHERNET 0 /* No 100/100 Ethernet MAC */
#endif

#if defined(CONFIG_STM32F7_HAVE_FMC)
# define STM32F7_NFMC 1 /* Have FMC memory controller */
#if defined(CONFIG_STM32H7_HAVE_FMC)
# define STM32H7_NFMC 1 /* Have FMC memory controller */
#else
# define STM32F7_NFMC 0 /* No FMC memory controller */
# define STM32H7_NFMC 0 /* No FMC memory controller */
#endif

/* NVIC priority levels **************************************************************/
Expand Down
24 changes: 14 additions & 10 deletions arch/arm/src/stm32/stm32_fmc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32/stm32_fmc.c
*
* Copyright (C) 20019 Gregory Nutt. All rights reserved.
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Jason T. Harris <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -31,22 +31,23 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/

/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/

#include <nuttx/config.h>

#include "stm32.h"

#if defined(CONFIG_STM32_FMC)

/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/

/****************************************************************************
/****************************************************************************
* Name: stm32_fmc_sdram_wait
*
Expand Down Expand Up @@ -106,7 +107,8 @@ void stm32_fmc_disable(void)

void stm32_fmc_sdram_write_protect(int bank, bool state)
{
uint32_t val, sdcr;
uint32_t val;
uint32_t sdcr;

DEBUGASSERT(bank == 1 || bank == 2);
sdcr = (bank == 1) ? STM32_FMC_SDCR1 : STM32_FMC_SDCR2;
Expand Down Expand Up @@ -158,7 +160,8 @@ void stm32_fmc_sdram_set_refresh_rate(int count)

void stm32_fmc_sdram_set_timing(int bank, uint32_t timing)
{
uint32_t val, sdtr;
uint32_t val
uint32_t sdtr;

DEBUGASSERT((bank == 1) || (bank == 2));
DEBUGASSERT((timing & FMC_SDTR_RESERVED) == 0);
Expand All @@ -180,7 +183,8 @@ void stm32_fmc_sdram_set_timing(int bank, uint32_t timing)

void stm32_fmc_sdram_set_control(int bank, uint32_t ctrl)
{
uint32_t val, sdcr;
uint32_t val
uint32_t sdcr;

DEBUGASSERT((bank == 1) || (bank == 2));
DEBUGASSERT((ctrl & FMC_SDCR_RESERVED) == 0);
Expand Down
12 changes: 6 additions & 6 deletions arch/arm/src/stm32/stm32_fmc.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32/stm32_fmc.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
Expand Down Expand Up @@ -31,23 +31,23 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/

#ifndef __ARCH_ARM_STC_STM32_STM32_FMC_H
#define __ARCH_ARM_STC_STM32_STM32_FMC_H

/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/

#include <nuttx/config.h>

#include "chip.h"
#include "hardware/stm32_fmc.h"

/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/

#ifndef __ASSEMBLY__

Expand Down
19 changes: 19 additions & 0 deletions arch/arm/src/stm32h7/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ config STM32H7_STM32H7X3XX
select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM
select STM32H7_HAVE_ETHERNET
select STM32H7_HAVE_FMC
yukihiratype2 marked this conversation as resolved.
Show resolved Hide resolved
select STM32H7_HAVE_SPI4
select STM32H7_HAVE_SPI5
select STM32H7_HAVE_SPI6
Expand All @@ -58,6 +59,7 @@ config STM32H7_STM32H7X7XX
select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM
select STM32H7_HAVE_ETHERNET
select STM32H7_HAVE_FMC
select STM32H7_HAVE_SPI4
select STM32H7_HAVE_SPI5
select STM32H7_HAVE_SPI6
Expand Down Expand Up @@ -148,6 +150,10 @@ config STM32H7_HAVE_ETHERNET
bool
default n

config STM32H7_HAVE_FMC
bool
default n

config STM32H7_HAVE_SPI4
bool
default n
Expand Down Expand Up @@ -274,6 +280,11 @@ config STM32H7_ETHMAC
select NETDEVICES
select ARCH_HAVE_PHY

config STM32H7_FMC
bool "FMC"
default n
depends on STM32H7_HAVE_FMC

config STM32H7_OTGFS
bool "OTG FS"
default n
Expand Down Expand Up @@ -1143,6 +1154,14 @@ config STM32H7_RTC_LSECLOCK_RUN_DRV_CAPABILITY

endif # STM32H7_RTC_LSECLOCK

config STM32H7_EXTERNAL_RAM
bool "External RAM on FMC"
default n
depends on STM32H7_FMC
select ARCH_HAVE_HEAP2
---help---
In addition to internal SDRAM, external RAM may be available through the FMC.

endmenu # RTC Configuration

config STM32H7_CUSTOM_CLOCKCONFIG
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32h7/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ ifeq ($(CONFIG_STM32H7_DMA),y)
CHIP_CSRCS += stm32_dma.c
endif

ifeq ($(CONFIG_STM32H7_FMC),y)
CHIP_CSRCS += stm32_fmc.c
endif

ifeq ($(filter y,$(CONFIG_STM32H7_IWDG) $(CONFIG_STM32H7_RTC_LSICLOCK)),y)
CHIP_CSRCS += stm32_lsi.c
endif
Expand Down
Loading