disable a peripheral clock run error

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

disable a peripheral clock run error

1,058 Views
9218sky
Contributor II

1. disable clock code as follow:

    LPC_CCU2->CLKCCU[CLK_APLL - CLK_CCU2_START].CFG  &= ~1;

2. MCU as LPC1833, source code referrence "lpcopen_2_12_keil_iar_keil_mcb_1857, chip_clock.h" line 226

3. this test project on "lpcopen_2_12_keil_iar_keil_mcb_1857\applications\lpc18xx_43xx\keil_uvision_projects\keil_mcb_1857\periph\periph_systick"

thank.

Labels (1)
0 Kudos
5 Replies

807 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi 9218 sky,

    LPCopen 2.12 is too old, please download the newest lpcopen3_01 from this link:

http://www.nxp.com/assets/downloads/data/en/software/lpcopen_3_01_keil_iar_keil_mcb_1857.zip 

I have run it on my side, after I run over:

LPC_CCU2->CLKCCU[CLK_APLL - CLK_CCU2_START].CFG  &= ~1;

No error happens, it works ok on my side with lpcopen 3_01

pastedImage_2.png

Please take care,  when you debug the chip, please comment:

    __WFI();

Otherwise, the chip will enter in the low power mode, it will lost the power in debug mode.

This is very important.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

807 Views
9218sky
Contributor II

Hi, Kerry

     perform code as follow:

 LPC_CGU->BASE_CLK[CLK_BASE_SDIO]     |= 1; 
 LPC_CGU->BASE_CLK[CLK_BASE_SSP0]     |= 1;
 LPC_CGU->BASE_CLK[CLK_BASE_SSP1]     |= 1;
 LPC_CGU->BASE_CLK[CLK_BASE_UART0]   |= 1;
 LPC_CGU->BASE_CLK[CLK_BASE_UART1]   |= 1;
 LPC_CGU->BASE_CLK[CLK_BASE_UART2]   |= 1;
 LPC_CGU->BASE_CLK[CLK_BASE_UART3]   |= 1;
 LPC_CGU->BASE_CLK[CLK_BASE_APLL]      |= 1;

 

   problom still  existence, and no insert DEBUG, the code run on  lpcopen3_01.

can you test the code,  please.

thanks.

0 Kudos

807 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi 9218 sky,

   Thank you for your updated information.

   You said, no DEBUG, and problem still exist.

    Please give me more detail, what the problem you are meeting? In your top post, I think you are entering some error while debugging. So please tell me how you find the problem, what the problem you are meeting with the BASE clock configuration?

   Waiting for your details.

 


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

807 Views
9218sky
Contributor II


Hi kerry

problem generation from "systick" project main file add some close base-clock code only.
IDE for MDK51X
MCU LPC1833JDB144(I designe small system board)

1. sample pack "lpcopen_3_01_keil_iar_keil_mcb_1857"

2. edit peripheral "lpcopen_3_01_keil_iar_keil_mcb_1857\LPC43xx_18xx\prj_mcb1857\keil\periph_systick"
main file, as follow:

int main(void)
{
LPC_CGU->BASE_CLK[CLK_BASE_SDIO] |= 1; //SN.13
LPC_CGU->BASE_CLK[CLK_BASE_SSP0] |= 1; //SN.14
LPC_CGU->BASE_CLK[CLK_BASE_SSP1] |= 1; //SN.15
LPC_CGU->BASE_CLK[CLK_BASE_UART0] |= 1; //SN.16
LPC_CGU->BASE_CLK[CLK_BASE_UART1] |= 1; //SN.17
LPC_CGU->BASE_CLK[CLK_BASE_UART2] |= 1; //SN.18
LPC_CGU->BASE_CLK[CLK_BASE_UART3] |= 1; //SN.19
SystemCoreClockUpdate();
Board_Init();

/* Enable and setup SysTick Timer at a periodic rate */
SysTick_Config(SystemCoreClock / TICKRATE_HZ);

while (1) {
__WFI();
}
}

3. other file not change!


4. build the project and debug, MDK display as follow:20170509-1.jpg20170509-2.jpg


best regard!

sky9218

0 Kudos

807 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi 9218 sky,

     Thank you for your more details.

     I have tried the MDK systick project on my side, that's really strange for the MDK IDE. In the MDK IDE project debug mode, I have reflect your problem.

     But, I find the blinky project which is the same source code as systick, this project don't have problem.

pastedImage_1.png

    Besides, when I use the IAR project, both blink and systick ,  and in debug mode, no problem happens.

pastedImage_2.png

The code you can used like me:

int main(void)
{
SystemCoreClockUpdate();
Board_Init();
LPC_CGU->BASE_CLK[CLK_BASE_SDIO] |= 1; //SN.13
LPC_CGU->BASE_CLK[CLK_BASE_SSP0] |= 1; //SN.14
LPC_CGU->BASE_CLK[CLK_BASE_SSP1] |= 1; //SN.15
LPC_CGU->BASE_CLK[CLK_BASE_UART0] |= 1; //SN.16
LPC_CGU->BASE_CLK[CLK_BASE_UART1] |= 1; //SN.17
LPC_CGU->BASE_CLK[CLK_BASE_UART2] |= 1; //SN.18
LPC_CGU->BASE_CLK[CLK_BASE_UART3] |= 1; //SN.19    
/*
Chip_Clock_DisableBaseClock(CLK_BASE_SDIO);
Chip_Clock_DisableBaseClock(CLK_BASE_SSP0);
Chip_Clock_DisableBaseClock(CLK_BASE_SSP1);
Chip_Clock_DisableBaseClock(CLK_BASE_UART0);
    Chip_Clock_DisableBaseClock(CLK_BASE_UART1);
    Chip_Clock_DisableBaseClock(CLK_BASE_UART2);
    Chip_Clock_DisableBaseClock(CLK_BASE_UART3);
*/

SysTick_Config(SystemCoreClock / TICKRATE_HZ);

while (1) {
//__WFI();// in debug mode, must comment
}

}

You can try the blink project, or the IAR according project on your side.

Your problem should caused by the systick MDK project creation. Chip function have no problem.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos