fsl_iap Erase/Program checks clock in 25.6

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

fsl_iap Erase/Program checks clock in 25.6

328 Views
Folkert
Contributor I

With an update of the fsl-library to 25.6, I noticed that in fsl_iap.c the erase and program functions have a check on the clock being higher than 100MHz. 

Here the kCLOCK_CoreSysClk is checked, which is the main_clk in fig 4 in UM11126, page 43. I think this should be checked against kCLOCK_BusClk, which is the actual clock to the CPU.

Kind regards,

Folkert

Labels (1)
0 Kudos
Reply
3 Replies

287 Views
Folkert
Contributor I

Dear @Harry_Zhang 

Thank you for your answer.

We use the LPC55S69 with the clock connected to PLL0, which runs at 150MHz and normally, we have kCLOCK_DivAhbClk set to 1. When we want to write to flash, we set kCLOCK_DivAhbClk to 2 to have the CPU running at 75MHz, which is functional. 
In this case, the fsl_iap functions should check on kCLOCK_BusClk, because then it differs from kCLOCK_CoreSysClk.

Kind regards,

Folkert

 

 

0 Kudos
Reply

272 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Folkert 

Yes, you are right.

When we set kCLOCK_DivAhbClk  to 2,

 the fsl_iap functions should check on kCLOCK_BusClk.

BR

Harry

0 Kudos
Reply

298 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Folkert 

I checked this demo.

Harry_Zhang_0-1758622918461.png

I found that 

CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false);

So the  kCLOCK_BusClk is the same with the  kCLOCK_CoreSysClk.

And i print them. they are same.

You can tested it.

BR

Harry

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2173433%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Efsl_iap%20Erase%2FProgram%20checks%20clock%20in%2025.6%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2173433%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWith%20an%20update%20of%20the%20fsl-library%20to%2025.6%2C%20I%20noticed%20that%20in%20fsl_iap.c%20the%20erase%20and%20program%20functions%20have%20a%20check%20on%20the%20clock%20being%20higher%20than%20100MHz.%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20the%20kCLOCK_CoreSysClk%20is%20checked%2C%20which%20is%20the%20main_clk%20in%20fig%204%20in%20UM11126%2C%20page%2043.%20I%20think%20this%20should%20be%20checked%20against%20kCLOCK_BusClk%2C%20which%20is%20the%20actual%20clock%20to%20the%20CPU.%3C%2FP%3E%3CP%3EKind%20regards%2C%3C%2FP%3E%3CP%3EFolkert%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2173433%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ELPC55xx%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2175513%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20fsl_iap%20Erase%2FProgram%20checks%20clock%20in%2025.6%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2175513%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232865%22%20target%3D%22_blank%22%3E%40Folkert%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20you%20are%20right.%3C%2FP%3E%0A%3CP%3EWhen%20we%20set%20kCLOCK_DivAhbClk%26nbsp%3B%20to%202%2C%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3Bthe%20fsl_iap%20functions%20should%20check%20on%20kCLOCK_BusClk.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EHarry%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2174929%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20fsl_iap%20Erase%2FProgram%20checks%20clock%20in%2025.6%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2174929%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDear%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F229957%22%20target%3D%22_blank%22%3E%40Harry_Zhang%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20answer.%3C%2FP%3E%3CP%3EWe%20use%20the%20LPC55S69%20with%20the%20clock%20connected%20to%20PLL0%2C%20which%20runs%20at%20150MHz%20and%20normally%2C%20we%20have%20%3CSPAN%3EkCLOCK_DivAhbClk%3C%2FSPAN%3E%26nbsp%3Bset%20to%201.%20When%20we%20want%20to%20write%20to%20flash%2C%20we%20set%26nbsp%3B%3CSPAN%3EkCLOCK_DivAhbClk%3C%2FSPAN%3E%26nbsp%3Bto%202%20to%20have%20the%20CPU%20running%20at%2075MHz%2C%20which%20is%20functional.%26nbsp%3B%3CBR%20%2F%3EIn%20this%20case%2C%20the%20fsl_iap%20functions%20should%20check%20on%20kCLOCK_BusClk%2C%20because%20then%20it%20differs%20from%26nbsp%3BkCLOCK_CoreSysClk.%3C%2FP%3E%3CP%3EKind%20regards%2C%3C%2FP%3E%3CP%3EFolkert%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2174243%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20fsl_iap%20Erase%2FProgram%20checks%20clock%20in%2025.6%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2174243%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232865%22%20target%3D%22_blank%22%3E%40Folkert%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20checked%20this%20demo.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Harry_Zhang_0-1758622918461.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Harry_Zhang_0-1758622918461.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358160i077741BFAAFCBDAC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Harry_Zhang_0-1758622918461.png%22%20alt%3D%22Harry_Zhang_0-1758622918461.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI%20found%20that%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3ECLOCK_SetClkDiv(kCLOCK_DivAhbClk%2C%201U%2C%20false)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ESo%20the%26nbsp%3B%20kCLOCK_BusClk%20is%20the%20same%20with%20the%26nbsp%3B%20kCLOCK_CoreSysClk.%3C%2FP%3E%0A%3CP%3EAnd%20i%20print%20them.%20they%20are%20same.%3C%2FP%3E%0A%3CP%3EYou%20can%20tested%20it.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%3C%2FLINGO-BODY%3E