LPC1778FBD208的P0.29和P0.30的问题

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

LPC1778FBD208的P0.29和P0.30的问题

1,447 Views
davidfan
Contributor I

LPC1778FBD208的GPIO P0.29,P0.30必须同时设置为输出模式,输出高、低电平正常。如果一个设置为输出模式,一个设置为输入模式,那么设置为输出模式的那个IO一直输出低电平,没法输出高电平。这是为什么呢?

Labels (1)
0 Kudos
Reply
4 Replies

1,111 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David,

   你说的这个问题,其实不是问题,是芯片的特性,你看下用户手册,PI_29, P0_30 配置为GPIO的时候,连个控制方向是共享的。

pastedImage_1.png

这个特性是导致你问题的主要原因。

希望能帮到你。


Have a great day,
Kerry

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

0 Kudos
Reply

1,112 Views
911138316
Contributor I

hi,

I want to use P0.30 as an ordinary Port(output). I also noticed P0.29 P0.30 need to set it in the same direction. I do this , but the output is wrong.

int main (void)

{   

  SystemInit();

  LPC_GPIO0->SET |= (3ul << 29);

  LPC_GPIO0->DIR |= (3ul << 29); 

  LPC_GPIO0->SET |= (3ul << 29);

while(1)

{ ; }

}

Output is always low level!!!

why????

What should I am going to do?

please!!!

0 Kudos
Reply

1,112 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Customer,

   About this question, I have replied you in your case like this:

Thank you for your interest in NXP LPC product, I would like to provide service for you.From your code, it seems you didn't open the GPIO power, please add this code:
static uint32_t * PIN_GetPointer(uint8_t portnum, uint8_t pinnum){ uint32_t *pPIN = NULL; pPIN = (uint32_t *)(LPC_IOCON_BASE + ((portnum * 32 + pinnum)*sizeof(uint32_t))); return pPIN;}PINSEL_RET_CODE PINSEL_ConfigPin ( uint8_t portnum, uint8_t pinnum, uint8_t funcnum){ uint32_t *pPIN = NULL; 
pPIN = PIN_GetPointer(portnum, pinnum); *pPIN &= ~IOCON_FUNC_MASK;//Clear function bits *pPIN |= funcnum & IOCON_FUNC_MASK;
 return PINSEL_RET_OK;
}int main (void) 
 { 
   SystemInit(); 
          LPC_SC->PCONP |= ((uint32_t)(1<<15));// enable the GPIO power
          PINSEL_ConfigPin(0, 29, 0); 
          PINSEL_ConfigPin(0, 30, 0);
   LPC_GPIO0->DIR |= (3ul << 29); 
          LPC_GPIO0->SET |= (3ul << 29); 
 while(1) 
 { 
 ; 
 } 
} Then try it again.
If you still have question about it, please kindly let me know.
I also send you the GPIO example code, which may useful to you.Besides, check your hardware, you need to make sure these two pin didn't connect to other component or ground.‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
 

Do you test it and refer to the attached GPIO code ?

If you have any updated question about it, please kindly let me know.


Have a great day,
Kerry

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

0 Kudos
Reply

1,112 Views
911138316
Contributor I

Hi:

thinks!

I get it.

0 Kudos
Reply