Rx671 Code Flash erase not working when changing system clock

Hi,

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. */
	    SYSTEM.PRCR.WORD = 0xA50B;

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

	    delay_us(10);
	if(HIGH_FREQUENCY == ucClockSpeed){
		SYSTEM.SCKCR.BIT.ICK = 1; // 192/2 =96MHz - Ext clk x N
		SYSTEM.ROMWT.BYTE = 0x01;
	}
	else
	{
		SYSTEM.SCKCR.BIT.ICK = 4; // 192/16 =12MHz - Ext clk x N
		SYSTEM.ROMWT.BYTE = 0x00;
	}

	delay_us(50);
//	/* Protect on. */
	SYSTEM.PRCR.WORD = 0xA500;

Parents Reply
  • 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
    https://community.renesas.com/
    https://academy.renesas.com/
    en-support.renesas.com/.../

      

Children
No Data