Hi David,
你说的这个问题,其实不是问题,是芯片的特性,你看下用户手册,PI_29, P0_30 配置为GPIO的时候,连个控制方向是共享的。
这个特性是导致你问题的主要原因。
希望能帮到你。
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
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!!!
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!
-----------------------------------------------------------------------------------------------------------------------