//============================================================================ // PROJECT : RH850/F1L //============================================================================ // C O P Y R I G H T //============================================================================ // Copyright (c) 2014 by Renesas Electronics GmbH. All rights reserved. // Arcadiastr.10 // D-40472 Duesseldorf // Germany //============================================================================ // // Warranty Disclaimer : // Because the Product(s) is licensed free of charge, there is no warranty of // any kind whatsoever and expressly disclaimed and excluded by Renesas, either // expressed or implied, including but not limited to those for non- // infringement of intellectual property, merchantability and/or fitness for // the particular purpose. Renesas shall not have any obligation to maintain, // service or provide bug fixes for the supplied Product(s) and/or the // Application. // // Each User is solely responsible for determining the appropriateness of // using the Product(s) and assumes all risks associated with its exercise // of rights under this Agreement, including, but not limited to the risks // and costs of program errors, compliance with applicable laws, damage to // or loss of data, programs or equipment, and unavailability or // interruption of operations. // // Limitation of Liability : // In no event shall Renesas be liable to the User for any incidental, // consequential, indirect, or punitive damage (including but not limited to // lost profits) regardless of whether such liability is based on breach of // contract, tort, strict liability, breach of warranties, failure of // essential purpose or otherwise and even if advised of the possibility of // such damages. Renesas shall not be liable for any services or products provided // by third party vendors, developers or consultants identified or referred // to the User by Renesas in conRenesastion with the Product(s) and/or the // Application. // //============================================================================ // Enviroment : Devices : RH850/F1L // Debugger : GHS Multi V6.1.4/2013.1.5 //============================================================================ // // GHS Multi example project for use with RH850/F1L application board // //============================================================================ // This file has been adapted for use with IAR Embedded Workbench 2016/07/05. //============================================================================ // Includes //============================================================================ #include "device.h" //============================================================================ // Defines //============================================================================ //============================================================================ // Prototypes //============================================================================ unsigned char __low_level_init ( int peID ); //============================================================================ // Variables //============================================================================ //============================================================================ // Sub Functions //============================================================================ unsigned char __low_level_init(int peId) { /* Prepare 16MHz MainOsz */ MOSCC=0x06; // Set MainOSC gain (8MHz < MOSC frequency =< 16MHz) MOSCST=0x1FFFF; // Set MainOSC stabilization time to max (8,19 ms) protected_write(PROTCMD0,PROTS0,MOSCE,0x01u); // Trigger Enable (protected write) while ((MOSCS&0x04u) != 0x4u); // Wait for active MainOSC /* Prepare PLL*/ //PLLC=0x00000227u; //8 MHz MainOSC -> 80MHz PLL PLLC=0x00000a27u; //16 MHz MainOSC -> 80MHz PLL protected_write(PROTCMD1,PROTS1,PLLE,0x01u); //enable PLL while((PLLS&0x04u) != 0x04u); //Wait for active PLL /* CPU Clock devider = /1 */ protected_write(PROTCMD1,PROTS1,CKSC_CPUCLKD_CTL,0x01u); while(CKSC_CPUCLKD_ACT!=0x01u); /* PLL -> CPU Clock (80 MHz)*/ protected_write(PROTCMD1,PROTS1,CKSC_CPUCLKS_CTL,0x03u); while(CKSC_CPUCLKS_ACT!=0x03u); /* Set CAN Peripheral Clock (80 MHz) */ protected_write(PROTCMD1,PROTS1,CKSC_ICANS_CTL,0x03u); while(CKSC_ICANS_ACT!=0x03u); /* Set CAN Direct Communication Clock (16 MHz Main Oscillator) */ protected_write(PROTCMD1,PROTS1, CKSC_ICANOSCD_CTL,0x01u); while(CKSC_ICANOSCD_ACT!=0x01u); /* Set LIN Communication Clock (PPLL/2 = 40 MHz) */ protected_write(PROTCMD1,PROTS1, CKSC_ILINS_CTL,0x03u); while(CKSC_ILINS_ACT!=0x03u); /* set all used CAN input buffers enabled */ // PISA2 |= 0x00000001; // PISA3 |= 0x00001000; return (1); }