I'm using LPC11A14. The pull-up fail when I configure the main source clock

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I'm using LPC11A14. The pull-up fail when I configure the main source clock

ソリューションへジャンプ
1,185件の閲覧回数
henryfabriciopi
Contributor II

In the LPC11A14, I need to use the on chip pull-up resistor on my GPIO P0_28 as input port. It works good. But it fail when I configure de PLL output as my main clock source.

 

MAINCLKUEN_bit.ENA = 0; // in this point the pull-up is working very good!

MAINCLKSEL_bit.SEL = 3; // in this point the pull-up is working very good!

MAINCLKUEN_bit.ENA = 1; // after execution of this code, the pull-up is no more working.

 

To see the pull-up active, I used a voltmeter in the P0_28 pin. When it is working, I see 2,8V (I expected 3,3V, but with 2,8V is working). But when it is not working, I see 0,6V in this pin.

I used the function InitClock to configure the main clock and the PLL. If I change the divisor (second parameter), the voltage in the pin changes too.

 

For more informations, my complete code is:

 

void main(void)

{

  //GPIO configuration:

  P0DIR_bit.DIR28=0;

  IOCON_P0_28_bit.FUNC=0;

  IOCON_P0_28_bit.MODE=2;

  //Configuration of clock

  InitClock(240MHZ, 5); //<<< PROBLEM INSIDE THIS FUNCTION

  while(true)  {    /* my code */   }

}

 

void InitClock(Int32U pllclock, Int32U ahbdiv) //page. 27

{

  /* Enable XTAL Oscilator */

  PDRUNCFG_bit.XTAL_PD = 0;

  /* Enable Internal RC oscilator */

  PDRUNCFG_bit.IRC_PD = 0;

  /* Select internal RC oscilator for SYS clock source */

  MAINCLKUEN_bit.ENA = 0;

  MAINCLKSEL_bit.SEL = 0;

  MAINCLKUEN_bit.ENA = 1;

  /* Configure System PLL */

  /* Power-down System PLL */

  PDRUNCFG_bit.SYSPLL_PD = 1;

  /* Select XTAL Oscilator for SYS PLL input */

  SYSPLLCLKUEN_bit.ENA = 0;

  SYSPLLCLKSEL_bit.SEL = 0;     //0=IRC,  1=XTAL,  2=CLKIN pin

  SYSPLLCLKUEN_bit.ENA = 1;

  /* Calculate M */

  Int32U m = pllclock/(XTAL_OSC_FREQ*(2*2)) - 1;

  assert(m<32);

  /* Configure PLL frequency */

  SYSPLLCTRL_bit.MSEL = m;

  SYSPLLCTRL_bit.PSEL = 1;

  /* Power-up PLL */

  PDRUNCFG_bit.SYSPLL_PD = 0;

  /* Set System AHB Clock divider */

  SYSAHBCLKDIV_bit.DIV = ahbdiv;

  /* Wait until PLL locks */

  while(!(SYSPLLSTAT_bit.LOCK));

  /* Select System PLL Output for SYS clock source */   //page. 20

  MAINCLKUEN_bit.ENA = 0;

  MAINCLKSEL_bit.SEL = 3;

  MAINCLKUEN_bit.ENA = 1;  //<<< PROBLEM AFTER THIS EXECUTION

}

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
898件の閲覧回数
henryfabriciopi
Contributor II

I found the solution. I changed the microcontroler and now is working.

Thanks for all.

Henry

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
899件の閲覧回数
henryfabriciopi
Contributor II

I found the solution. I changed the microcontroler and now is working.

Thanks for all.

Henry

0 件の賞賛
返信
898件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Henry,

Sorry I don't have a board to try and test.

One question.  Did you enable the SYSAHBCLKCTRL[IOCON] block clock?

Regards,

David

0 件の賞賛
返信
898件の閲覧回数
henryfabriciopi
Contributor II

Yes, I do it in my code:

  /* Enable GPIO Clock */

  SYSAHBCLKCTRL_bit.GPIO = 1;

  /* Enable IOCON Clock */

  SYSAHBCLKCTRL_bit.IOCON = 1;

0 件の賞賛
返信