DRAM_SDCLK0 of i.MX7D is about 270MHz,  it's slow !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DRAM_SDCLK0 of i.MX7D is about 270MHz,  it's slow !

Jump to solution
1,580 Views
tamotsu
Contributor V

Hi.

When CCM_ANALOG_PLL_DDR is set to 0x0000302C, DRAM_SDCLK0 is 132MHz.

So when the TEST_DIV_SELECT bit of CCM_ANALOG_PLL_DDR is set to 0x01 and set to 0x0020302C, DRAM_SDCLK0 is about 270MHz.

It is half of 533Mhz.

DRAM_PHYM_ALT_CLK_ROOT and DRAM_ALT_CLK_ROOT are set to DDR_PLL_DIV2.

Is there a setting to set it to 1/2?

Best regards.

 

0 Kudos
Reply
1 Solution
1,485 Views
joanxie
NXP TechSupport
NXP TechSupport

the driver I showed just tell you the formula, you need read the register CCM_ANALOG_PLL_DDR, CCM_ANALOG_PLL_DDR_NUM and  CCM_ANALOG_PLL_DDR_DENOM, to check if they are correct

View solution in original post

0 Kudos
Reply
6 Replies
1,563 Views
joanxie
NXP TechSupport
NXP TechSupport

Is there a setting to set it to 1/2?

>what do you mean? do you mean you need 533Mhz for DRAM_SDCLK, right?

joanxie_0-1754714689138.png

refer to the figure 5-7, The dedicate DRAM_PLL is used to generate 2x clock at 1066MHz, and use a divider to divide it by 2 to get 533MHz clock with good duty cycle. This 533MHz clock will be
used as the PHY_MCLK. Meanwhile, the 1066MHz clock will also be divided by 2 with
the 1/N divider to get 533MHz as the PHY_CLK, there is a 1/N divider used to divide the PHY clockdown to lower frequency such as 266MHz or 133MHz. The 1/N divider is a 3-bit divider
so N can be 2 to 8. so just set this 1/N to 1/2, you can get 533Mhz

0 Kudos
Reply
1,546 Views
tamotsu
Contributor V

Hi Joanxie.

I understand the diagram you explained.

However, the reference manual does not explain which register FASTMIX is.

Please tell me the register name.

In this case, should TEST_DIV_SELECT of CCM_ANALOG_PLL_DDRn be set to 0x00?

Best regards.

0 Kudos
Reply
1,535 Views
joanxie
NXP TechSupport
NXP TechSupport

I checked the source code as below

https://github.com/nxp-imx/uboot-imx/blob/lf_v2025.04/arch/arm/mach-imx/mx7/clock.c#L162

checked the function decode_pll

case PLL_DDR:
reg = readl(&ccm_anatop->pll_ddr);

if (reg & CCM_ANALOG_PLL_DDR_POWERDOWN_MASK)
return 0;

num = ccm_anatop->pll_ddr_num;
denom = ccm_anatop->pll_ddr_denom;

if (reg & CCM_ANALOG_PLL_DDR_BYPASS_MASK)
return MXC_HCLK;

div_sel = (reg & CCM_ANALOG_PLL_DDR_DIV_SELECT_MASK) >>
CCM_ANALOG_PLL_DDR_DIV_SELECT_SHIFT;

return infreq * (div_sel + num / denom);

so the formula is 24M*(DIV_SELECT+(NUM/DENOM)), div_sel is from CCM_ANALOG_PLL_DDR, mum is from CCM_ANALOG_PLL_DDR_NUM) and denom is from CCM_ANALOG_PLL_DDR_DENOM

0 Kudos
Reply
1,506 Views
tamotsu
Contributor V

Hi Joanxie.

I'm building uboot-2022.01.

The code you showed is get_ddrc_clk(void).

What I found in this code

   reg = readl(&ccm_reg->root[DRAM_CLK_ROOT].target_root;

DRAM_CLK_ROOT, which is not written in "Fugure 5-7.DRAM_Clock Structure", is loaded into reg.

The initial value of DRAM_CLK_ROOT was 0x00000001.

Clearing DRAM_CLK_ROOT made it display correctly.

However, DRAM_SDCKE0 is 270MHz. Is this correct? I checked it with an oscilloscope.

Best regards.

0 Kudos
Reply
1,486 Views
joanxie
NXP TechSupport
NXP TechSupport

the driver I showed just tell you the formula, you need read the register CCM_ANALOG_PLL_DDR, CCM_ANALOG_PLL_DDR_NUM and  CCM_ANALOG_PLL_DDR_DENOM, to check if they are correct

0 Kudos
Reply
1,473 Views
tamotsu
Contributor V

Hi Joanxie.

Thank you.

There is a 1/2 difference between the calculated result and the actual DDR_SDCKE.

I don't know why, but I'll end it here for now.

As the frequency increases, the voltage level of DDR_SDCLKE decreases.

So I think about lowering the frequency.

Best regards.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2148956%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EDRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2148956%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi.%3C%2FP%3E%3CP%3EWhen%20CCM_ANALOG_PLL_DDR%20is%20set%20to%200x0000302C%2C%20DRAM_SDCLK0%20is%20132MHz.%3C%2FP%3E%3CP%3ESo%20when%20the%20TEST_DIV_SELECT%20bit%20of%20CCM_ANALOG_PLL_DDR%20is%20set%20to%200x01%20and%20set%20to%200x0020302C%2C%20DRAM_SDCLK0%20is%20about%20270MHz.%3C%2FP%3E%3CP%3EIt%20is%20half%20of%20533Mhz.%3C%2FP%3E%3CP%3EDRAM_PHYM_ALT_CLK_ROOT%20and%20DRAM_ALT_CLK_ROOT%20are%20set%20to%20DDR_PLL_DIV2.%3C%2FP%3E%3CP%3EIs%20there%20a%20setting%20to%20set%20it%20to%201%2F2%3F%3C%2FP%3E%3CP%3EBest%20regards.%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2152566%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20DRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2152566%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Joanxie.%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3CP%3E%3CSPAN%3EThere%20is%20a%201%2F2%20difference%20between%20the%20calculated%20result%20and%20the%20actual%20DDR_SDCKE.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20don't%20know%20why%2C%20but%20I'll%20end%20it%20here%20for%20now.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAs%20the%20frequency%20increases%2C%20the%20voltage%20level%20of%20DDR_SDCLKE%20decreases.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ESo%20I%20think%20about%20lowering%20the%20frequency.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EBest%20regards.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2151938%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20DRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151938%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ethe%20driver%20I%20showed%20just%20tell%20you%20the%20formula%2C%20you%20need%20read%20the%20register%26nbsp%3B%3CSPAN%3ECCM_ANALOG_PLL_DDR%2C%20CCM_ANALOG_PLL_DDR_NUM%20and%26nbsp%3B%20CCM_ANALOG_PLL_DDR_DENOM%2C%20to%20check%20if%20they%20are%20correct%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2151226%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20DRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151226%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Joanxie.%3C%2FP%3E%3CP%3E%3CSPAN%3EI'm%20building%20uboot-2022.01.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20code%20you%20showed%20is%20get_ddrc_clk(void).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EWhat%20I%20found%20in%20this%20code%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3Breg%20%3D%20readl(%26amp%3Bccm_reg-%26gt%3Broot%5BDRAM_CLK_ROOT%5D.target_root%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EDRAM_CLK_ROOT%2C%20which%20is%20not%20written%20in%20%22Fugure%205-7.DRAM_Clock%20Structure%22%2C%20is%20loaded%20into%20reg.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20initial%20value%20of%20DRAM_CLK_ROOT%20was%200x00000001.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EClearing%20DRAM_CLK_ROOT%20made%20it%20display%20correctly.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EHowever%2C%20DRAM_SDCKE0%20is%20270MHz.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EIs%20this%20correct%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EI%20checked%20it%20with%20an%20oscilloscope.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22%22%3EBest%20regards.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2149942%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20DRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2149942%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20checked%20the%20source%20code%20as%20below%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx%2Fuboot-imx%2Fblob%2Flf_v2025.04%2Farch%2Farm%2Fmach-imx%2Fmx7%2Fclock.c%23L162%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-imx%2Fuboot-imx%2Fblob%2Flf_v2025.04%2Farch%2Farm%2Fmach-imx%2Fmx7%2Fclock.c%23L162%3C%2FA%3E%3C%2FP%3E%0A%3CP%3Echecked%20the%20function%26nbsp%3Bdecode_pll%3C%2FP%3E%0A%3CP%3Ecase%20PLL_DDR%3A%3CBR%20%2F%3Ereg%20%3D%20readl(%26amp%3Bccm_anatop-%26gt%3Bpll_ddr)%3B%3C%2FP%3E%0A%3CP%3Eif%20(reg%20%26amp%3B%20CCM_ANALOG_PLL_DDR_POWERDOWN_MASK)%3CBR%20%2F%3Ereturn%200%3B%3C%2FP%3E%0A%3CP%3Enum%20%3D%20ccm_anatop-%26gt%3Bpll_ddr_num%3B%3CBR%20%2F%3Edenom%20%3D%20ccm_anatop-%26gt%3Bpll_ddr_denom%3B%3C%2FP%3E%0A%3CP%3Eif%20(reg%20%26amp%3B%20CCM_ANALOG_PLL_DDR_BYPASS_MASK)%3CBR%20%2F%3Ereturn%20MXC_HCLK%3B%3C%2FP%3E%0A%3CP%3Ediv_sel%20%3D%20(reg%20%26amp%3B%20CCM_ANALOG_PLL_DDR_DIV_SELECT_MASK)%20%26gt%3B%26gt%3B%3CBR%20%2F%3ECCM_ANALOG_PLL_DDR_DIV_SELECT_SHIFT%3B%3C%2FP%3E%0A%3CP%3Ereturn%20infreq%20*%20(div_sel%20%2B%20num%20%2F%20denom)%3B%3C%2FP%3E%0A%3CP%3Eso%20the%20formula%20is%26nbsp%3B%3CSPAN%3E24M%3C%2FSPAN%3E%3CSPAN%3E*(DIV_SELECT%2B(NUM%2FDENOM))%2C%20div_sel%20is%20from%20%3CSPAN%20class%3D%22test-id__field-value%20slds-form-element__static%20slds-grow%20word-break-ie11%22%3ECCM_ANALOG_PLL_DDR%2C%20mum%20is%20from%26nbsp%3BCCM_ANALOG_PLL_DDR_NUM)%20and%20denom%20is%20from%26nbsp%3BCCM_ANALOG_PLL_DDR_DENOM%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2149549%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20DRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2149549%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Joanxie.%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20understand%20the%20diagram%20you%20explained.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHowever%2C%20the%20reference%20manual%20does%20not%20explain%20which%20register%20FASTMIX%20is.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EPlease%20tell%20me%20the%20register%20name.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIn%20this%20case%2C%20should%20TEST_DIV_SELECT%20of%20CCM_ANALOG_PLL_DDRn%20be%20set%20to%200x00%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EBest%20regards.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2149461%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20DRAM_SDCLK0%20of%20i.MX7D%20is%20about%20270MHz%2C%20%E3%80%80it's%20slow%20!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2149461%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIs%20there%20a%20setting%20to%20set%20it%20to%201%2F2%3F%3C%2FP%3E%0A%3CP%3E%26gt%3Bwhat%20do%20you%20mean%3F%20do%20you%20mean%20you%20need%20533Mhz%20for%26nbsp%3B%3CSPAN%20class%3D%22lia-message-read%22%3EDRAM_SDCLK%2C%20right%3F%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22joanxie_0-1754714689138.png%22%20style%3D%22width%3A%20608px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22joanxie_0-1754714689138.png%22%20style%3D%22width%3A%20608px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F351636i41FF8E6A7C302508%2Fimage-dimensions%2F608x222%3Fv%3Dv2%22%20width%3D%22608%22%20height%3D%22222%22%20role%3D%22button%22%20title%3D%22joanxie_0-1754714689138.png%22%20alt%3D%22joanxie_0-1754714689138.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Erefer%20to%20the%20figure%205-7%2C%20The%20dedicate%20DRAM_PLL%20is%20used%20to%20generate%202x%20clock%20at%201066MHz%2C%20and%20use%20a%20divider%20to%20divide%20it%20by%202%20to%20get%20533MHz%20clock%20with%20good%20duty%20cycle.%20This%20533MHz%20clock%20will%20be%3CBR%20%2F%3Eused%20as%20the%20PHY_MCLK.%20Meanwhile%2C%20the%201066MHz%20clock%20will%20also%20be%20divided%20by%202%20with%3CBR%20%2F%3Ethe%201%2FN%20divider%20to%20get%20533MHz%20as%20the%20PHY_CLK%2C%20there%20is%20a%201%2FN%20divider%20used%20to%20divide%20the%20PHY%20clockdown%20to%20lower%20frequency%20such%20as%20266MHz%20or%20133MHz.%20The%201%2FN%20divider%20is%20a%203-bit%20divider%3CBR%20%2F%3Eso%20N%20can%20be%202%20to%208.%20so%20just%20set%20this%201%2FN%20to%201%2F2%2C%20you%20can%20get%20533Mhz%3C%2FP%3E%3C%2FLINGO-BODY%3E