LP4370 Fast GPIO

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,673件の閲覧回数
simon_prentice
Contributor III
LP4370 Fast GPIO
Using the code (pasted below) I see the clock speed is set as 204000000 (204MHz) and I get ~50MHz frequency using Port/Pin 3_3.
This has very few instructions but I will need to add more to bit-bang out a changeable binary pattern.
  - Is there a faster way to set/clear GPIO?
  - I read something about Fast GPIO.  How would one go about setting that?
  - Do I need to go back to assembler
I've hunted around in here but while I see glimpses of a solution I've not found the answer:
/*******************************************************************/
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);
    }
}
/*******************************************************************/
ラベル(1)
1 解決策
2,409件の閲覧回数
victorjimenez
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

5 返答(返信)
2,410件の閲覧回数
victorjimenez
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

2,409件の閲覧回数
simon_prentice
Contributor III

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;
  ...
0 件の賞賛
返信
2,409件の閲覧回数
victorjimenez
NXP TechSupport
NXP TechSupport

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. 

pastedImage_2.png

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. 

pastedImage_4.png

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.

2,409件の閲覧回数
simon_prentice
Contributor III

Wow.

So blindingly obvious ... now.

Thank you !!

2,409件の閲覧回数
simon_prentice
Contributor III

  - How do you configure high-speed IO pins as detailed in the data sheet?

  - Does this apply only to certain pins?

fastio_1.PNG

0 件の賞賛
返信