LPC4330 - How to Access the High Speed GPIO

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC4330 - How to Access the High Speed GPIO

1,929 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by arshs on Fri Sep 28 09:53:35 MST 2012
Hi:

I'm using the following functions to SET /CLR a GPIO pin (on the LPC4330 NGX Xplorer Board):

void GPIO_SetValue(uint8_t portNum, uint32_t bitValue)
{
LPC_GPIO_PORT->SET[portNum] = bitValue;
}

void GPIO_ClearValue(uint8_t portNum, uint32_t bitValue)
{
LPC_GPIO_PORT->CLR[portNum] = bitValue;
}


while (1)
{ GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT)); GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));
}

The Core is running at 180MHz, but the GPIO switching rate is just 5MHz.

Is there something else that need to be enabled in the LPC4330 to switch the GPIO pins at a higher rate?

Can the AHB bus frequency be increased?

I noticed that the GPIO registers are NOT mapped to the same bit-banding memory locations as the LPC1700 family.

Are the LPC4300 GPIO really High Speed?

What is the max switching frequency that can be obtained?

Thanks for your response.

Alex
标签 (1)
0 项奖励
回复
5 回复数

1,682 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Jg on Tue Oct 23 14:56:00 MST 2012
You can use the SGPIO, it can run at the full speed. And thanks to the double buffering this speed can easily be achieved for longer bit sequences.
0 项奖励
回复

1,682 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pacman on Tue Oct 23 10:59:01 MST 2012
@Alex: Usually, I would write the value directly to the port, rather than using SET/CLR, because I'd output a bytestream instead of single bits.

I know this is not my thread, but rocketdawg, you gave me valuable information. Thank you! :)
Now I know that I can go crazy on the GPIO pins. =)

@rocketdawg: There will always be something you can use a quick toggle for, even though it doesn't seem to make sense at first. Someone (Igor Češko) made a bit-bang ethernet on an 8-bit 20MHz chip's I/O pins by toggling them alone. Anyway, toggling a LED at that speed.. *that* would make no sense. ;)
0 项奖励
回复

1,682 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Tue Oct 23 09:20:18 MST 2012
The GPIO is clocked at CLK_M4_GPIO which can be clocked at 204Mhz.
And if your application could execute no code and never have any AHB bus arbitration, and do nothing useful other than toggle a pin, then theoretically it does not matter.  It is not realistic.

Certainly not with the code that was posted.
The fastest way MAY be to use the peripheral bit band alias to perform a write to a bit in the GPIO SET register.  And any AHB slave or DMA may take the bus.  Your milage may vary.
0 项奖励
回复

1,682 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pacman on Wed Oct 17 15:43:46 MST 2012
That sounds good to me. :)
You may be able to get even better results.

According to my understanding, the 43xx should be able to toggle GPIO-pins at the clock frequency / 4, which would mean 204/4 = 51MHz.
(Can this be confirmed by NXP, please ?)
0 项奖励
回复

1,682 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by arshs on Thu Oct 04 13:30:10 MST 2012
Hi:

I double checked the actual Core Frequency, and noticed that it was running at 72MHz, instead of 180MHz.

When fixing the PLL1 settings to run at 204MHz, the GPIO does indeed change at a high speed. I managed to toggle the pin every 29ns (204MHZ / 6 clock cycles to execute the instructions)

Regards,

Alex
0 项奖励
回复