RZT Flexible Software Package Documentation
Release v2.2.0
|
|
Functions | |
fsp_err_t | R_BSC_SDRAM_Open (sdram_ctrl_t *p_ctrl, sdram_cfg_t const *const p_cfg) |
fsp_err_t | R_BSC_SDRAM_SelfRefreshEnter (sdram_ctrl_t *p_ctrl) |
fsp_err_t | R_BSC_SDRAM_SelfRefreshExit (sdram_ctrl_t *p_ctrl) |
fsp_err_t | R_BSC_SDRAM_PowerDownEnter (sdram_ctrl_t *p_ctrl) |
fsp_err_t | R_BSC_SDRAM_PowerDownExit (sdram_ctrl_t *p_ctrl) |
fsp_err_t | R_BSC_SDRAM_Close (sdram_ctrl_t *p_ctrl) |
Driver for the BSC peripheral on RZ microprocessor. This module implements the SDRAM Interface.
The BSC SDRAM driver has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking Enable |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
Configuration | Options | Default | Description |
---|---|---|---|
General > Name | Name must be a valid C symbol | g_sdram0 | Module name. |
General > Chip Select | Chip Select 3 | Chip Select 3 | Specify the SDRAM chip select line to use. |
General > Data Bus Width | 16-bit | 16-bit | Select the number of SDRAM data bus width. |
Idle Cycles > Read-Read Cycles In The Same CS Space |
| 4 CYCLES | Idle cycle insertion between Read-Read cycles in the same CS space. |
Idle Cycles > Read-Read Cycles In The Different CS Spaces |
| 4 CYCLES | Idle cycle insertion between Read-Read cycles in different CS space. |
Idle Cycles > Read-Write Cycles In The Same CS Spaces |
| 4 CYCLES | Idle cycle insertion between Read-Write cycles in the same CS space. |
Idle Cycles > Read-Write Cycles In The Different CS Spaces |
| 4 CYCLES | Idle cycle insertion between Read-Write cycles in different CS space. |
Idle Cycles > Write-Read Cycles And Write-Write Cycles |
| 4 CYCLES | Idle cycles between Write-Read cycles and Write-Write cycles. |
Address Bit Width > Row Address Bit Width |
| 11-bit | Select the number of SDRAM row address bus width. |
Address Bit Width > Column Address Bit Width |
| 8-bit | Select the number of SDRAM column address bus width. |
Wait Insertion for SDRAM Timing > RAS# Precharge Cycle (PRECHARGE to ACTIVE) |
| 0 CYCLE | Number of Auto-Precharge Completion Wait States (tRP) |
Wait Insertion for SDRAM Timing > RAS# To CAS# Delay Cycle (ACTIVE to READ/WRITE) |
| 0 CYCLE | Number of Waits between ACTV Command and READ(A)/WRIT(A) Command (tRCD) |
Wait Insertion for SDRAM Timing > CAS Latency |
| 1 CYCLE | CAS Latency (tCL) |
Wait Insertion for SDRAM Timing > Last data in to Active Latency (WRITA to ACTIVE) / Write Recovery Cycle (WRIT to PRECHARGE) |
| 0 CYCLE | The state number from the issuance of the WRITA command until the issuance of the ACTV command (tDAL) / The state number from the issuance of the WRIT command until the issuance of the PRE command (tWR) |
Wait Insertion for SDRAM Timing > Row Cycle (ACTIVE to ACTIVE) |
| 2 CYCLES | Number of Idle States from REF Command/Self-Refresh Release to ACTV/REF/MRS Command (tRC) |
Auto Refresh > Refresh Cycle Period (tREF) | Value must be non-negative | 64 | Refresh Cycle Time (tREF) |
Auto Refresh > Refresh Cycle Period Unit | Milliseconds | Milliseconds | Unit of the period specified above |
Auto Refresh > The Number of Continuous Refresh Cycles |
| 1 | A refresh request is generated and an auto-refresh is performed for the number of times specified by this configuration. |
Extra > MRS Burst Setting |
| Burst Read / Burst Write | Write Burst Mode setting of SDRAM mode register |
Extra > Command Mode |
| Auto Precharge Mode (using READA and WRITA commands) | Select whether to access in auto-precharge mode (using READA and WRITA commands) or in bank active mode (using READ and WRIT commands). |
Interrupts > Callback | Name must be a valid C symbol | NULL | A user callback function can be provided. If this callback function is provided, it will be called from the interrupt service routine (ISR). |
Interrupts > Refresh Timer Compare Match Interrupt Priority | MCU Specific Options | Select the refresh timer compare match interrupt priority. |
Auto-Refresh operation interval is calculated from "Refresh Cycle Period (tREF)" , "Row Address Bit Width" and "The Number of Continuous Refresh Cycles" user-setting. In the example below, Auto-Refresh operation interval setting target to the BSC peripheral is 7.8125 us. This interval is counted by CKIO clock.
Refresh Cycle Period (tREF) = 64 ms
Row Address Bit Width = 13bit = 8192 row
The Number of Continuous Refresh Cycles = 1
Auto-Refresh operation interval = (64 ms / 8192) * 1 = 7.8125 us
The BSC clock is derived from External bus clock (BSC_CLK, CKIO). You can set the clock frequency using the Clocks tab of the FSP Configuration editor or by using the CGC Interface at run-time.
After R_BSC_SDRAM_Open() completes successfully, the connected SDRAM device contents are mapped to address 0x78000000(External address space CS3) or 0x58000000(Mirror space of External address space CS3) and can be read like internal memory.
When not using the cache, access the memory via the mirror space.
The address map for the external address space for BSC_SDRAM is as follows:
Address | Space |
---|---|
0x58000000 to 0x5BFFFFFF | CS3 mirror space |
0x78000000 to 0x7BFFFFFF | CS3 space |
After R_BSC_SDRAM_Open() completes successfully, BSC_SDRAM starts Auto-Refresh operation which issues refresh command every configured cycle.
If not using the auto-refresh operation after R_BSC_SDRAM_Open(), self-refresh operation can be started by calling R_BSC_SDRAM_SelfRefreshEnter() after R_BSC_SDRAM_Open().
This is a basic example of minimal use of the BSC_SDRAM module in an application.
Data Structures | |
struct | bsc_sdram_callback_args_t |
struct | bsc_sdram_extended_cfg_t |
struct | bsc_sdram_instance_ctrl_t |
Enumerations | |
enum | bsc_sdram_chip_select_t |
enum | bsc_sdram_idle_cycle_t |
enum | bsc_sdram_command_t |
struct bsc_sdram_callback_args_t |
struct bsc_sdram_extended_cfg_t |
Extended configuration.
Data Fields | |
bsc_sdram_chip_select_t | chip_select |
Select which device to use. | |
bsc_sdram_idle_cycle_t | r_r_same_space_idle_cycle |
bsc_sdram_idle_cycle_t | r_r_different_space_idle_cycle |
bsc_sdram_idle_cycle_t | r_w_same_space_idle_cycle |
bsc_sdram_idle_cycle_t | r_w_different_space_idle_cycle |
bsc_sdram_idle_cycle_t | w_r_w_w_idle_cycle |
bsc_sdram_command_t | command_mode |
uint8_t | cmi_ipl |
SDRAM refresh compare match interrupt. | |
IRQn_Type | cmi_irq |
SDRAM refresh compare match interrupt priority. | |
void(* | p_callback )(bsc_sdram_callback_args_t *p_args) |
void const * | p_context |
bsc_sdram_idle_cycle_t bsc_sdram_extended_cfg_t::r_r_same_space_idle_cycle |
Idle cycle between Read-Read cycles in the same CS space
bsc_sdram_idle_cycle_t bsc_sdram_extended_cfg_t::r_r_different_space_idle_cycle |
Idle cycle between Read-Read cycles in the different CS space
bsc_sdram_idle_cycle_t bsc_sdram_extended_cfg_t::r_w_same_space_idle_cycle |
Idle cycle between Read-Write cycles in the same CS space
bsc_sdram_idle_cycle_t bsc_sdram_extended_cfg_t::r_w_different_space_idle_cycle |
Idle cycle between Read-Write cycles in the different CS space
bsc_sdram_idle_cycle_t bsc_sdram_extended_cfg_t::w_r_w_w_idle_cycle |
Idle cycle between Write-Read cycles and Write-Write cycles
bsc_sdram_command_t bsc_sdram_extended_cfg_t::command_mode |
Auto-precharge mode (using READA/WRITA commands) or Bank active mode (using READ/WRIT commands)
void(* bsc_sdram_extended_cfg_t::p_callback) (bsc_sdram_callback_args_t *p_args) |
Callback for SDRAM refresh compare match.
void const* bsc_sdram_extended_cfg_t::p_context |
Placeholder for user data. Passed to the user callback in bsc_sdram_callback_args_t.
struct bsc_sdram_instance_ctrl_t |
Instance control block. DO NOT INITIALIZE. Initialization occurs when sdram_api_t::open is called
Number of insertion idle cycle between access cycles
enum bsc_sdram_command_t |
Specify SDRAM command
fsp_err_t R_BSC_SDRAM_Open | ( | sdram_ctrl_t * | p_ctrl, |
sdram_cfg_t const *const | p_cfg | ||
) |
Open the BSC_SDRAM driver module. Configure the BSC and operate the SDRAM initialization. (PALL command is firstly issued. REF command is issued 8 times. MRS command is finally issued.)
User can access to the SDRAM like internal memory starting at address 0x78000000 or 0x58000000.
Implements sdram_api_t::open.
FSP_SUCCESS | Configuration was successful. |
FSP_ERR_ASSERTION | The parameter p_instance_ctrl or p_cfg is NULL. |
FSP_ERR_INVALID_CHANNEL | Invalid Channel. |
FSP_ERR_ALREADY_OPEN | Driver has already been opened with the same p_instance_ctrl. |
FSP_ERR_INVALID_ARGUMENT | SDRAM parameter is not available. |
fsp_err_t R_BSC_SDRAM_SelfRefreshEnter | ( | sdram_ctrl_t * | p_ctrl | ) |
Enters Self-Refresh mode.
Implements sdram_api_t::selfRefreshEnter.
FSP_SUCCESS | The flash was programmed successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_INVALID_MODE | This function can't be called when SDRAM is in Power-down mode. |
FSP_ERR_NOT_OPEN | Driver is not opened. |
fsp_err_t R_BSC_SDRAM_SelfRefreshExit | ( | sdram_ctrl_t * | p_ctrl | ) |
Exits Self-Refresh mode. Auto-Refresh operation is re-started to the SDRAM.
Implements sdram_api_t::selfRefreshExit.
FSP_SUCCESS | The flash was programmed successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | Driver is not opened. |
fsp_err_t R_BSC_SDRAM_PowerDownEnter | ( | sdram_ctrl_t * | p_ctrl | ) |
Enters Power-Down mode.
Implements sdram_api_t::powerDownEnter.
FSP_SUCCESS | The flash was programmed successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_INVALID_MODE | This function can't be called when SDRAM is in Self-Refresh mode. |
FSP_ERR_NOT_OPEN | Driver is not opened. |
fsp_err_t R_BSC_SDRAM_PowerDownExit | ( | sdram_ctrl_t * | p_ctrl | ) |
Exits Power-Down mode.
Implements sdram_api_t::powerDownExit.
FSP_SUCCESS | The flash was programmed successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | Driver is not opened. |
fsp_err_t R_BSC_SDRAM_Close | ( | sdram_ctrl_t * | p_ctrl | ) |
Close the BSC_SDRAM driver module.
Implements sdram_api_t::close.
FSP_SUCCESS | Configuration was successful. |
FSP_ERR_ASSERTION | p_instance_ctrl is NULL. |
FSP_ERR_NOT_OPEN | Driver is not opened. |