Definition of IOCON Mode

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

Definition of IOCON Mode

1,651 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Apr 29 00:57:31 MST 2015
Hey Guys,

On my board i am using a LPC1763 and i connected a switch with external pulldown resistors to Port 1 Pin16-19.
I wanted to read in the value of this pins but i always read high (internal pullup is on by default).
So i used the Chip_IOCON_PinMux to switch of the internal Pullup resistor like this:

Chip_IOCON_PinMux(LPC_IOCON,PORT_1,PIN_19,IOCON_MODE_INACT,FUNC0);


But during debugging i saw that in the PINMODE Register the value is first set correctly and after setting the next pin,
the value is again overwritten (default mode again = pullup).
So i checked the definition of IOCON_MODE_INACT:

#if defined(CHIP_LPC175X_6X)
#define IOCON_MODE_INACT        (0x2 << 2)/*!< No addition pin function */


So the value is 8.
I then changed my code to this:
Chip_IOCON_PinMux(LPC_IOCON,PORT_1,PIN_19,2,IOCON_FUNC0);


The value 2 is written in the manual (page 114)
With the change my code behave like expected (PINMODE Register set correct).

So can anybody explain me the thought behind the definition of IOCON_MODE_INACT? Because it seems to be wrong in my case or had somebody
the same problem?

Regards




Labels (1)
0 Kudos
Reply
3 Replies

1,440 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 29 02:47:50 MST 2015
BTW: This is an old error  (March 2014, LPCOpen 2.07) :((

Solution is described in:

http://www.lpcware.com/content/bugtrackerissue/lpcopen-207-wrong-ioconmodexxx-constants-chiplpc175x6...
0 Kudos
Reply

1,440 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Apr 29 02:15:26 MST 2015
Thanks for the fast reply R2D2
0 Kudos
Reply

1,440 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 29 01:49:13 MST 2015

Quote: Patrick_W
Because it seems to be wrong in my case...



That's wrong in any case 


/**
 * IOCON function and mode selection definitions
 * See the User Manual for specific modes and [color=#f00]functions supoprted by the
 * various LPC11xx devices. Functionality can vary per device.
[/color] */
#define IOCON_FUNC0             0x0/*!< Selects pin function 0 */
#define IOCON_FUNC1             0x1/*!< Selects pin function 1 */
#define IOCON_FUNC2             0x2/*!< Selects pin function 2 */
#define IOCON_FUNC3             0x3/*!< Selects pin function 3 */
#if defined(CHIP_LPC175X_6X)
[color=#f00]#define IOCON_MODE_INACT        (0x2 << 2)/*!< No addition pin function */
#define IOCON_MODE_PULLDOWN     (0x3 << 2)/*!< Selects pull-down function */
#define IOCON_MODE_PULLUP       (0x0 << 2)/*!< Selects pull-up function */
#define IOCON_MODE_REPEATER     (0x1 << 2)/*!< Selects pin repeater function */
[/color]#else


Obviously that's an old copy from LPC11xx and LPC17xx is not 'supoprted', so functionality is varying here 
0 Kudos
Reply