Sync inav to Gitea
Make sure docs are updated / settings_md (push) Canceled after 0s
Build firmware / test (push) Canceled after 0s
Build firmware / build-SITL-Windows (push) Canceled after 0s
Build firmware / build-SITL-Mac (push) Canceled after 0s
Build firmware / build-SITL-Linux (push) Canceled after 0s
Build firmware / build-SITL-Linux-arm64 (push) Canceled after 0s
Build firmware / upload-artifacts (push) Canceled after 0s
Build firmware / build-single-target (push) Canceled after 0s
Build firmware / build (9) (push) Canceled after 0s
Build firmware / build (8) (push) Canceled after 0s
Build firmware / build (7) (push) Canceled after 0s
Build firmware / build (6) (push) Canceled after 0s
Build firmware / build (5) (push) Canceled after 0s
Build firmware / build (4) (push) Canceled after 0s
Build firmware / build (3) (push) Canceled after 0s
Build firmware / build (2) (push) Canceled after 0s
Build firmware / build (14) (push) Canceled after 0s
Build firmware / build (13) (push) Canceled after 0s
Build firmware / build (12) (push) Canceled after 0s
Build firmware / build (11) (push) Canceled after 0s
Build firmware / build (10) (push) Canceled after 0s
Build firmware / build (1) (push) Canceled after 0s
Build firmware / build (0) (push) Canceled after 0s
Build firmware / detect (push) Canceled after 0s
Build pre-release / build (push) Canceled after 0s
Build pre-release / Release (push) Canceled after 0s
Make sure docs are updated / settings_md (push) Canceled after 0s
Build firmware / test (push) Canceled after 0s
Build firmware / build-SITL-Windows (push) Canceled after 0s
Build firmware / build-SITL-Mac (push) Canceled after 0s
Build firmware / build-SITL-Linux (push) Canceled after 0s
Build firmware / build-SITL-Linux-arm64 (push) Canceled after 0s
Build firmware / upload-artifacts (push) Canceled after 0s
Build firmware / build-single-target (push) Canceled after 0s
Build firmware / build (9) (push) Canceled after 0s
Build firmware / build (8) (push) Canceled after 0s
Build firmware / build (7) (push) Canceled after 0s
Build firmware / build (6) (push) Canceled after 0s
Build firmware / build (5) (push) Canceled after 0s
Build firmware / build (4) (push) Canceled after 0s
Build firmware / build (3) (push) Canceled after 0s
Build firmware / build (2) (push) Canceled after 0s
Build firmware / build (14) (push) Canceled after 0s
Build firmware / build (13) (push) Canceled after 0s
Build firmware / build (12) (push) Canceled after 0s
Build firmware / build (11) (push) Canceled after 0s
Build firmware / build (10) (push) Canceled after 0s
Build firmware / build (1) (push) Canceled after 0s
Build firmware / build (0) (push) Canceled after 0s
Build firmware / detect (push) Canceled after 0s
Build pre-release / build (push) Canceled after 0s
Build pre-release / Release (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for MT48LC4M32B2 Component Driver</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="_htmresc/mini-st.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<div class="card fluid">
|
||||
<div class="sectione dark">
|
||||
<center>
|
||||
<h1 id="release-notes-for-mt48lc4m32b2-component-driver"><strong>Release Notes for MT48LC4M32B2 Component Driver</strong></h1>
|
||||
<p>Copyright © 2019 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<h1 id="license">License</h1>
|
||||
This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:
|
||||
<center>
|
||||
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
|
||||
</center>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This driver provides a set of SDRAM functions offered by MT48LC4M32B2 component. The mt48lc4m32b2_conf_template.h must be copied to application level, renamed into mt48lc4m32b2_conf.h and updated with adequate information.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history">Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.0.1 / 07-Mai-2020</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>mt48lc4m32b2_conf_template.h: Remove reference to F7 HAL as drivers can be used with all families.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 14-October-2019</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First Official release of MT48LC4M32B2 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
|
||||
<li>The component drivers are composed of
|
||||
<ul>
|
||||
<li>component core drivers files: mt48lc4m32b2.h/.c</li>
|
||||
<li>component configuration file: mt48lc4m32b2_conf_template.h</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="dependencies">Dependencies</h2>
|
||||
<p>This software release is compatible with:</p>
|
||||
<ul>
|
||||
<li>BSP Common v6.0.1 or above</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <span style="font-color: blue;"><a href="http://www.st.com/STM32">www.st.com</a></span>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
pagetitle: Release Notes for MT48LC4M32B2 Component Driver
|
||||
lang: en
|
||||
---
|
||||
|
||||
::: {.row}
|
||||
::: {.col-sm-12 .col-lg-4}
|
||||
|
||||
::: {.card .fluid}
|
||||
::: {.sectione .dark}
|
||||
<center>
|
||||
# **Release Notes for MT48LC4M32B2 Component Driver**
|
||||
Copyright © 2019 STMicroelectronics\
|
||||
|
||||
[](https://www.st.com){.logo}
|
||||
</center>
|
||||
:::
|
||||
:::
|
||||
|
||||
# License
|
||||
|
||||
This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this component except in
|
||||
compliance with the License. You may obtain a copy of the License at:
|
||||
<center>
|
||||
[https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)
|
||||
</center>
|
||||
|
||||
# Purpose
|
||||
|
||||
This driver provides a set of SDRAM functions offered by MT48LC4M32B2 component.
|
||||
The mt48lc4m32b2_conf_template.h must be copied to application level, renamed into mt48lc4m32b2_conf.h and updated with adequate information.
|
||||
|
||||
:::
|
||||
|
||||
::: {.col-sm-12 .col-lg-8}
|
||||
# Update History
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
|
||||
<label for="collapse-section2" aria-hidden="true">__V1.0.1 / 07-Mai-2020__</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- mt48lc4m32b2_conf_template.h: Remove reference to F7 HAL as drivers can be used with all families.
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true">
|
||||
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 14-October-2019__</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- First Official release of MT48LC4M32B2 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
|
||||
- The component drivers are composed of
|
||||
- component core drivers files: mt48lc4m32b2.h/.c
|
||||
- component configuration file: mt48lc4m32b2_conf_template.h
|
||||
|
||||
## Dependencies
|
||||
|
||||
This software release is compatible with:
|
||||
|
||||
- BSP Common v6.0.1 or above
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> ,
|
||||
visit: [[www.st.com](http://www.st.com/STM32)]{style="font-color: blue;"}
|
||||
</footer>
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,345 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file mt48lc4m32b2.c
|
||||
* @author MCD Application Team
|
||||
* @brief mt48lc4m32b2 sdram 128Mb driver file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "mt48lc4m32b2.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2 MT48LC4M32B2
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* MT48LC4M32B2 SDRAM memory.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2_Private_Variables MT48LC4M32B2 Private Variables
|
||||
* @{
|
||||
*/
|
||||
static FMC_SDRAM_CommandTypeDef Command;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2_Function_Prototypes MT48LC4M32B2 Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
static int32_t MT48LC4M32B2_Delay(uint32_t Delay);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2_Exported_Functions MT48LC4M32B2 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Initializes the MT48LC4M32B2 SDRAM memory
|
||||
* @param Ctx : Component object pointer
|
||||
* @param pRegMode : Pointer to Register Mode stucture
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_Init(SDRAM_HandleTypeDef *Ctx, MT48LC4M32B2_Context_t *pRegMode)
|
||||
{
|
||||
int32_t ret = MT48LC4M32B2_ERROR;
|
||||
|
||||
/* Step 1: Configure a clock configuration enable command */
|
||||
if(MT48LC4M32B2_ClockEnable(Ctx, pRegMode->TargetBank) == MT48LC4M32B2_OK)
|
||||
{
|
||||
/* Step 2: Insert 100 us minimum delay */
|
||||
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
|
||||
(void)MT48LC4M32B2_Delay(1);
|
||||
|
||||
/* Step 3: Configure a PALL (precharge all) command */
|
||||
if(MT48LC4M32B2_Precharge(Ctx, pRegMode->TargetBank) == MT48LC4M32B2_OK)
|
||||
{
|
||||
/* Step 4: Configure a Refresh command */
|
||||
if(MT48LC4M32B2_RefreshMode(Ctx, pRegMode->TargetBank, pRegMode->RefreshMode) == MT48LC4M32B2_OK)
|
||||
{
|
||||
/* Step 5: Program the external memory mode register */
|
||||
if(MT48LC4M32B2_ModeRegConfig(Ctx, pRegMode) == MT48LC4M32B2_OK)
|
||||
{
|
||||
/* Step 6: Set the refresh rate counter */
|
||||
if(MT48LC4M32B2_RefreshRate(Ctx, pRegMode->RefreshRate) == MT48LC4M32B2_OK)
|
||||
{
|
||||
ret = MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable SDRAM clock
|
||||
* @param Ctx : Component object pointer
|
||||
* @param Interface : Could be FMC_SDRAM_CMD_TARGET_BANK1 or FMC_SDRAM_CMD_TARGET_BANK2
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_ClockEnable(SDRAM_HandleTypeDef *Ctx, uint32_t Interface)
|
||||
{
|
||||
Command.CommandMode = MT48LC4M32B2_CLK_ENABLE_CMD;
|
||||
Command.CommandTarget = Interface;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
if(HAL_SDRAM_SendCommand(Ctx, &Command, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Precharge all sdram banks
|
||||
* @param Ctx : Component object pointer
|
||||
* @param Interface : Could be FMC_SDRAM_CMD_TARGET_BANK1 or FMC_SDRAM_CMD_TARGET_BANK2
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_Precharge(SDRAM_HandleTypeDef *Ctx, uint32_t Interface)
|
||||
{
|
||||
Command.CommandMode = MT48LC4M32B2_PALL_CMD;
|
||||
Command.CommandTarget = Interface;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
if(HAL_SDRAM_SendCommand(Ctx, &Command, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Program the external memory mode register
|
||||
* @param Ctx : Component object pointer
|
||||
* @param pRegMode : Pointer to Register Mode stucture
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_ModeRegConfig(SDRAM_HandleTypeDef *Ctx, MT48LC4M32B2_Context_t *pRegMode)
|
||||
{
|
||||
uint32_t tmpmrd;
|
||||
|
||||
/* Program the external memory mode register */
|
||||
tmpmrd = (uint32_t)pRegMode->BurstLength |\
|
||||
pRegMode->BurstType |\
|
||||
pRegMode->CASLatency |\
|
||||
pRegMode->OperationMode |\
|
||||
pRegMode->WriteBurstMode;
|
||||
|
||||
Command.CommandMode = MT48LC4M32B2_LOAD_MODE_CMD;
|
||||
Command.CommandTarget = pRegMode->TargetBank;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = tmpmrd;
|
||||
|
||||
/* Send the command */
|
||||
if(HAL_SDRAM_SendCommand(Ctx, &Command, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Program the SDRAM timing
|
||||
* @param Ctx : Component object pointer
|
||||
* @param pTiming : Pointer to SDRAM timing configuration stucture
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_TimingConfig(SDRAM_HandleTypeDef *Ctx, FMC_SDRAM_TimingTypeDef *pTiming)
|
||||
{
|
||||
/* Program the SDRAM timing */
|
||||
if(HAL_SDRAM_Init(Ctx, pTiming) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure Refresh mode
|
||||
* @param Ctx : Component object pointer
|
||||
* @param Interface : Could be FMC_SDRAM_CMD_TARGET_BANK1 or FMC_SDRAM_CMD_TARGET_BANK2
|
||||
* @param RefreshMode : Could be MT48LC4M32B2_CMD_AUTOREFRESH_MODE or
|
||||
* MT48LC4M32B2_CMD_SELFREFRESH_MODE
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_RefreshMode(SDRAM_HandleTypeDef *Ctx, uint32_t Interface, uint32_t RefreshMode)
|
||||
{
|
||||
Command.CommandMode = RefreshMode;
|
||||
Command.CommandTarget = Interface;
|
||||
Command.AutoRefreshNumber = 8;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
if(HAL_SDRAM_SendCommand(Ctx, &Command, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the device refresh rate
|
||||
* @param Ctx : Component object pointer
|
||||
* @param RefreshCount : The refresh rate to be programmed
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_RefreshRate(SDRAM_HandleTypeDef *Ctx, uint32_t RefreshCount)
|
||||
{
|
||||
/* Set the device refresh rate */
|
||||
if(HAL_SDRAM_ProgramRefreshRate(Ctx, RefreshCount) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enter Power mode
|
||||
* @param Ctx : Component object pointer
|
||||
* @param Interface : Could be FMC_SDRAM_CMD_TARGET_BANK1 or FMC_SDRAM_CMD_TARGET_BANK2
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_EnterPowerMode(SDRAM_HandleTypeDef *Ctx, uint32_t Interface)
|
||||
{
|
||||
Command.CommandMode = MT48LC4M32B2_POWERDOWN_MODE_CMD;
|
||||
Command.CommandTarget = Interface;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
if(HAL_SDRAM_SendCommand(Ctx, &Command, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Exit Power mode
|
||||
* @param Ctx : Component object pointer
|
||||
* @param Interface : Could be FMC_SDRAM_CMD_TARGET_BANK1 or FMC_SDRAM_CMD_TARGET_BANK2
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_ExitPowerMode(SDRAM_HandleTypeDef *Ctx, uint32_t Interface)
|
||||
{
|
||||
Command.CommandMode = MT48LC4M32B2_NORMAL_MODE_CMD;
|
||||
Command.CommandTarget = Interface;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
if(HAL_SDRAM_SendCommand(Ctx, &Command, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sends command to the SDRAM bank.
|
||||
* @param Ctx : Component object pointer
|
||||
* @param SdramCmd : Pointer to SDRAM command structure
|
||||
* @retval SDRAM status
|
||||
*/
|
||||
int32_t MT48LC4M32B2_Sendcmd(SDRAM_HandleTypeDef *Ctx, FMC_SDRAM_CommandTypeDef *SdramCmd)
|
||||
{
|
||||
if(HAL_SDRAM_SendCommand(Ctx, SdramCmd, MT48LC4M32B2_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return MT48LC4M32B2_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2_Private_Functions MT48LC4M32B2 Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This function provides accurate delay (in milliseconds)
|
||||
* @param Delay: specifies the delay time length, in milliseconds
|
||||
* @retval MT48LC4M32B2_OK
|
||||
*/
|
||||
static int32_t MT48LC4M32B2_Delay(uint32_t Delay)
|
||||
{
|
||||
uint32_t tickstart;
|
||||
tickstart = HAL_GetTick();
|
||||
while((HAL_GetTick() - tickstart) < Delay)
|
||||
{
|
||||
}
|
||||
return MT48LC4M32B2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file mt48lc4m32b2.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the description of the MT48LC4M32B2 SDRAM
|
||||
* memory.
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef MT48LC4M32B2_H
|
||||
#define MT48LC4M32B2_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "mt48lc4m32b2_conf.h"
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MT48LC4M32B2
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2_Exported_Types MT48LC4M32B2 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TargetBank; /*!< Target Bank */
|
||||
uint32_t RefreshMode; /*!< Refresh Mode */
|
||||
uint32_t RefreshRate; /*!< Refresh Rate */
|
||||
uint32_t BurstLength; /*!< Burst Length */
|
||||
uint32_t BurstType; /*!< Burst Type */
|
||||
uint32_t CASLatency; /*!< CAS Latency */
|
||||
uint32_t OperationMode; /*!< Operation Mode */
|
||||
uint32_t WriteBurstMode; /*!< Write Burst Mode */
|
||||
} MT48LC4M32B2_Context_t;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MT48LC4M32B2_Exported_Constants MT48LC4M32B2 Exported Constants
|
||||
* @{
|
||||
*/
|
||||
#define MT48LC4M32B2_OK (0)
|
||||
#define MT48LC4M32B2_ERROR (-1)
|
||||
|
||||
/* Register Mode */
|
||||
#define MT48LC4M32B2_BURST_LENGTH_1 0x00000000U
|
||||
#define MT48LC4M32B2_BURST_LENGTH_2 0x00000001U
|
||||
#define MT48LC4M32B2_BURST_LENGTH_4 0x00000002U
|
||||
#define MT48LC4M32B2_BURST_LENGTH_8 0x00000004U
|
||||
#define MT48LC4M32B2_BURST_TYPE_SEQUENTIAL 0x00000000U
|
||||
#define MT48LC4M32B2_BURST_TYPE_INTERLEAVED 0x00000008U
|
||||
#define MT48LC4M32B2_CAS_LATENCY_2 0x00000020U
|
||||
#define MT48LC4M32B2_CAS_LATENCY_3 0x00000030U
|
||||
#define MT48LC4M32B2_OPERATING_MODE_STANDARD 0x00000000U
|
||||
#define MT48LC4M32B2_WRITEBURST_MODE_PROGRAMMED 0x00000000U
|
||||
#define MT48LC4M32B2_WRITEBURST_MODE_SINGLE 0x00000200U
|
||||
|
||||
/* Command Mode */
|
||||
#define MT48LC4M32B2_NORMAL_MODE_CMD 0x00000000U
|
||||
#define MT48LC4M32B2_CLK_ENABLE_CMD 0x00000001U
|
||||
#define MT48LC4M32B2_PALL_CMD 0x00000002U
|
||||
#define MT48LC4M32B2_AUTOREFRESH_MODE_CMD 0x00000003U
|
||||
#define MT48LC4M32B2_LOAD_MODE_CMD 0x00000004U
|
||||
#define MT48LC4M32B2_SELFREFRESH_MODE_CMD 0x00000005U
|
||||
#define MT48LC4M32B2_POWERDOWN_MODE_CMD 0x00000006U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup MT48LC4M32B2_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t MT48LC4M32B2_Init(SDRAM_HandleTypeDef *Ctx, MT48LC4M32B2_Context_t *pRegMode);
|
||||
int32_t MT48LC4M32B2_ClockEnable(SDRAM_HandleTypeDef *Ctx, uint32_t Interface);
|
||||
int32_t MT48LC4M32B2_Precharge(SDRAM_HandleTypeDef *Ctx, uint32_t Interface);
|
||||
int32_t MT48LC4M32B2_ModeRegConfig(SDRAM_HandleTypeDef *Ctx, MT48LC4M32B2_Context_t *pRegMode);
|
||||
int32_t MT48LC4M32B2_TimingConfig(SDRAM_HandleTypeDef *Ctx, FMC_SDRAM_TimingTypeDef *pTiming);
|
||||
int32_t MT48LC4M32B2_RefreshMode(SDRAM_HandleTypeDef *Ctx, uint32_t Interface, uint32_t RefreshMode);
|
||||
int32_t MT48LC4M32B2_RefreshRate(SDRAM_HandleTypeDef *Ctx, uint32_t RefreshCount);
|
||||
int32_t MT48LC4M32B2_EnterPowerMode(SDRAM_HandleTypeDef *Ctx, uint32_t Interface);
|
||||
int32_t MT48LC4M32B2_ExitPowerMode(SDRAM_HandleTypeDef *Ctx, uint32_t Interface);
|
||||
int32_t MT48LC4M32B2_Sendcmd(SDRAM_HandleTypeDef *Ctx, FMC_SDRAM_CommandTypeDef *SdramCmd);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MT48LC4M32B2_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file mt48lc4m32b2_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains some configurations required for the
|
||||
* MT48LC4M32B2 SDRAM memory.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef MT48LC4M32B2_CONF_H
|
||||
#define MT48LC4M32B2_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Update the below line with adequate hal file. ie: #include "stm32f7xx_hal.h" */
|
||||
#include "stm32xxxx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MT48LC4M32B2
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MT48LC4M32B2_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define REFRESH_COUNT ((uint32_t)0x0603) /* SDRAM refresh counter */
|
||||
|
||||
#define MT48LC4M32B2_TIMEOUT ((uint32_t)0xFFFF)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* mt48lc4m32b2_CONF_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user