Rx671 Code Flash erase not working when changing system clock


I'm changing the System clock to 96MHz and 12 MHz for operations. when i change the system clock, Code Flash erase, write functions are not working. Also, the flash functions return FLASH_SUCCESS even though the erase function is failed. I'm not sure if any other setting has to be done for changing system clock.

My main clock is 12MHz with external oscillator.

PLL Circuit Frequency division is x1.

PLL Circuit Frequency Multiplication is x16

I'm maintaining all clocks (FlashIF, ICLK, peripheral and external bus clock) to 12 MHz.

And based on operations, i want to change to high frequency (ICLK to 96MHz)so i'm using below code.

/* Protect off. */

	    /* Select the clock based upon user's choice. */
//	    clock_source_select2();

	if(HIGH_FREQUENCY == ucClockSpeed){
		SYSTEM.SCKCR.BIT.ICK = 1; // 192/2 =96MHz - Ext clk x N
		SYSTEM.SCKCR.BIT.ICK = 4; // 192/16 =12MHz - Ext clk x N

//	/* Protect on. */

Parents Reply Children
  • hi,

    thanks for prompt response.

    I am working on Rx671 controller. I have checked the registers mentioned but i couldn't find them in the hardware manual. Also the r_flash_config.h doesn't have any of the mentioned information. 

    When i set ICLK to 96MHz/12MHz, flash operations to code are not shown immediately in the memory browser and are taking time to show.

  • Sorry for the misunderstanding, the document I was referencing wasn't for the new RX671 Series, The reference document for RX671 is 'R01AN2184EJ0511' (Flash Module Using Firmware Integration Technology).

    The place you need to seek that is here: (but make sure you've installed the latest FIT Drivers in e2studio)

    As shown in the snippet above, the r_flash_control() function informs the flash driver of the working frequency as above.

    The default is the value which is configured by the smart configurator. but you can simply invoke the r-flash_control(FLASH_CMD_CONFIG_CLOCK, &yourOperatingClock);  each time you change the clock. 

    I hope it helps. keep me posted about the result.  

    Best regards. Hossein

    If this or any other user's response answers your concern, kindly verify the answer. Thank you!

    Renesas Engineering Community Moderator