LPC_GPIO_TypeDef

18 Dec 2010

Hi,

When I compile a cpp file addressing a byte port, for example FIOSET0, using the mbed.h header, I get the following error mssage "Class "LPC_GPIO_TypeDef" has no member "FIOSET0" (E135)" in file "/main.cpp". Using only the lpc17xx.h header, my file compiles without any error message. But there is a side effect; port bits 7..0 are reversed on the mbed DIP pins, that is, bit 7 becomes bit 0, bit 6 becomes bit 1, etc.

To what extend does mbed support the lpc17xx.h header, and to what extend does mbed.h coexist with lpc17xx.h?

Best regards
Henrik Larsen

18 Dec 2010

You're almost right. Here's a simple example. Notice that you have to specify each port LPC_GPIO0, LPC_GPIO1 depending on what you are using.

 

#include "mbed.h"

int main() {

int dir = 0;
LPC_GPIO0->FIODIR = dir;
LPC_GPIO0->FIODIR = 0x07800000 | dir;	//0b0000|0111|1000|0000|0000|0000|0000
LPC_GPIO0->FIOMASK = 0xF87FFFFF;		//0b1111|1000|0111|1111|1111|1111|1111

while(1){
LPC_GPIO0->FIOSET = 0x07800000;
LPC_GPIO0->FIOCLR = 0x07800000;
}
}

 

 

04 Jan 2011

Hi Dimiter Kentri,

The reason that I can't address byte entities on a GPIO port using "mbed.h" must be due to the fact
that byte entities are not defined in the LPC17xx.h header version V1.04 used in mbed.

In LPC17xx.h version V1.09 byte units are, however, defined.

Henrik Larsen 

typedef struct 			// V1.04
{ 
   __IO uint32_t FIODIR; 
        uint32_t RESERVED0[3]; 
   __IO uint32_t FIOMASK; 
   __IO uint32_t FIOPIN; 
   __IO uint32_t FIOSET; 
   __O  uint32_t FIOCLR; 
} LPC_GPIO_TypeDef;

 

typedef struct   // V1.09
{
  union {
    __IO uint32_t FIODIR;
    struct {
      __IO uint16_t FIODIRL;
      __IO uint16_t FIODIRH;
    };
    struct {
      __IO uint8_t  FIODIR0;
      __IO uint8_t  FIODIR1;
      __IO uint8_t  FIODIR2;
      __IO uint8_t  FIODIR3;
    };
  };
  uint32_t RESERVED0[3];
  union {
    __IO uint32_t FIOMASK;
    struct {
      __IO uint16_t FIOMASKL;
      __IO uint16_t FIOMASKH;
    };
    struct {
      __IO uint8_t  FIOMASK0;
      __IO uint8_t  FIOMASK1;
      __IO uint8_t  FIOMASK2;
      __IO uint8_t  FIOMASK3;
    };
  };
  union {
    __IO uint32_t FIOPIN;
    struct {
      __IO uint16_t FIOPINL;
      __IO uint16_t FIOPINH;
    };
    struct {
      __IO uint8_t  FIOPIN0;
      __IO uint8_t  FIOPIN1;
      __IO uint8_t  FIOPIN2;
      __IO uint8_t  FIOPIN3;
    };
  };
  union {
    __IO uint32_t FIOSET;
    struct {
      __IO uint16_t FIOSETL;
      __IO uint16_t FIOSETH;
    };
    struct {
      __IO uint8_t  FIOSET0;
      __IO uint8_t  FIOSET1;
      __IO uint8_t  FIOSET2;
      __IO uint8_t  FIOSET3;
    };
  };
  union {
    __O  uint32_t FIOCLR;
    struct {
      __O  uint16_t FIOCLRL;
      __O  uint16_t FIOCLRH;
    };
    struct {
      __O  uint8_t  FIOCLR0;
      __O  uint8_t  FIOCLR1;
      __O  uint8_t  FIOCLR2;
      __O  uint8_t  FIOCLR3;
    };
  };
} LPC_GPIO_TypeDef;
-deleted-
14 Mar 2011

Will the mbed team be upgraded the LPC17XX.h header file to V1.09, or is it already done, or is not happening?

14 Mar 2011

Hi David,

Yes, we'll update it to v1.09 soon. We've just updated to CMSIS 2.0 on a beta version of the libraries a couple of days ago, so will merge in the newest LPC17xx.h next. We wont push it mainline until we are happy with this and other changes, but will post when it is available as a beta.

Thanks for the reminder!

Simon

15 Mar 2011

Hi David,

See http://mbed.org/forum/bugs-suggestions/topic/1980/ if you would like to test this update, now on beta.

Simon