Using Virtual EEPROM and Flash API for Renesas MCUs_LabProcedures

27 965 0
Using Virtual EEPROM and Flash API for Renesas MCUs_LabProcedures

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 1 of 27 RL78 Ultra Low Power LAB – CL07I Description: This lab will demonstrate low power modes of the RL78 and show how important pin setups are to achieve the best power performance. The lab will also demonstrate how the Applilet code generator simplifies getting started with the RL78 Lab Sections 1 Running the Pre-Programmed Application: 2 2 Generate IAR Project using Applilet 4 3 Edit/Build IAR Project 8 4 Download and Debug IAR Project 18 3 5 Configuring Unused Pins 15 6 Flash Programming and Low Power 17 Lab Objectives 1. Demonstrate the low power modes of the RL78 2. Generate IAR project using Applilet 3. Edit/Compile/build/debug the project in IAR IDE Skill Level 1. New to RL78/ IAR Tools Time to Complete Lab 1 hour Lab Materials Please verify you have the following materials at your lab station. • Laptop PC with IAR/Applilet tools pre-installed • IAR Kickstart V1.20.1 KS • Applilet3 for RL78/G14 V1.01.01 • Renesas Flash Programmer V1.03 • YRPBRL78G14 target board • USB cable • Multimeter LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 2 of 27 1 Running the Pre-Programmed Application: This lab section is designed to highlight the features which come as the default program with the RL78 demo board. This is a quick overview, there is much more information in the Quickstart Guide for the kit Step 1.1 Remove the jumper on CN4 on the Demo Board and place a multimeter configured to measure milliamps across those terminals. Set the multimeter to 20 mA range. Step 1.2 Make sure that jumpers are placed on CN6, CN7, CN8 and CN11, positions 2-3, labeled “Virtual UART”. Step 1.3 To start the demonstrations ensure that the USB stick is connected to the laptop PC via USB cable. Step 1.4 The Demonstrations are controlled by the YRPBRL78G14 GUI which can be started from the “Start -> All Programs -> Renesas Electronics Tools -> YRPBRL78G14 -> YRPBRL78G14-Demo” menu or from the icon on the desktop. LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 3 of 27 Step 1.5 The GUI should now be connected and running. Diode D2 should now be blinking and the graphs and data values on the GUI start page should now be updating with the USB stick parameters as shown below The demo allows you to investigate many of the unique features of the RL78. These include: a. Real Time Clock configuration and settings - Note that this tab allows you to synch the RTC to the PC clock and set alarms and interval interrupts using the RTC b. Memory demo including RAM and Data Flash (EEPROM) c. Self Test – Highlights the self-test features of the RL78 and memory protection features You can click the various tabs and you will see the demos that are available. Step 1.6 We will concentrate on the Low Power demo. Select this tab. Step 1.7 With the program running in normal 32 MHz mode record the current on the multimeter. ____________________________ mA LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 4 of 27 Step 1.8 Now select the “Halt” button and record the multimeter current. ____________________________ mA Step 1.9 Select “Release” for the Halt mode, the current should go back to the original reading. Step 1.10 Select the “Stop” button and record the multimeter current. ____________________________ mA Step 1.11 Select “Release” for the stop mode, the current should go back to the original reading. Now that you have seen the impressive low power numbers for the RL78 we will show how to recreate those numbers with your code. 2 Generate IAR Project using Applilet: This lab section will show how to use Applilet to quickly create a project. Then we will place the MCU into various low power operating modes. The project uses RL78G14 Family device, R5F104LE. We will create a simple project that blinks LED (D2) every 1s with RTC interrupt. Procedural Steps Step 2.1 Close the demo program and disconnect the USB cable. Step 2.2 Move the four jumpers (CN6, CN7, CN8, CN11) in the middle of the board to position 1-2 which enables the OCD . Step 2.3 Open Applilet by clicking the desktop shortcut or from the menu : Start -> All Programs -> Applilet -> Applilet3 for RL78G14 -> V1.01.01-> Applilet3 for RL78G14 V1.01.01. Step 2.4 From Applilet, select “File>new”. This will open “New Project” window. Step 2.5 Enter the options below to configure project environment for R5F104LE device. The device in the RL78 Stick is the R5F104LE: Ensure that ‘Kind of project’ “Project for RL78/78K0R” Halt mode stops the clock to the CPU core but maintains clocks to the peripherals which are enabled Stop mode stops the clocks to the CPU and peripherals but can allow the WDT and RTC to be functional. Low Voltage Detect (LVD) is also enabled LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 5 of 27 Scroll down the “Using microcontroller” device list to find the 64k Flash version Click on RL78/G14(ROM:64KB),select device :“R5F100LE(64pin)”. Specify “Using Build Tools ‘IAR Compiler’ Specify ‘Project name’ ‘MyRL78G14Project’ Specify ‘Place’ ‘C:\RL78_Projects’ Step 2.6 Click OK to create the new project Step 2.7 The next screen shows the Applilet Code Generator. You may recognize this from CubeSuite or from previous Applilet versions. Note: If this is not what your screen looks like, then you are using a different version of Applilet. LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 6 of 27 Step 2.8 For this project, leave the boxes unchecked and click on “Fix Settings.” Other settings are handy for projects that need enhanced serial or timer functionalities. The project opens for you to begin at the System Settings. The first thing to decide is how the pin assignment is set. This setting can only be done once per project. The default is PIOR = 0x00, where PIOR = Port IO Re-direction register. LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 7 of 27 Step 2.9 Select the “Clock setting” tab. Select the settings as shown in the below picture (all are default except we check the SubClock Operation box): Operation Mode Setting High speed main mode 2.7≤VDD≤5.5 EVDD setting 4.0V-5.5V Main system clock (fMAIN) setting High-speed OCO High Speed OCO clock setting: 64MHz (TAU timer is 64MHZ, CPU is 32MHZ) High-Speed System Clock setting Unchecked Subsystem clock (fSUB setting) Operation checked XT1 Oscillation: Checked Frequency: 32.768kHz XT1 oscillator Oscillation mode setting: Ultra Low power consumption Subsytem Clock in Stop Mode Stops supply (except real-time counter and interval timer) RTC operation clock: 32.768 (fSub) CPU and peripheral clock : 32000 (flH). LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 8 of 27 Step 2.10 Select the On-Chip Debug Tab. Select these settings: On-Chip Debug: “Used” RRM function setting ‘Used’ (default) or ‘Unused’ – either setting is OK Use Security ID Checked Security ID 0x00000000000000000000 Erase Flash Memory Data Checked Security ID Authentication Erase flash memory data Step 2.11 Reset Source and Safety functions can be left as default. Step 2.12 Select the Port tab from project tree, select Port7, and set bit 7 as output, with level at 1. This is for driving the on-board LED (other pins should be left as unused): Note: “Unused” just means the Port pin is not yet reserved for General Purpose Input/Output use, so alternate peripheral function can be can be specified. However, all Unused pins will default to INPUT mode on MCU Power-On RESET, except for P130 which is output only. If a peripheral input or output function is utilized, the Port pin will show a RED circle with Exclamation point next to the “In” and “Out” buttons, but the “Unused” button is still selected. LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 9 of 27 Step 2.13 The Interrupt, Serial, A/D and Timer tabs are not used in this example, so we will skip those. Step 2.14 Select the WDT (Watch Dog Timer) tab, and set the WDT as UNUSED. Step 2.15 Select the RTC (Real Time Clock) tab. Set it as USED, enable the Interrupt setting, and set the Constant Period Interrupt function (INTRTC), set at “Once per 1 s” for a once-per-second interrupt, priority at low. Step 2.16 Save this project. Step 2.17 Click the Generate Code button on the toolbar or using the menu File>>Generate Source Code. It should report that the project was created successfully: Step 2.18 Minimize Applilet; you do not have to close it. LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 10 of 27 3 Edit/Build IAR Project This section explains how to open an IAR project, edit/modify the source code for the target application and IAR tools setting for the target board. Procedural Steps Step 3.1 Launch IAR from the desktop icon or Start -> All Programs -> IAR Systems->IAR Embedded Workbench for Renesas RL78 1.20.3 Kickstart-> IAR Embedded Workbench. You should be using V1.20.3, which can be installed from the RL78G14 RDK install disk. Step 3.2 Click File>Open>Workspace and browse to the directory where you created the IAR project using Applilet . (C:\RL78_Projects\MyRL78G14Project) Step 3.3 Click on “MyRL78G14Project.eww” file. This will load the IAR project file generated by Applilet. Step 3.4 If IAR displays a message stating that the project file is an old format, click “Yes” to convert it into the new format. Step 3.5 Your screen should look like this: [...]... a few that still need to be configured 6 Flash Programming and Low Power This section explains how to program the code to the target board using Renesas Flash Programmer (RFP) which allows running in the standalone mode We will also configure the remaining port pins and disable the debugging function to achieve the lowest power numbers for the configuration Using Applilet to Create IAR RL78 Project... until we make a change to the code Notice that there is r_cg_port.c and a r_cg_port_user.c The r_cg_port.c is the setup code for the ports based on selections made using Applilet and the r_cg_port_user.c is a framework file for the user to input their own code Notice a similar structure exists for each peripheral which was setup using Applilet Step 3.7 Open the r_cg_port.c file by double-clicking... Source Code.” Step 5.5 Return to your IAR project and you will see a dialog window like the one below indicating the project has changed Step 5.6 Click “Yes” to allow the new files to be loaded Step 5.7 Now build and connect to the debugger Run the program and note the stop current mA Step 5.8 Change the stop(); command to a halt(); command and compare the currents mA Step... be for Release session (and not Debug, as it has been) You can change it at the pull-down menu just above the project name (this will terminate the debug session) Step 6.2 Select, Project -> Options, and go the Linker settings Step 6.3 Select the “Output” tab and set the Output to have a name that is overridden from the default .a87 file name We use “hex” extension so that RFP (Renesas Flash. .. Programs -> Renesas Electronics Utilities -> Programming Tools -> Renesas Flash Programmer V2.00 -> Renesas Flash Programmer V2.00 Step 6.9 Select Create New Workspace Choose “Basic Mode” Step 6.10 In the “Create a new workspace” window select: Group: RL78/G14 Device Name: R5F104LE Workspace Name: MyRL78G14ProjectRFP Project Name: MyRL78G14ProjectRFP Folder C:\RL78_Projects\MyRL78G14Project Using Applilet... C:\RL78_Projects\MyRL78G14Project\Release\Exe folder Using Applilet to Create IAR RL78 Project Page 24 of 27 LAB PROCEDURE Step 6.13 The Command should be set to Autoprocedure (E.P.) This will perform an Erase, Program and Verify operation in a single step You can also perform these operations one step at a time When you are done, close the program and unplug the USB cable from your board Step 6.14 To... Program the device Step 6.19 Unplug the USB cables and move the jumpers (CN6, CN7, CN8, CN11) to between positions 2-3 (Virtual UART) Step 6.20 Plug in the USB cable and launch the demo app from the desktop You can now shut all programs down and disconnect the board The lab is complete Using Applilet to Create IAR RL78 Project Page 26 of 27 LAB PROCEDURE Using Applilet to Create IAR RL78 Project Page 27... the toolbar and download it this will rebuild the program Step 4.14 Click “Debug-> Go” or press F5 to RUN the program and record the current mA Notice the current is lower, however, it is not nearly as low as we showed in the demo One reason for this is the wasted current from floating pins We will modify the starting configuration to improve this If you look at the schematic for the RPB... Using Applilet to Create IAR RL78 Project Page 22 of 27 LAB PROCEDURE Step 6.11 In the “Communication Interface” window under Tool, select the highest COM port available Click Next and click Next again on the “Setting Power Supply” window Step 6.12 Click Complete in the “Project Settings” window Using Applilet to Create IAR RL78 Project Page 23 of 27 LAB PROCEDURE Now you are ready to program the flash. .. (between Halt and RUN mode, with the LED flashing) The exact mA value is not important, as we will look for a trend You just may want to be consistent in your measurement method; either use the lowest current seen, or the average between lowest/highest readings, or the most frequently seen value Whatever measurement method you use, try to stick with it - to see lowered current drain trends Using Applilet . configuration and settings - Note that this tab allows you to synch the RTC to the PC clock and set alarms and interval interrupts using the RTC b. Memory demo including RAM and Data Flash (EEPROM) . configured. 6 Flash Programming and Low Power This section explains how to program the code to the target board using Renesas Flash Programmer (RFP) which allows running in the standalone mode 5.7 Now build and connect to the debugger. Run the program and note the stop current. ____________________________ mA Step 5.8 Change the __stop(); command to a __halt(); command and compare

Ngày đăng: 22/06/2015, 14:17

Từ khóa liên quan

Mục lục

  • 1 Running the Pre-Programmed Application:

    • Step 1.1 Remove the jumper on CN4 on the Demo Board and place a multimeter configured to measure milliamps across those terminals. Set the multimeter to 20 mA range.

    • Step 1.2 Make sure that jumpers are placed on CN6, CN7, CN8 and CN11, positions 2-3, labeled “Virtual UART”.

    • Step 1.3 To start the demonstrations ensure that the USB stick is connected to the laptop PC via USB cable.

    • Step 1.4 The Demonstrations are controlled by the YRPBRL78G14 GUI which can be started from the “Start -> All Programs -> Renesas Electronics Tools -> YRPBRL78G14 -> YRPBRL78G14-Demo” menu or from the icon on the desktop.

    • Step 1.5 The GUI should now be connected and running. Diode D2 should now be blinking and the graphs and data values on the GUI start page should now be updating with the USB stick parameters as shown below

    • The demo allows you to investigate many of the unique features of the RL78. These include:

    • a. Real Time Clock configuration and settings - Note that this tab allows you to synch the RTC to the PC clock and set alarms and interval interrupts using the RTC

    • Step 1.6 We will concentrate on the Low Power demo. Select this tab.

    • Step 1.7 With the program running in normal 32 MHz mode record the current on the multimeter.

    • Step 1.8 Now select the “Halt” button and record the multimeter current.

    • Step 1.9 Select “Release” for the Halt mode, the current should go back to the original reading.

    • Step 1.10 Select the “Stop” button and record the multimeter current.

    • Step 1.11 Select “Release” for the stop mode, the current should go back to the original reading.

    • 2 Generate IAR Project using Applilet:

      • Step 2.1 Close the demo program and disconnect the USB cable.

      • Step 2.2 Move the four jumpers (CN6, CN7, CN8, CN11) in the middle of the board to position 1-2 which enables the OCD .

      • Step 2.3 Open Applilet by clicking the desktop shortcut or from the menu : Start -> All Programs -> Applilet -> Applilet3 for RL78G14 -> V1.01.01-> Applilet3 for RL78G14 V1.01.01.

      • Step 2.4 From Applilet, select “File>new”. This will open “New Project” window.

      • Step 2.5 Enter the options below to configure project environment for R5F104LE device. The device in the RL78 Stick is the R5F104LE:

      • Step 2.6 Click OK to create the new project

      • Step 2.7 The next screen shows the Applilet Code Generator. You may recognize this from CubeSuite or from previous Applilet versions. Note: If this is not what your screen looks like, then you are using a different version of Applilet.

Tài liệu cùng người dùng

Tài liệu liên quan