/*******************************************************************/
STATIC INLINE void Chip_GPIO_SetPinOutHigh(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
{
pGPIO->SET[port] = (1 << pin);
}
STATIC INLINE void Chip_GPIO_SetPinOutLow(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
{
pGPIO->CLR[port] = (1 << pin);
}
/*******************************************************************/
int main(void)
{
SystemCoreClockUpdate();
/* Initialise GPIO */
Chip_GPIO_Init(LPC_GPIO_PORT);
/* Set pin output */
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 3, 3);
/* Set pin low */
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 3, 3);
// Enter an infinite loop
while(1)
{
/* Set pin high */
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT, 3, 3);
/* Set pin low */
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 3, 3);
}
}
/*******************************************************************/
Solved! Go to Solution.
Hello Simon Prentice,
Please refer the following community post: The fastest speed of GPIO in the last response of that community post there's the code on how to reach rates up to 102 MHz, while running at 204MHz. The community post refers to the LPC4357 , however this LPC and the LPC4370 are from the same family, so you can use this exact same solution.
Hope it helps!
Victor.
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Simon Prentice,
Please refer the following community post: The fastest speed of GPIO in the last response of that community post there's the code on how to reach rates up to 102 MHz, while running at 204MHz. The community post refers to the LPC4357 , however this LPC and the LPC4370 are from the same family, so you can use this exact same solution.
Hope it helps!
Victor.
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Victor. Thanks. That worked !! Working code for GPIO3_4 (pin on J9 on LPC-Link2).
It makes more sense now than it did a week ago.
One thing, I had to change the example from FUNC_4 to FUNC_0.
I haven't found a reference to what this setting does.
Any ideas?
//P6_5 = GPIO3[4]
Chip_SCU_PinMux(0x6, 5, MD_EHS, FUNC4);
Chip_SCU_PinMuxSet(0x6, 5, (SCU_MODE_INACT | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0));
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 3, 4);LPC_GPIO_PORT->DIR[3] |= 1<<4;
gpset = &LPC_GPIO_PORT->SET[3];
gpclr = &LPC_GPIO_PORT->CLR[3];
gpmask = 1<<4;while (1)
{
*gpset = gpmask;
*gpclr = gpmask;
...
Hi Simon Prentice,
Please reference the user manual https://www.nxp.com/docs/en/user-guide/UM10503.pdf chapter 16: Pin Configuration.
In the example of the community post that I mentioned they used PD_10 with Function 4, in chapter 16 of the user manual you will find the following information.
So, if you want to use pin PD_10 as GPIO you need to select the Function 4. You are using the pin P3_4, in the next image you can see that if you want to use this pin as GPIO you need to select the function 0.
Therefore, you had to make this change if you want to use this pin. Each pin has different functions so it's important to keep this in mind.
Hope it helps!
Victor.
Wow.
So blindingly obvious ... now.
Thank you !!
- How do you configure high-speed IO pins as detailed in the data sheet?
- Does this apply only to certain pins?