Home
Renesas Starter Kit for RSKRL78G1G Tutorial Manual
Contents
1. Grand Century Place 193 Prince Edward Road West Mongkok Kowloon Hong Kong Tel 852 2265 6688 Fax 852 2886 9022 Renesas Electronics Taiwan Co Ltd 13F No 363 Fu Shing North Road Taipei 10543 Taiwan Tel 886 2 8175 9600 Fax 886 2 8175 9670 Renesas Electronics Singapore Pte Ltd 80 Bendemeer Road Unit 06 02 Hyflux Innovation Centre Singapore 339949 Tel 65 6213 0200 Fax 65 6213 0300 Renesas Electronics Malaysia Sdn Bhd Unit 1207 Block B Menara Amcorp Amcorp Trade Centre No 18 Jin Persiaran Barat 46050 Petaling Jaya Selangor Darul Ehsan Malaysia Tel 60 3 7955 9390 Fax 60 3 7955 9510 Renesas Electronics India Pvt Ltd No 777C 100 Feet Road HALII Stage Indiranagar Bangalore India Tel 91 80 67208700 Fax 91 80 67208777 Renesas Electronics Korea Co Ltd 12F 234 Teheran ro Gangnam Gu Seoul 135 080 Korea Tel 82 2 558 3737 Fax 82 2 558 5141 2015 Renesas Electronics Corporation All rights reserved Colophon 4 0 RL78 G1G Group LENESAS Renesas Electronics Corporation R20UT3019EGO100
2. The RSK is not guaranteed to be error free and the entire risk as to the results and performance of the RSK is assumed by the User The RSK is provided by Renesas on an as is basis without warranty of any kind whether express or implied including but not limited to the implied warranties of satisfactory quality fitness for a particular purpose title and non infringement of intellectual property rights with regard to the RSK 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 costs whether the foregoing losses are direct or indirect nor shall Renesas or its affiliates be liable for any other direct or indirect special incidental or consequential damages arising out of or in relation to the use of this RSK even if Renesas or its affiliates have been advised of the possibility of such damages Precautions The following precautions should be observed when operating any RSK product This Renesas Starter Kit is only intended for use in a laboratory environment under ambient temperature and humidity conditions A safe separation distance should be used between this and any sensitive equipment lts use outside the laboratory classroom study area or similar such area invalidates conformity with the protection requirements of the Electromag
3. AS Jan 26 2015 RENES Page 7 of 26 RSKRL78G1G 2 Introduction 2 Introduction This manual is designed to answer in tutorial form the most common questions asked about using a Renesas Starter Kit RSK The tutorials help explain the following e How do compile link download and run a simple program on the RSK e How do build an embedded application e How do I use Renesas tools The project generator will create a tutorial project with three selectable build configurations e DefaultBuild is a project with debug support and optimisation level set to two e Debug is a project built with the debugger support included Optimisation is set to zero e Release is a project with optimised compile options producing code suitable for release in a product Optimisation is set to two Files referred to in this manual are installed using the project generator as you work through the tutorials The tutorial examples in this manual assume that installation procedures described in the RSK Quick Start Guide have been completed Please refer to the Quick Start Guide for details of preparing the configuration These tutorials are designed to show you how to use the RSK and are not intended as a comprehensive introduction to the CS debugger compiler toolchains or the E1 emulator Please refer to the relevant user manuals for more in depth information 2 1 Code Generator Plug in The Code Generator plug in for th
4. Ltd All rights reserved R20UT3019EG0100 Rev 1 00 LENESAS Page 22 of 26 Jan 26 2015 REVISION HISTORY RSKRL78G1G Tutorial Manual Rev Description Jan 26 2015 EN First Edition issued Renesas Starter Kit Manual Tutorial Manual Publication Date Rev 1 00 Jan 26 2015 Published by Renesas Electronics Corporation LENESAS SALES OFFICES Renesas Electronics Corporation 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 Tel 1 905 237 2004 Renesas Electronics Europe Limited Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH U K Tel 44 1628 585 100 Fax 44 1628 585 900 Renesas Electronics Europe GmbH Arcadiastrasse 10 40472 Dusseldorf Germany Tel 49 211 6503 0 Fax 49 211 6503 1327 Renesas Electronics China Co Ltd Room 1709 Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100191 P R China Tel 86 10 8235 1155 Fax 86 10 8235 7679 Renesas Electronics Shanghai Co Ltd Unit 301 Tower A Central Towers 555 Langao Road Putuo District Shanghai P R China 200333 Tel 86 21 2226 0888 Fax 86 21 2226 0999 Renesas Electronics Hong Kong Limited http www renesas com Unit 1601 1611 16 F Tower 2
5. Project a System_Input_Capture he Import Build Options H A Timer PWM Subproject Clean Froject Set Link Order Create Link Directive File The Common Options sheet will open by A CAZEKOR Property default a Verify that the Build Mode eee is set to Debug Click on the Compile Options sheet to view compiler options SSS ee Common Options 4 Compile Options A AssembleOptions Ensure the Add debug information entry is set to 4 CA78KOR Property M k J k Add d LE mi mat on tes Add o bot assembly al id ob ect fileX g2 A e i F War PE both a emb and je file f assem ly an O ject al EE ESO l g 2 f Perform optimization No nq Ensure the Perform optimization entry is set to No nq R20UT3019EG0100 Rev 1 00 LENESAS Page 14 of 26 Jan 26 2015 RSKRL78G1G 4 Building the Tutorial Program 4 Building the Tutorial Program The tutorial project build settings have been pre configured in the toolchain options To view the toolchain options double click on CA78KOR Build Tool from the Project Tree and select the available tabs It is important when changing settings to be aware of the current configuration before modifying the settings Review the options on each of the tabs to be aware of the options available For the purposes of the tutorial leave all options at default When complete the Property panel can be closed by clicking x on the right hand corner of
6. Set PC to Here display lcd 1 uint8 t const RL78 G1G display lcd 3 uint8 t const Tut samp display uint8 t const Connect USB to Pd Ef Tag Jump Shift F12 display uint amp t const Serial config display lcd 6 uint8 t const Baud Rate display lcd 7 uint8 t const Data Bits 8 display lcd 8 uint8 t const Stop Bits l display lcd 9 uint8 t const Parity None Advanced i 7 i a Elo None display lcd 10 uint8 t const Flo None Break Settings i Jump to Function F12 ur a 1 Jump to Disassemble Bookmarks Set up UART1 receive buffer and callback functid HN Save Sour R_UART1 Receive uint8 t const amp g rx char 1 display display c x Enable UART1 operations display s R UART1 Start displav r Set a breakpoint on the f Set up UART1 receive buffer and callback function R_UART1_Start function call by clicking on the Main column Enable UART1 operations Click the Step In button to step into the R_UART1_ Start function Alternatively press F11 R20UT3019EG0100 Rev 1 00 LENESAS Page 19 of 26 Jan 26 2015 RSKRL78G1G The program counter should now move into the R UART1 Receive function definition This function is an API function provided by the Code Generator It sets up the UART interrupt handler code to receive a specified number of bytes into a receive buffer Once the specifie
7. UART1 operations while 10 Read SW3 switch value SW3 VALUE read switch g sw3 switch value x If a new press of SW3 then request a new A D conversion if TRUE g sw3 switch new press g sw3 switch new press FALSE set the flag indicating a user requested A D conversion is red g adc trigger TRUE Wait for user requested A D conversion flag to be set if TR g adc trigger Call the function to perform an A D conversion adc result get adc Display the result on the LCD uintl6 to string lcd buf uint8 t 0 adc result LENESAS Page 20 of 26 RSKRL78G1G 6 Reviewing the Tutorial Program In the Project Tree pane locate the file r_cg Sau_user c and double click to open the source file Scroll down to where r uart1 callback receiveend is defined not where it is being called from Set a breakpoint on the line of static void r uartl callback receiveend void code inside the rij r uart1 callback receiveend function as shown opposite ft Check the character received from the PC fk Start user code Do not edit comment generated here if c g rx char C g rx char Continue to execute the program i by pressing the gt button Set up UART1 receive buffer and callback function again R UARTI Receive uint amp t const amp g rx char 1 fk End user code Do not edit comment generated here In the terminal emulati
8. use in products or systems that may pose a direct threat to human life or bodily injury artificial life support devices or systems surgical implantations etc or may cause serious property damages nuclear reactor control systems military equipment etc You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas 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 6 You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges 7 Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions Further Renesas Electronics products are not subject t
9. 1 Purpose and Target Readers This manual is designed to provide the user with an understanding of how to use the CS IDE to develop and debug software for the RSK platform It is intended for users designing sample code on the RSK platform using the many different incorporated peripheral devices The manual comprises of step by step instructions to load and debug a project in CS but does not intend to be a complete guide to software development on the RSK platform Further details regarding operating the RL78 G1G microcontroller may be found in the Hardware Manual and within the provided sample code Particular attention should be paid to the precautionary notes when using the manual These notes occur within the body of the text at the end of each section and in the Usage Notes section The revision history summarizes the locations of revisions and additions It does not list all revisions Refer to the text of the manual for details The following documents apply to the RL78 G1G 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 User s Manual Describes the technical details of the RSK RSKRL78G1G R20UT3022EG hardware User s Manual Tutorial Manual Provides a guide to setting up RSK RSKRL78G1G R20UT3019EG environment running sample code and Tutorial Manual debugging programs Code Generator Provides a guid
10. Cc T D 0 3 uj LENESAS RL78 G1G Group Renesas Starter Kit Tutorial Manual For CS RENESAS MCU RL78 Family RL78 G1X 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 Renesas Electronics www renesas com Rev 1 00 Jan 2015 Notice 1 Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information 2 Renesas Electronics has used reasonable care in preparing the information included in this document but Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein 3 Renesas Electro
11. FA Microcontroller E a E Code Generator Design Tool A CATBKOR Build Tool jm oj RLZ8 El Serial Debug Tool E Lp File eh System Input Capture Subproject MP ee RSFLLEFA Microcontroller E a Code Generator Design Tool AN CATBKOR Build Tool Ps a RL78 El Serial Debug Tool Gi ae File E E Timer PWM Subproject J RSFLLEFA Microcontroller H p Code Generator Design Tool e CAT8KOR Build Tool hs mj RL78 El Serial Debug Tool aL File R20UT3019EG0100 Rev 1 00 LENESAS Page 10 of 26 Jan 26 2015 RSKRL78G1G 3 Tutorial Project Workspace To change the active project right roject Tree click on the project subproject name BR Async_ serial Property and select Set x as Active Project x 4 File Filename name represents the project name E ae Code Generator Design Too Relative path E A Pin View Absolute path EJ En Peripheral Functions Save with absolute path Code Preview Notes CATBKOR Build Tool ee RL78 El Serial Debug Tool Bi LI File E E Application Subproject BE RSFLLEFA Microcontroller ea a Code Generator Design Tool PORA L a CATBKOR Build Tool po e el RL78 El Serial Debug Tool a a File E UN Async serial Subproject BE RSFLLEFA Microcontroller El Build RSKRL78G1G Tutorial LE Code Generator Design Tool tl Rebuild RSKRL78G1G_Tutorial a NEGIMA LA Clean RSKRL78G1G_Tutorial p
12. RT1 to receive data by passing it a location to store received data and the length of the received data e Enables UART1 operations e Enters an infinite loop which checks to see if SW3 has been pressed or a c or C character has been received from the PC and if so it will request a new A D analog to digital conversion of the potentiometer value The ADC value is then displayed on the LCD and on the PC In addition a modulo 16 counter is maintained that counts the number of requested ADC conversions The count results are displayed on the PC and they are also represented on LEDs 0 to 3 Let us now follow this flow by setting some breakpoints in the code Right click the void R MAIN UserInit void xx Register to Watch1 R UART1 Receive function call A o CC A ASP Function Name main and select Go to Here to execute Description This function implements main functiom xX Cut Ctrl X Arguments None the program Up to this line Return Value None 43 Copy Ctrl C The init_Icd function call A SF Paste CtrleV configures the LCD module and y AAA A Find Ctrl F R MAIN UserInit display lcd will write the text Start user code Do not edit comment generated y sit lo S l Forward to Next Cursor Position between the double quotes to the Initialise the LCD display Y Back to Last Cursor Position display ae o nere x Display test information r display lcd 0 uint8_t const p
13. button Alternatively select Debug from the Menu bar and click on Download e ske e vido ab o ske kj bo ao o ske ee ee ee ee ARRE ee ee vk p le On completion of program Function Name main download the debugger Description This function implements main function and code are ready to be 1 Arguments None Return Value Mone executed The program tali ek ske ada tan tul ir eka aba abo tube sr eka ar e ar sda ika ak be lr sir ike dr ko ir e lo de ke lr er le de e sr ir do e kr sr ir do o RAEE do io lo EEE le e e vp ike sle e le lp ke counter indicator will point void main void to first line of code inside a SEC the main function this IS Start user code Do not edit comment generated here the program s entry point p 9 y p Initialise the LCD display init lcd fk Display test information 01121 display lcd 0 uint t const 011b display lcd 1 uint8 t const 01135 display lcd 3 uint8 t const 01141 display lcd 4 uint amp t const Before proceeding it is necessary to connect to the RSK RL78G1C USB port to a PC using a USB Type A to mini B cable The first time this port is connected to the PC an Installing Device Driver Software pop up will appear and the device driver will be automatically installed Open Device Manager the virtual COM port will appear under Port COM 8 LPT as RSK USB Serial Port COMx where x is a number Open a terminal emulation progra
14. d number of bytes has been received the interrupt handler code calls a callback function as shown later on in this section For full details on how to configure a project using Code Generator refer to the Code Generator Tutorial Manual Press the button to resume program execution The program counter should come to a halt at the R_UART1_Start function Step over the function by clicking the Step Over button Alternatively press F10 E The R_UART1_ Start function enables the UART interrupts The program then proceeds to the main while loop The code inside the loop waits for user input from either the UART or RSK switch SW3 and then performs an A D conversion Locate the function call to display_lcd inside the while loop Set a breakpoint on the display_Icd function call by clicking on the Main column R20UT3019EG0100 Rev 1 00 Jan 26 2015 6 Reviewing the Tutorial Program MD STATUS R UARTI Receive uint8 t const rx buf uintl6o t rx num MD STATUS status MD OK if rx num lU 1 status MD ARGERROR else g uartl rx count OU g uartl rx length rx num gp uartl rx address rx but return status Set up UART1 receive buffer and callback function R UARTI Receive uint8 t const Eg rx char 1 k Enable UART1 operations er R WARTI Start ao 02664 4 4 76 while 1U 1 fe Tand Ch de f x Enable
15. e RL78 G1G has been used to generate the sample code discussed in this document Code Generator for CS is a plug in tool for generating template C source code and project settings for the RL78 G1G When using Code Generator the engineer 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 Code Generator is not enabled by default during CS installation and is not required for this tutorial manual For more information please refer to the Enabling Code Generator section of the Code Generator Tutorial manual Once the engineer has configured the project the Generate Code function is used to generate three code modules for each specific MCU feature selected These code modules are name r_cg_xxx h T og XXX C and r_cg_xxx_user c where xxx is a three letter acronym for the relevant MCU feature for example adc Within these code modules the engineer is then free to add custom code to meet their specific requirement Custom code should be added whenever possible in between the following comment delimiters Start user code for adding Do not edit comment generated here End user code Do not edit comment generated here Code Generator will locate these comment delimiters and preserve any custom code inside the delimiters on subsequent code generation operations This is usef
16. e to code generation and RSKRL78G1G R20UT3021EG Tutorial importing into the CS IDE Code Generator Tutorial Manual Quick Start Guide Provides simple instructions to setup the RSK RSKRL78G1G R20UT3020EG and run the first sample on a single A4 sheet Quick Start Guide Schematics Full detail circuit schematics of the RSK RSKRL78G1G R20UT3017EG Schematics Hardware Manual Provides technical details of the RL78 G1G RL78 G1G Group RO1UHO499EJ microcontroller User s Manual Hardware N List of Abbreviations and Acronyms AB A AA Analog to Digital Converter Application Programming Interface RO mem Reguest SSCS MCU Micro controller Unit Most Significant Bit Personal Computer This is a Digilent Pmod Compatible connector Pmod is registered to Digilent Inc O lt 0 U Pmod PLL Digilent Pmod_Interface_Specification Phase locked Loop Random Access Memory Read Only Memory Renesas Starter Kit Realtime Clock A Serial Array Unit SCI Serial Communications Interface P Serial Peripheral Interface TAU Timer Array Unit F Thin Film Transistor O RSK lt JJ 3 O gt E lt Timer Pulse Unit Universal Asynchronous Receiver Transmitter Universal Serial Bus Watchdog timer UART 02 C 4 V U WO E U Y Table of Contents lt A 7 lal PUIOSE a E E AA AAA ANA AA 7 lia EGAIUTOS suon ka eS e KVE KG MAK Sven Weider apne dementia KS GUS a ade
17. eset after download Download Mode Erase flash ROM before download Automatic change method of event setting position Check reserved area overwriting Debug Information Execute to the specified symbol after CPU Reset Specified symbol Startup start symbol Startup end symbol LENESAS 3 Tutorial Project Workspace 1 Yes Speed prionty No Suspend event Yes Yes _main _ cstart _ cend Page 13 of 26 RSKRL78G1G 3 Tutorial Project Workspace 3 4 Build Configuration The build configurations are selected from the build tool s Property panel The options available are DefaultBuild Debug and Release DefaultBuild and Debug are configured for use with the debugger Release is configured for the final ROM programmable code A common difference between the three builds is the optimisation setting and the addition of debug information With optimisation turned on the debugger may seem to execute code in an unexpected order To assist in debugging it is often helpful to turn optimisation off on the code being debugged Right click on CA78KOR Build Tool from the Project Tree E E Code Generator Design Too hf Pin View o Peripheral Functions Select Property eda Code Preview N CATSKOR Build Tool RL78 El Serial Debug T EM Build Project Lu 61 19 File E Rebuild Project Shift F7 a Application Subproject E E U A inc serial Subproject aA Low Power Mode Subp Set to Default Build Option for
18. m such as HyperTerminal with the settings 19200 8 N 1 on the virtual COM port 5 2 Running the Tutorial Once the program has been downloaded onto the RSK device the program can be executed Click the Go button or press F5 to begin the program from the current program counter position It is recommended that you run through the program once first and then continue to the review section Operating instructions for the program can be found in the file description txt under the Text Files folder in the CS Project Tree R20UT3019EG0100 Rev 1 00 LENESAS Page 17 of 26 Jan 26 2015 RSKRL78G1G 6 Reviewing the Tutorial Program 6 Reviewing the Tutorial Program This section will look at each section of the tutorial code and basic debugging functionality in CS 6 1 Program Initialisation Before the main program can run the microcontroller must be configured Due to the debugger configuration used for the Tutorial project and the rest of the sample projects the user will not be able to step through the hardware initialisation code Please refer to Section 3 3 to change the entry point after programming the microcontroller Specify _R_Systeminit as the function name if viewing of hardware initialisation is desired The initialisation code is executed every time the device is reset via the reset switch or from a power reboot The user is advised not to use the step feature of the debugger to exit the R_S
19. mulator User s Manual R20UT3019EG0100 Rev 1 00 LENESAS Page 21 of 26 Jan 26 2015 RSKRL78G1G 7 Additional Information 7 Additional Information Technical Support For details on how to use CS refer to the manual available on the DVD or from the web site Parts of the sample code provided with the RSKRL78G1G can be reproduced using the Code Generator plug in tool Source files and functions generated by Code Generator are prefixed with r_ and R_ respectively For information about the RL78 G1G Group microcontrollers refer to the RL78 G1G Group Hardware Manual For information about the RL78 assembly language refer to the RL78 Family Software Manual Technical Contact Details Please refer to the contact details listed in section 8 of the Quick Start Guide General information on Renesas microcontrollers can be found on the Renesas website at http www renesas com Trademarks All brand or product names used in this manual are trademarks or registered trademarks of their respective companies or organisations 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 O 2015 Renesas Electronics Europe Limited All rights reserved 2015 Renesas Electronics Corporation All rights reserved O 2015 Renesas System Design Co
20. netic Compatibility Directive and could lead to prosecution The product generates uses and can radiate radio frequency energy and may cause harmful interference to radio communications However there is no guarantee that interference will not occur in a particular installation If this equipment causes harmful interference to radio or television reception which can be determined by turning the equipment off or on you are encouraged to try to correct the interference by one or more of the following measures ensure attached cables do not lie across the equipment reorient the receiving antenna increase the distance between the equipment and the receiver connect the equipment into an outlet on a circuit different from that which the receiver is connected power down the equipment when not in use consult the dealer or an experienced radio TV technician for help NOTE It is recommended that wherever possible shielded interface cables are used The product is potentially susceptible to certain EMC phenomena To mitigate against them it is recommended that the following measures be undertaken e The user is advised that mobile phones should not be used within 10m of the product when in use e The user is advised to take ESD precautions when handling the equipment The Renesas Starter Kit does not represent an ideal reference design for an end product and does not fulfil the regulatory standards for an end product How to Use This Manual
21. nics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others 4 You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration modification copy or otherwise misappropriation of Renesas Electronics product 5 Renesas Electronics products are classified according to the following two quality grades Standard and High Quality The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots etc High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anticrime systems and safety equipment etc Renesas Electronics products are neither intended nor authorized for
22. nine 7 NNO e Uio ae ace ent E E ee Huu 8 2 Code Generator PIU sisas nn akeno dd 8 3 KUIONAIPIOJEGCLIVO KSDAC 6 snr E KE OS 9 OM NM CC ON TEF o aa a TR 9 22 A eee er 9 33 Configuring the Debug Tool El ari ri 12 34 Buld COMMU AU OM tanda 14 As BuUNGING he VUTOn al Progra yA AA A 15 At A TTT TETTE 15 42 Comectina IRE De DUGG CM sss stiches ets leer cece tirade lat I o a 16 43 Saving Project ocn Sci iia 16 5 Downloading and Running the luUtorlal csescesscessscsescesesesnsennsso 17 5 1 Dowhloading the Program C OCC pt id 17 52 A diontuehadas 17 6 REVIEWING Ihe rutonal Program sss E A E 18 Gil Program IMAG ATOM suka kO tia 18 e IU Pigo ile aeren e e E E a A O 19 7 Additional Information us ss seis es ces ses ee be ee ee eee eee 22 LENESAS RSKRL78G1G RENESAS STARTER KIT 1 1 1 Overview Purpose R20UT3019EG0100 Rev 1 00 Jan 26 2015 This RSK is an evaluation tool for Renesas microcontrollers This manual describes how to get the RSK tutorial started and basic debugging operations 1 2 Features This RSK provides an evaluation of the following features The RSK board contains all the circuitry required for microcontroller operation Renesas microcontroller programming User code debugging User circuitry such as switches LEDs and a potentiometer Sample application Sample peripheral device initialisation code R20UT3019EG0100 Rev 1 00
23. o em RL78 El Serial Debug Tool Ga 3 0 File Open Folder with Explorer a LB Low Power Mode Subproject El Windows Explorer Menu han E RSFLIEFA Microcontroller ea a Code Generator Design Tool Add Li e do e CAJ8KOR Build Tool E SetAsync serial as Active Project po bem RL78 El Serial Debug Tool NN 3 0 File Bl Remove from Project Shift Del The File folder contains four E subfolders plus a linker directive file boj This structure is common to all projecis Some of the source files were E e generated by Code Generator which eS r eg ege user e are grouped under the Code o p reg porte Generator folder which itself is listed r eg port _user c under the File folder in the Project Ml co adc c Tree These files are prefixed with Eu E r cg adc user Compile cg to indicate that they were EUS kreon Po E r og sau USET C 3 generated by a code generator All sr E A a Open with Internal Editor other user generated source files are pen e r eg userdefine h fig Open with Selected Application contained in the C Source Files De eee folder To open a file for viewing right click on the file and select Open Alternatively double click on the file R20UT3019EG0100 Rev 1 00 LENESAS Page 11 of 26 Jan 26 2015 RSKRL78G1G 3 Tutorial Project Workspace 3 3 Configuring the Debug Tool E1 Note The Tutorial sample project s settings are pre c
24. o radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or systems manufactured by you 8 Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations 9 Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or u
25. og The user will then be presented with the Start panel Under the Open Sample RSK Project open a new Tutorial project by selecting the RSKRL78G1G Tutorial project template and click on Go as shown below Open Sample R5K Project Select an RSK project template from those installed RSKRAL78G1G_ Tutorial Tutorial Project Tutorial code demonstrating the operation of the debugger R20UT3019EG0100 Rev 1 00 LENESAS Page 9 of 26 Jan 26 2015 RSKRL78G1G CS will present a Create Project dialog box Select all sub projects by clicking on each checkbox and observe the information displayed under the Subproject information heading as you select each project Specify a name and location for the new project and click on Create A dialog box will appear if the location specified does not exist asking to create the folder specified Click OK CS will create and open the project showing the Project Tree as seen in the screenshot opposite RSKRL78G1G_Tutorial Project is the master project and includes the tools to modify build and debug the code The File folder seen in the screenshot belongs to the master project RSKRL78G1G_ Tutorial This folder contains and lists all project source and header files including text files arranged in separate folder structures Folders containing the subprojects indicated by Subproject are listed below the File folder Each subprojec
26. on window press the c button on the keyboard The program will halt at the A o ee a breakpoint in the 1 A E r uarti callback receiveend function as shown opposite Remove the breakpoint by clicking on the breakpoint column Display the result on the LCD uinti to string lcd buf uint8a tj 0 adc result Continue to execute the program NE gt by pressing the fe Increment the adc count and display using the LEDs ef gt if 16 ade count button i The program will halt at the breakpoint in the main while loop Remove the breakpoint by clicking on the breakpoint column Continue to execute the program by pressing the button The program proceeds to display the result of the A D conversion on the LCD and in the terminal window In addition the running count modulo 16 of A D conversions performed is displayed in binary form using LEDs 0 3 on the RSK Adjust the potentiometer and press SW3 on the RSK and an additional A D conversion will be performed e Press the Stop button to halt program execution e This is the extent of the tutorial code For further details regarding hardware configuration please refer to the RL78 Family Software Manual and the RL78 G1G Group Hardware Manual The E1 emulator features advanced logic based event point trigger system and full instruction on its use is outside the scope of this tutorial For further details please refer to the E1 E
27. onfigured This section is intended to familiarise the user with the debug tool settings for when they create their own project The Project Tree will be displayed on the left hand pane of CS This can also be invoked from the menu bar View gt Project Tree If not already active right click on the RSKRL78G1G_Tutorial name and select Set H E Code Preview E A Pin View RSKRL78G1G Tutorial gt A CATEKOR Buil Too das E RL78 El Serial Debug Tool as Active Project 13 File The opposite screen shot indicates that the Debug Tool is El Which is correct for this tutorial 5 0 File R20UT3019EG0100 Rev 1 00 Jan 26 2015 E Tii RSKRL7ZBGI1G Tutorial Project 88 KSFLLEFA Microcontroller a EE Code Generator Design Tool ce Peripheral Functions UR Application Subproject A Async serial Subproject a e lew Prwer Rinde Suihnrniert Lf RSKRL78G1G_Tutorial Project l ME RSFLIEFA Microcontroller E l Code Generator Design Tool fa A Fin View Ey Peripheral Functions gif Code Preview bese A CATBKOR Build EL E RL78 El Serial mn Ta m i ri LR Application 5 Prope rty fal Re ne serial Sooprey BI 74 Low Power Mode Subproject E a System_Input_Capture Subproject aL Timer PWM Subproject LENESAS Build Async serial Rebuild Async serial p Clean Async serial 4 O
28. pen Folder with Explorer Windows Explorer Menu Add Set RSKAL7861G Tutorial as Active Project Save Project and Development Tools as Package RL78 IECUBE RL78 El Serial RL78 E20 Serial RL78 EZ Emulator RL78 Simulator Page 12 of 26 RSKRL78G1G Right click on RL78 E1 Serial Debug Tool Click on Property View the Connect Settings Verify that the settings match the opposite screen shot The project is configured to halt code execution on the first instruction of the main function after programming the microcontroller To specify another function as the entry point View the Download File Settings of the RL78 E1 s property Change the specified symbol to another available function Ensure to prefix the function name with an underscore _ Note Do not specify an interrupt handler as the entry point R20UT3019EG0100 Rev 1 00 Jan 26 2015 ae RL78 El Serial Property 4 Internal ROMRAM Size of internal ROM KBytes Size of internal RAM Bytes Size of DataFlash memory KBytes Clock Main clock frequency MHz Sub clock frequency kHz Monitor clock Connection with Target Board Power target from the emulator MAX 200m4 Supply voltage Flash Security ID Permit flash programming Use wide voltage mode Erase flash ROM when starting ahs e RL78 El Serial Property a Download gt Download files CPU R
29. re all the pins of the connector are correctly inserted in the socket e Connect the E1 Debugger to a free USB port on your computer e Connect the E1 Debugger to the RSK ensuring that it is plugged into the connector marked ET 4 3 Saving Project Settings If you have changed any project settings this is a good ene Edit view Project Build Debug time to save the project Plew E Oper Ctrl 0 e Select File Save Project Open with Encoding Add E Close Project de Close File Ee Sawe Project Ctrl shitt s i i File Edit Wiew Project Build Debus If you make any changes to files in CS and want to preserve these change you can save them by glo Che pen RE e Select File Save All Open with Encoding Add E Clase Project Close File Er ave Project Ctrl shitt s LE save Project As ei save Object Ctrl a Save Object As Sy Object Save Settings Gil Save All Ctrl Shift 4 You can also save files by clicking the Save or Save All buttons from the CS toolbar In addition files can be saved using the keyboard shortcut Ctrl S R20UT3019EG0100 Rev 1 00 LENESAS Page 16 of 26 Jan 26 2015 RSKRL78G1G 5 Downloading and Running the Tutorial 5 Downloading and Running the Tutorial 5 1 Downloading the Program Code Now that the code has been built in CS it needs to be downloaded to the RSK Click on the program download
30. se by the military including but not limited to the development of weapons of mass destruction When exporting the Renesas Electronics products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations 10 It is the responsibility of the buyer or distributor of Renesas Electronics products who distributes disposes of or otherwise places the product with a third party to notify such third party in advance of the contents and conditions set forth in this document Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products 11 This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics 12 Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics 2012 4 Disclaimer By using this Renesas Starter Kit RSK the user accepts the following terms
31. t folder when expanded reveals an identical tools and folder structure to that of the master project RSKRLZ8GIG Tutorial By default the RSKRL78G1G Tutorial project is set as the active project indicated by the line under the project name Note Code Generator Design Tool node is shown in the Project Tree and indicates an optional plug in has been enabled previously 3 Tutorial Project Workspace Create Project al Subprojects to Add Y Application V Async_serial Demonstrates the use of the TAU to Y Low Power Mode produce a PWM Pulse Width Modulation Y System Input Capture output 7 Timer_PWM Name RSKRL7Z8GIG Tutorial Location C Users venesas Documents Y Make the project folder 3 F Code Generator Design Too 2 E A Pin View H ul Peripheral Functions i a Code Preview ly CATBKOR Build Tool jm RL78 El Serial Debug Tool E Be Startup sU Code Generator Be r Ik dr H Text Files E l C Source Files 2 EL Dependencies els Application Subproject E JE RSFLIEFA Microcontroller El a E Code Generator Design Tool ae LA CATBKOR Build Tool a RL78 El Serial Debug Tool ee a File E al Async serial Subproject das 3 RSFLLEFA Microcontroller H EE Code Generator Design Tool i Ma CATBKOR Build Tool ak jm oj RL78 El Serial Debug Tool E E File FAL Low Power Mode Subproject JE RSFLIE
32. the Property window 4 1 Building the Code There is a choice of three shortcuts available for building the project e Selecting the Build Project toolbar button will build all projects listed in the project tree e Pressing F7 This is equivalent to pressing the Build Project toolbar button e Selecting the Rebuild Project toolbar button will rebuild all project files e Selecting the Build amp Download toolbar button will only build the active project and download the code to the target device after a successful build e Pressing F6 This is equivalent to pressing the Build amp Download toolbar button Build the project now by pressing F7 or pressing one of the build icons as shown above During the build each stage will be reported in the Output Window The build will complete with an indication of any errors and warnings encountered during the build R20UT3019EG0100 Rev 1 00 LENESAS Page 15 of 26 Jan 26 2015 RSKRL78G1G 4 Building the Tutorial Program 4 2 Connecting the Debugger For this tutorial the E1 debugger will provide power to the RSK no external power supply is required The Quick Start Guide provided with the Renesas Starter Kit board gives detailed instructions on how to connect the E1 to the host computer The following assumes that the steps in the Quick Start Guide have been followed and the E1 drivers have been installed e Fit the LCD Module to the RSK board Ensu
33. ul if after adding custom code the engineer needs to re visit Code Generator to change any MCU operating parameters R20UT3019EG0100 Rev 1 00 AS Page 8 of 26 Jan 26 2015 RENES RSKRL78G1G 3 Tutorial Project Workspace 3 Tutorial Project Workspace 3 1 Introduction CS is an integrated development tool that allows the user to write compile program and debug a software project on the RX 78K RL and V850 family of Renesas microcontrollers CS will have been installed during the installation of the software support for the Renesas Starter Kit product This manual will describe the stages required to create and debug the supplied tutorial project 3 2 Starting CS To use the program start CS Windows 7 amp Vista Start Menu Start Menu gt All Programs gt Renesas Electronics CS CS for CA CX 78K RL78 V850 Windows 8 From Apps View O click CS for CA CX 78K RL78 V850 icon The first time CS is started the One Point Advice dialog box will be shown One Point Advice Do you know Can e2 studio project be opened e studio project can be loaded in this product Select Project Open Project and select a project file repce of the e studio Displayed contents random 027 050 lt Back Neo E Do not show this dialog box at startup Help The One Point Advice dialog box provides some useful tips when using CS Press OK to skip the advice and close the One Point Advice dial
34. ysteminit function Ensuring the Tutorial program has been downloaded onto the RL78G1G press the CPU Reset button on the Debug Toolbar Ha From the Menu bar select 16 void main void View gt Disassemble gt ie Disassemble1 Alternatively ns use the Display Disassemble button to open and view the source and disassembly To make the Display Disassemble button available on the toolbar right click on the toolbar and select View Panels R MAIN UserInit c161200 CALL 1 R MAIN UserInit ft Start user code Do not edit comment generated here Initialise the LCD display init lcd ft Display test information display lcd 0 uint8 t const Renesas MOVU E 0 AX 0E09H PUSH AX CLRW AX CALL POP A uint8 t const MOVU AX PUSH ONEW Revert back to the source by clicking on the file containing the function pointed to by the program counter 00 indicator Alternatively right click in co POP the Disassemble1 window and click Jump to Source display lcd 3 uint8 t const Tutorial sample R20UT3019EG0100 Rev 1 00 LENESAS Page 18 of 26 Jan 26 2015 RSKRL78G1G 6 Reviewing the Tutorial Program 6 2 Main Functions This section will look at the program code called from with the main function and how it works The program code performs the following tasks e Initialises the LCD display e Writes some information to the display e Sets up UA
Download Pdf Manuals
Related Search
Related Contents
Solution Ultima Series Operators Manual Rettifica specifica Tecnica Lotto 3 (File Pdf 724 Kb) Samsung WB2000 Bruksanvisning VPCW21 Series Waterpik® Water Flosser Model WP-450 Unity Pro - Schneider Electric Sweex 2.5" HDD Enclosure Cherry Red USB USB powered Samsung SCX-4600 Mono Multifunction TAA Products TAASCR smart card reader MEA_GRL_550.TR_001 (LOTE 2)_R0 _ Copyright © All rights reserved.
Failed to retrieve file