LPCOpen Chip_GPIO_Init() input parameter definition?

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

LPCOpen Chip_GPIO_Init() input parameter definition?

1,128 Views
johnwhitmore
Contributor III

- I'm writing code using MCUXpresso IDE for a LPC1788 -

Has anybody used LPCOpen's Chip_GPIO_Init() function before? I started looking at the documentation at [1] and followed the links to the input parameter to that function [2] and [3]. So the definition of the structure given in the documentation [3] includes the data fields:

DATA

RESERVED

DIR

IS

IBE

IEV

IE

RIS

MIS

IC

However when I define the structure in C code "LPC_GPIO_T gpio;" and type "gpio." the IDE's autocompletion gives me the options:

CLR

DIR

MASK

RESERVED0

SET

There is a discrepancy between the documentation for LPCOpen and the IDE's interpretation, and I wonder which is correct. The documentation isn't clear on the function Chip_GPIO_Init() and what should be passed in. It appears to be a structure but perhaps I just call it with the address 0x20098000 which appears to be the base address of GPIO registers in the LPC1788, as in "Chip_GPIO_Init((LPC_GPIO_T *)0x20098000);"

Can anybody confirm the correct calling convention and if there's better documentation out there somewhere please let me know.

[1] LPCOpen Platform: CHIP: LPC17xx/40xx GPIO driver 

[2] LPCOpen Platform: CHIP: LPC11xx Peripheral addresses and register set declarations 

[3] LPCOpen Platform: IP_GPIO_003_T Struct Reference 

Tags (2)
0 Kudos
Reply
3 Replies

703 Views
johnwhitmore
Contributor III

I should have added that the documentation section which I've found on the website [1] doesn't contain a User Guide for MCUXpresso but a very short (Not documentation) Quick Start Guide rather then any real User Guide. There is a guide for Porting and for both Keil and IAR but I'm not using either of those. That documentation was created in Feb 2013 so is LPCOpen old unsupported code at this stage?

[1] LPCOpen Software for LPC17XX|NXP 

0 Kudos
Reply

703 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John Whitmore,

Thank you for your interest in NXP Semiconductor products and 
for the opportunity to serve you.
I think this "bug" has been fixed in the Rev 2.x LPCOpen library and go for get it.

typedef struct {                    /* GPIO_PORT Structure */
     __IO uint32_t DIR;               /*!< Offset 0x0000: GPIO Port Direction control register */
     uint32_t RESERVED0[3];
     __IO uint32_t MASK;               /*!< Offset 0x0010: GPIO Mask register */
     __IO uint32_t PIN;               /*!< Offset 0x0014: Pin value register using FIOMASK */
     __IO uint32_t SET;               /*!< Offset 0x0018: Output Set register using FIOMASK */
     __O  uint32_t CLR;               /*!< Offset 0x001C: Output Clear register using FIOMASK */
} LPC_GPIO_T;‍‍‍‍‍‍‍‍

Have a great day,
TIC

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

703 Views
johnwhitmore
Contributor III

Thanks for that response jeremyzhou. I should not have searched on line for documentation on LPCOpen as that threw up old, out of date documents, which I was reading. Sorry about that and thanks for your help. The code is the documentation I guess.

0 Kudos
Reply