Renesas RX71M Series User Manual
Renesas RX71M Series User Manual

Renesas RX71M Series User Manual

Starter kit+ code generator tutorial manual
Hide thumbs Also See for RX71M Series:

Advertisement

Quick Links

RX71M Group
32
32
Renesas Starter Kit+ Code Generator Tutorial Manual
RENESAS MCU
RX Family / RX700 Series
All information contained in these materials, including products and product specifications, represents
information on the product at the time of publication and is subject to change by Renesas Electronics
Corporation without notice. Please review the latest information published by Renesas Electronics
Corporation through various means, including the Renesas Electronics Corporation website
(http://www.renesas.com).
2
For e
studio
Rev. 1.00 Jan 2015

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RX71M Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Renesas RX71M Series

  • Page 1 All information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject to change by Renesas Electronics Corporation without notice. Please review the latest information published by Renesas Electronics Corporation through various means, including the Renesas Electronics Corporation website (http://www.renesas.com).
  • Page 2 Electronics product for any application for which it is not intended. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics.
  • Page 3 . Renesas expressly disclaims all such warranties. Renesas or its affiliates shall in no event be liable for any loss of profit, loss of data, loss of contract, loss of business, damage to reputation or goodwill, any economic loss, any reprogramming or recall...
  • Page 4 The following documents apply to the RX71M Group. Make sure to refer to the latest versions of these documents. The newest versions of the documents listed may be obtained from the Renesas Electronics Web site. Document Type...
  • Page 5 Application Programming Interface Bits per second Compare Match Timer COMmunications port referring to PC serial port Central Processing Unit Digital Versatile Disc Renesas On-chip Debugging Emulator Graphical User Interface Integrated Development Environment Interrupt Request Liquid Crystal Display Light Emitting Diode...
  • Page 6: Table Of Contents

    Table of Contents 1. Overview ..........................7 Purpose ..............................7 Features ..............................7 2. Introduction ........................8 3. Project Creation with e studio ................... 9 Introduction ..............................9 Creating the Project ........................... 9 4. Code Generation Using the e studio plug in ..............14 Introduction ..............................
  • Page 7: Overview

    RENESAS STARTER KIT+ Jan 23, 2015 1. Overview Purpose This RSK+ is an evaluation tool for Renesas microcontrollers. This manual describes how to the e studio IDE code generator plug in to create a working project for the RSK+ platform. Features...
  • Page 8: Introduction

    RSK+RX71M 2. Introduction 2. Introduction This manual is designed to answer, in tutorial form, how to use the code generator plug in for the RX family together with the e studio IDE to create a working project for the RSK+ platform. The tutorials help explain the following: •...
  • Page 9: Project Creation With E Studio

    RSK+RX71M 3. Project Creation with e studio 3. Project Creation with e studio Introduction In this section the user will be guided through the steps required to create a new C project for the RX71M MCU, ready to generate peripheral driver code using Code Generator. This project generation step is necessary to create the MCU-specific source, project and debug files.
  • Page 10 • Enter the project name ‘CG_Tutorial’. In ‘Project type:’ choose ‘Sample Project’. ‘Toolchains’ choose ‘Renesas RXC Toolchain’. Click ‘Next’. • In the ‘Target Specific Settings’ dialog, select the options as shown in the screenshot opposite. • The R5F571MLCxFC MCU is found under RX700 ->...
  • Page 11 RSK+RX71M 3. Project Creation with e studio • In the ‘Code Generator Settings’ dialog, ensure the ‘Use Peripheral code Generator’ is checked. • Click ‘Next’. • In ‘Select Additional CPU Options’ leave everything at default values. • Click ‘Next’. R20UT3224EG0100 Rev. 1.00 Page 11 of 53 Jan 23, 2015...
  • Page 12 RSK+RX71M 3. Project Creation with e studio • In the ‘Global Options Settings’ leave everything at default values. • Click ‘Next’. • In the ‘Standard Header Files’ dialog, select C99 for ‘Library Configuration’. Untick ‘new(EC++)’ and leave all others at defaults. •...
  • Page 13 RSK+RX71M 3. Project Creation with e studio • In the next dialog, untick all check boxes except ‘I/O Register Definition Files’ as shown opposite. Click ‘Finish’. • A summary dialog will appear, click ‘OK’ complete project generation. R20UT3224EG0100 Rev. 1.00 Page 13 of 53 Jan 23, 2015...
  • Page 14: Code Generation Using The E Studio Plug In

    RSK+RX71M 4. Code Generation Using the e studio plug in 4.Code Generation Using the e studio plug in Introduction Code Generator is an e studio plug in GUI tool for generating template ‘C’ source code for the RX71M. When using Code Generator, the user is able to configure various MCU features and operating parameters using intuitive GUI controls, thereby bypassing the need in most cases to refer to sections of the Hardware Manual.
  • Page 15 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-1 Open Perspective Dialog In the Project Explorer pane, expand the ‘Code Generator’ and ‘Peripheral Functions’ node. The Code Generator initial view is displayed as illustrated in Figure 4-2. Figure 4-2 Initial View R20UT3224EG0100 Rev.
  • Page 16 RSK+RX71M 4. Code Generation Using the e studio plug in Code Generator provides GUI features for configuration of MCU sub systems. Once the user has configured all required MCU sub systems and peripherals, the user can click the ‘Generate Code’ button, resulting in a fully configured e studio project that builds and runs without error.
  • Page 17: Code Generation

    RSK+RX71M 4. Code Generation Using the e studio plug in Code Generation In the following sub-sections, the reader is guided through the steps to configure the MCU for a simple project containing interrupts for switch inputs, timers, ADC and a UART. 4.3.1 Clock Generator Figure 4-3 shows a screenshot of Code Generator with the Clock Generator function open.
  • Page 18 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-3 Clock setting tab Proceed to the next section on the Interrupt Controller Unit. R20UT3224EG0100 Rev. 1.00 Page 18 of 53 Jan 23, 2015...
  • Page 19 RSK+RX71M 4. Code Generation Using the e studio plug in 4.3.2 Interrupt Controller Unit Referring to the RSK+ schematic, SW1 is connected to IRQ5 (P15) and SW2 is connected to IRQ2 (P12). SW3 is connected to directly to the ADTRG0n and will be configured later in §4.3.4. Navigate to the ‘Interrupt Controller Unit’...
  • Page 20 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-5 Group Interrupt Functions tab 4.3.3 Compare Match Timer Navigate to the ‘Compare Match Timer’ node in Code Generator. CMT0 will be used as an interval timer for generation of accurate delays. CMT1 and CMT2 will be used as timers in de-bouncing of switch interrupts. In the ‘CMT0’...
  • Page 21 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-7 CMT1 tab Navigate to the ‘CMT2’ sub-tab and configure CMT2 as shown in Figure 4-8. This timer is configured to generate a High priority interrupt after 200ms. This timer is used as our long switch de-bounce timer later in this tutorial.
  • Page 22 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-9 A/D Converter tab R20UT3224EG0100 Rev. 1.00 Page 22 of 53 Jan 23, 2015...
  • Page 23 RSK+RX71M 4. Code Generation Using the e studio plug in 4.3.5 Serial Communications Interface Navigate to the ‘Serial Communications Interface’ tab in Code Generator, select the SCI6 sub-tab and apply the settings shown in Figure 4-10. In the RSK+RX71M SCI6 is used as an SPI master for the Okaya Pmod LCD on the PMOD1 connector as shown in the schematic.
  • Page 24 Staying in the ‘Serial Communications Interface’ tab in Code Generator, select the SCI7 sub-tab and apply the settings shown in Figure 4-12. In the RSK+RX71M SCI7 is connected via a Renesas RL78/G1C to provide a USB virtual COM port as shown in the schematic.
  • Page 25 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-12 SCI7 General Setting tab Select the SCI7 ‘Setting’ sub-tab and configure SCI7 as illustrated in Figure 4-13. Make sure the ‘Start bit edge detection’ is set as ‘Falling edge on RXD7 pin’ and the ‘Bit rate’ is set to 19200 bps. All other settings remain at their defaults.
  • Page 26 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-13 SCI7 Asynchronous Setting R20UT3224EG0100 Rev. 1.00 Page 26 of 53 Jan 23, 2015...
  • Page 27 RSK+RX71M 4. Code Generation Using the e studio plug in 4.3.6 I/O Ports Referring to the RSK+ schematic, LED0 is connected to P03, LED1 is connected to P05, LED2 is connected to P26 and LED3 is connected to P27. Navigate to the ‘I/O Ports’ tab in Code Generator and configure these four I/O lines as shown in Figure 4-14 and Figure 4-15 below.
  • Page 28 RSK+RX71M 4. Code Generation Using the e studio plug in Figure 4-15 I/O ports – Port2 P45 is used as one of the LCD control lines, together with P46 and P47. Configure these lines as shown in Figure 4-16. Figure 4-16 I/O ports – Port4 R20UT3224EG0100 Rev.
  • Page 29 RSK+RX71M 4. Code Generation Using the e studio plug in Peripheral function configuration is now complete. Save the project using the File -> Save, then click ‘Generate Code’. The Console pane should report ‘The operation of generating file was successful’, as shown Figure 4-17 below.
  • Page 30: Building The Project

    RSK+RX71M 4. Code Generation Using the e studio plug in Building the Project The project is template created by Code Generator can now be built. In the Project Explorer pane expand the ‘src’ folder. The three files created by the New Project Wizard in §3.2 have been excluded from the build automatically as part of the code generation procedure as shown in Figure 4-18.
  • Page 31: User Code Integration

    RSK+RX71M 5. User Code Integration 5.User Code Integration In this section the remaining application code is added to the project. Source files found on the RSK+ DVD are copied into the workspace and the user is directed to add code in the user areas of the code generator files.
  • Page 32 RSK+RX71M 5. User Code Integration R_MAIN_UserInit(); /* Start user code. Do not edit comment generated here */ /* Initialize the debug LCD */ R_LCD_Init(); /* Displays the application name on the debug LCD */ R_LCD_Display(0, (uint8_t *)" RSK+RX71M "); R_LCD_Display(1, (uint8_t *)" Tutorial "); R_LCD_Display(2, (uint8_t *)"...
  • Page 33 RSK+RX71M 5. User Code Integration /********************************************************************************* * End of function R_SCI6_SPIMasterTransmit **********************************************************************************/ This function uses the transmit end callback function to perform flow control on the SPI transmission to the LCD, and is used as the main API call in the LCD code module. 5.1.2 CMT Code The LCD code needs to insert delays to meet the timing requirements of the display module.
  • Page 34: Additional Include Paths

    RSK+RX71M 5. User Code Integration Additional include paths Before the project can be built the compiler needs some additional include paths added. Select the CG_Tutorial project in the Project Explorer pane. Use the button in the toolbar to open the project settings. Navigate to ‘C/C++ Build ->...
  • Page 35: Switch Code Integration

    RSK+RX71M 5. User Code Integration Switch Code Integration API functions for user switch control are provided with the RSK. Locate the files rskrx71mdef.h, r_rsk_switch.h and r_rsk_switch.c on the RSK DVD. These files can be found in the Tutorial project for e studio.
  • Page 36 RSK+RX71M 5. User Code Integration /****************************************************************************** * End of function R_ICU_IRQSetFallingEdge *******************************************************************************/ /******************************************************************************* * Function Name: R_ICU_IRQSetRisingEdge * Description : This function sets/clear the rising edge trigger for the specified ICU_IRQ. * Arguments : uint8_t irq_no uint8_t set_r_edge, 1 if setting rising edge triggered, 0 if clearing * Return Value : None *******************************************************************************/...
  • Page 37 RSK+RX71M 5. User Code Integration In the same file insert the following code in the user code area inside the function r_cmt_cmi2_interrupt (): /* Start user code. Do not edit comment generated here */ /* Stop this timer - we start it again in the de-bounce routines */ R_CMT2_Stop();...
  • Page 38 RSK+RX71M 5. User Code Integration /* Prototype declaration for lcd_display_adc */ static void lcd_display_adc (const uint16_t adc_result); /* Variable for flagging user requested ADC conversion */ volatile uint8_t g_adc_trigger = FALSE; /* End user code. Do not edit comment generated here */ Next add the highlighted code below in the user code area inside the main() function and the code inside the while loop, resulting in the code shown below: void...
  • Page 39 RSK+RX71M 5. User Code Integration * Return value : none ******************************************************************************/ static void cb_switch_press (void) /* Check if switch 1 or 2 was pressed */ (g_switch_flag & (SWITCHPRESS_1 SWITCHPRESS_2)) /* set the flag indicating a user requested A/D conversion is required */ g_adc_trigger TRUE;...
  • Page 40 RSK+RX71M 5. User Code Integration (uint8_t)((adc_result & 0x0F00) >> lcd_buffer[6] (char)((a < 0x0A) 0x30) : (a 0x37)); (uint8_t)((adc_result & 0x00F0) >> lcd_buffer[7] (char)((a < 0x0A) 0x30) : (a 0x37)); (uint8_t)(adc_result & 0x000F); lcd_buffer[8] (char)((a < 0x0A) 0x30) : (a 0x37)); /* Display the contents of the local string lcd_buffer */ R_LCD_Display(3, (uint8_t *)lcd_buffer);...
  • Page 41: Debug Code Integration

    RSK+RX71M 5. User Code Integration /* End user code. Do not edit comment generated here */ Insert the following code in the in the user code area of the r_s12ad0_interrupt () function, resulting in the code shown below: static void r_s12ad0_interrupt(void) /* Start user code.
  • Page 42 RSK+RX71M 5. User Code Integration static volatile uint8_t sci7_txdone; /* End user code. Do not edit comment generated here */ In the same file, insert the following code in the user code area inside the r_sci7_callback_transmitend() function: static void r_sci7_callback_transmitend(void) /* Start user code.
  • Page 43 RSK+RX71M 5. User Code Integration 5.5.2 Main UART code Open the file ‘r_cg_main.c’. Add the following declaration to the user code area for include near the top of the file: #include "r_rsk_debug.h" Add the following declaration to the user code area for global near the top of the file: /* Prototype declaration for uart_display_adc */ static void uart_display_adc(const uint8_t adc_count,...
  • Page 44 RSK+RX71M 5. User Code Integration /* Get the result of the A/D conversion */ R_S12AD0_Get_ValueResult(ADCHANNEL0, &adc_result); /* Display the result on the LCD */ lcd_display_adc(adc_result); /* Increment the adc_count */ ++adc_count) adc_count /* Send the result to the UART */ uart_display_adc(adc_count, adc_result);...
  • Page 45: Led Code Integration

    RSK+RX71M 5. User Code Integration LED Code Integration Open the file ‘r_cg_main.c’. Add the following declaration to the user code area for include near the top of the file: #include "rskrx71mdef.h" /* End user code. Do not edit comment generated here */ Add the following declaration to the user code area for global near the top of the file: /* Prototype declaration for led_display_count */ static void led_display_count(const...
  • Page 46 RSK+RX71M 5. User Code Integration R_S12AD0_Get_ValueResult(ADCHANNEL0, &adc_result); /* Display the result on the LCD */ lcd_display_adc(adc_result); /* Increment the adc_count and display using the LEDs */ ++adc_count) adc_count led_display_count(adc_count); /* Send the result to the UART */ uart_display_adc(adc_count, adc_result); /* Reset the flag */ g_adc_complete FALSE;...
  • Page 47: Debugging The Project

    In the Project Explorer pane, ensure that the ‘CG_Tutorial’ project is selected. To enter the debug configurations click upon the arrow next to the debug button and select ‘Debug Configuration’. In order to run the project there are two setting under ‘Renesas GDB Hardware Debugging’ -> ‘Connection Settings’ that need modifying.
  • Page 48 RSK+RX71M 7. Additional Information Figure 6-2 Perspective Switch Dialog Click ‘OK’ to confirm that the debug window perspective will be used. The debugger will start up and the code will stop at the Code Generator function ‘PowerOn_Reset_PC’ as shown in Figure 6-3. Figure 6-3 Debugger start up screen To run the code click the button.
  • Page 49: Additional Information

    Copyright This document may be, wholly or partially, subject to change without notice. All rights reserved. Duplication of this document, either in whole or part is prohibited without the written permission of Renesas Electronics Europe Limited. © 2015 Renesas Electronics Europe Limited. All rights reserved.
  • Page 50 REVISION HISTORY RX71M Code Generator Tutorial Manual Rev. Date Description Page Summary  1.00 Jan 23, 2015 First Edition issued...
  • Page 51 Renesas Starter Kit Manual: Code Generator Tutorial Manual Publication Date: Rev. 1.00 Jan 23, 2015 Published by: Renesas Electronics Corporation...
  • Page 52 SALES OFFICES Refer to "http://www.renesas.com/" for the latest and detailed information. Renesas Electronics America Inc. 2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A. Tel: +1-408-588-6000, Fax: +1-408-588-6130 Renesas Electronics Canada Limited 9251 Yonge Street, Suite 8309 Richmond Hill, Ontario Canada L4C 9T3...
  • Page 53 RX71M Group R20UT3224EG0100...

This manual is also suitable for:

Rx seriesRx700 series

Table of Contents