LPC82X PIO0_4 as output

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

LPC82X PIO0_4 as output

Jump to solution
2,798 Views
kurtmirdell
Contributor II

I am trying to use PIO0_4 as output on a LPC824, but I am missing something. There are no problems with other pins.

There is a statement in the datasheet rev 1.3 on page 10 - note 3 in Table 3, pin description - "The wake-up pin function can be disabled and the pin can be used for other purposes, if the WKT low-power oscillator is enabled for waking up the part from Deep power-down mode."

ADC11 is switched off in PINENABLE

I have tried to put value 2 in DPDCTRL, but that doesn't make any difference. 

Pin seems to be input with pullup.

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
2,613 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kurt Mirdell,

Thank you for your reply.
I've used the lpcxpresso804_led_blinky demo which is from the SDK library as the template, and do a bit modification to make the PIO0_4  toggles per 1 second.
It works well, please check the attachment and give a try.

新建文件1.bmp

Fig 1

WeChat Image_20190329150958.jpg

Fig 2


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
12 Replies
2,613 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kurt Mirdell ,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
I think you forgot to configure the MODE bits in the PIO0_4 register.

pastedImage_2.png
Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,613 Views
kurtmirdell
Contributor II

I want to use the pin as output. The pin is now input with pull-up as I described in the question. Your suggestion is the default for the pin.

0 Kudos
Reply
2,613 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kurt Mirdell,

Thanks for your reply.
Actually, you should configure the MODE bits of PIO_4 to be 0x00 instead of the 0x02.
Please give a try.
Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,613 Views
kurtmirdell
Contributor II

I have tested your suggestion, but it doesn't change anything. PIO0_4 is not working as output regardless of pull-up selections.

According to my understanding, you enable the output in the direction registers (DIR/DIRSET/DIRCLR/DIRNOT). The pull-up enabling does not affect output enabling, but it is a little stupid to have pull-ups enabled on an output.

What I am looking for is the secret, not so well documented thing that you need to do to use PIO0_4 as an output instead of the WAKEPAD function.

0 Kudos
Reply
2,613 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kurt Mirdell,

Thanks for your reply.
It seems a bit weird.
I'd like to replicate the phenomenon on my site, so whether you can share a compile-able demo, then I'll run it with the LPCXpresso 804 board for testing.
Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,613 Views
kurtmirdell
Contributor II

Found the problem, bit 24 in PINENABLE was actually 0. Works as it should. However, the wording in the manual about wake-up function made me believe that that was the problem.

0 Kudos
Reply
2,614 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kurt Mirdell,

Thank you for your reply.
I've used the lpcxpresso804_led_blinky demo which is from the SDK library as the template, and do a bit modification to make the PIO0_4  toggles per 1 second.
It works well, please check the attachment and give a try.

新建文件1.bmp

Fig 1

WeChat Image_20190329150958.jpg

Fig 2


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,613 Views
kurtmirdell
Contributor II

Hi,

The problem was actually a software problem.

I had a statement that was

LPC_GPIO_PORT->DIRSET[0] = (1 << AVDD_ON);

AVDD_ON is equated to the port bit number.

I changed that to

LPC_GPIO_PORT->DIRSET[0] = (1 << AVDD_ON) || (1 << PIO_4);

where PIO_4 is equated to 4.

It was one bar too much. It should have been bitwise or, not logical or.

Correct statement is

LPC_GPIO_PORT->DIRSET[0] = (1 << AVDD_ON) | (1 << PIO_4);

And then it works.

0 Kudos
Reply
2,613 Views
starblue
Contributor III

Thanks for sharing.

This has happened to me before, I looked at it for hours and didn't see it.

One thing that helps, when you are sufficiently desperate, is to look at the generated assembly code.

0 Kudos
Reply
2,613 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Kurt Mirdell,

Glad to hear the news.

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,613 Views
kurtmirdell
Contributor II

I have a fully functional software for a special hardware. I don't think it would be any good if you try that on some other hardware.

My tests has been made both by additions to my software and also by direct manipulating things in my monitoring software where I can access all memory and ports.

According to my understanding, you should do the following to set a PIO_4 to output:

Bit 24 in PINENABLE0, address 0x4000 C1C0, should be 1 but that is default on reset so it should not be necessary to change.

Enable GPIO clock (bit 6) in SYSAHBCLKCTRL, address 0x4004 8080, also default on reset.

Set port as output by writing a 1 in correct position (0x10 for PIO_4) in GPIO direction port register (DIR0, address 0xA000 2000)

Pin should now be output and should be possible to set to 0/1 by writing 0/0x10 to GPIO port pin register (PIN0, address 0xA000 2100)

I have checked actual register contents.

I think this has something to do with the wake-up pin functionality on this pin.

0 Kudos
Reply
2,613 Views
starblue
Contributor III

In LPC82x ISP uses P0_4 as U0_TXD,  have you checked whether that is still the case?

Or more generally, whether some other function is mapped to P0_4 via PINASSIGN?

0 Kudos
Reply