Skip to main content
Knowledgebase
Home
Renesas India - Knowledgebase

How do I create an external bus interface within SSP for Synergy MCUs?

Latest Updated:09/19/2016

Question:

How do I create an external bus interface within the Synergy Software Package (SSP) for Synergy MCUs?

Answer:

You can create an external bus interface using the MCU bus interface resources.

For example, the S3A7 MCU, as shown in Section 15.2.3 of the User Manual, can be configured using the external bus interface for external accesses. 

A code example, showing how to configure key registers for either 8-bit or 16-bit operation is given below and in the below text file. Refer to the S3A7 MCU Hardware Reference Manual for the details on register field definitions: 

https://www.renesas.com/doc/pr...fef8af37373722 

Note that the R_BSP_Warmstart() call is a weak reference located in system_<core>.c and the code given below needs to be placed in your src folder so it will 'replace' the weak reference.

 

/***********************************************************************************************************************
 * Copyright [2016] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
 *
 * The contents of this file (the �contents�) are proprietary and confidential to Renesas Electronics Corporation
 * and/or its licensors (�Renesas�) and subject to statutory and contractual protections.
 *
 * Unless otherwise expressly agreed in writing between Renesas and you: 1) you may not use, copy, modify, distribute,
 * display, or perform the contents; 2) you may not use any name or mark of Renesas for advertising or publicity
 * purposes or in connection with your use of the contents; 3) RENESAS MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE
 * SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED �AS IS� WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
 * NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES,
 * INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF CONTRACT OR TORT, ARISING
 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents included in this file may
 * be subject to different terms.
 **********************************************************************************************************************/
/**********************************************************************************************************************
* File Name    : bsp_exbus.c
* Description  : External Bus initialization.
***********************************************************************************************************************
* History : DD.MM.YYYY Version Description
*           03.23.2015 1.00    Initial Release.
*     03.07.2016 1.10    Edits to Comments.
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "bsp_api.h"

#ifdef EX_16BIT_BUS
void bsp_exbus_init(void)
{
 R_BUS->CSRC1[0].CSnCR_b.BSIZE = 0;  // 16 bit bus
 R_BUS->CSRC1[0].CSnCR_b.EMODE = 0;  // Little Endian
 R_BUS->CSRC0[0].CSnMOD_b.WRMOD = 1;  // Single Write Strobe
 R_BUS->CSRC0[0].CSnWCR2_b.CSWOFF = 0;  // Write-Access CS Extension Cycle Select=> 1wait
// R_BUS->CSRC0[0].CSnWCR2_b.WDOFF = 1;  // Write-Access CS Extension Cycle Select=> 1wait
 R_BUS->CSRECEN = 0x3e00;   // No recovery cycle wait states
 R_BUS->CSRC0[0].CSnWCR1_b.CSPRWAIT = 0;
 R_BUS->CSRC0[0].CSnWCR1_b.CSPWWAIT = 0;
 R_BUS->CSRC0[0].CSnWCR1_b.CSRWAIT = 0;
 R_BUS->CSRC0[0].CSnWCR1_b.CSWWAIT = 0;

 R_BUS->CSRC1[0].CSnREC_b.WRCV =1;
 R_BUS->CSRECEN_b.RECVEN6 = 1;
 R_BUS->CSRECEN_b.RECVEN7 = 1;

}
#else
void bsp_exbus_init(void)
{
 R_BUS->CSRC1[0].CSnCR_b.BSIZE = 2;  // 8 bit bus
 R_BUS->CSRC1[0].CSnCR_b.EMODE = 1;  // Big Endian
 R_BUS->CSRC0[0].CSnMOD_b.WRMOD = 0;  // Byte Mode Strobe
 R_BUS->CSRC0[0].CSnWCR2_b.CSWOFF = 0;  // Write-Access CS Extension Cycle Select=> 1wait
 R_BUS->CSRC0[0].CSnWCR2_b.WDOFF = 0;  // Write-Data Output Extension Cycle Select=> 1wait
 R_BUS->CSRECEN = 0x3e00;   // No recovery cycle wait states
 R_BUS->CSRC0[0].CSnWCR1_b.CSPRWAIT = 0;
 R_BUS->CSRC0[0].CSnWCR1_b.CSPWWAIT = 0;
 R_BUS->CSRC0[0].CSnWCR1_b.CSRWAIT = 0;
 R_BUS->CSRC0[0].CSnWCR1_b.CSWWAIT = 0;

 R_BUS->CSRC1[0].CSnREC_b.WRCV =1;  // Write Recovery cycle
 R_BUS->CSRECEN_b.RECVEN6 = 1;   // Write Recovery for same area write after write access
 R_BUS->CSRECEN_b.RECVEN7 = 1;   // Write Recovery for different area write after write access
}

#endif

/*
 *
 *  Warm Start Initialization of External Bus
 *
 */

void R_BSP_WarmStart (bsp_warm_start_event_t event)
{

if (event == BSP_WARM_START_PRE_C)
{
 bsp_exbus_init();
}
if (event == BSP_WARM_START_POST_C)
{
}
}