LPC804 - Problem with pin P0.8

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

LPC804 - Problem with pin P0.8

664 Views
masterboy
Contributor III

Greetings, I'm working on a project with LPC804 (TSSOP20) and I came across a problem I can't handle. I have a simple program for capturing falling edges on pin P0.8. Pin P0.9 is used to control the thyristor and P0.1 to control the LED. Here is the program:

#include <cr_section_macros.h>

#include "LPC804.h"

#define LED_PIN (1 << 1) // LED P0.1
#define PWR_PIN (1 << 9) // POWER P0.9

// *** LED
#define LED_ON() LPC_GPIO_PORT->SET0 = LED_PIN
#define LED_OFF() LPC_GPIO_PORT->CLR0 = LED_PIN
// *** POWER
#define PWR_ON() LPC_GPIO_PORT->SET0 = PWR_PIN
#define PWR_OFF() LPC_GPIO_PORT->CLR0 = PWR_PIN

uint32_t u32_x = 0;

int main(void) {

   LPC_SYSCON->SYSAHBCLKCTRL0 |= (1 << 18) | (1 << 7) | (1 << 6); // IOCON [Enable], SWM [Enable], GPIO0 [Enable]

   // *** LED
   LPC_GPIO_PORT->DIR0 |= LED_PIN;
   LED_OFF();

   // *** POWER

   LPC_GPIO_PORT->DIR0 |= PWR_PIN;
   PWR_OFF();

   // *** CAPTURE
   LPC_SYSCON->PINTSEL0 = 8; // Pin P0.8
   LPC_SYSCON->SYSAHBCLKCTRL0 |= (1 << 28); // GPION_INT
   LPC_PIN_INT->IENF |= (1 << 0); // Enable falling edge interrupt enabled
   LPC_PIN_INT->SIENF |= (1 << 0); // Enable falling edge interrupt

   LPC_PIN_INT->IST |= (1 << 0);
   NVIC_EnableIRQ(PININT0_IRQn); 

   while(1) {
   }
   return 0 ;
}

void PININT0_IRQHandler(void) {

   if (LPC_PIN_INT->IST & (1 << 0)) {

      u32_x++;
      LPC_PIN_INT->IST |= (1 << 0);
   }
}

The problem occurs after initialization of pin P0.9. Before initializing this pin, pin P0.8 acts as an input with a pull up resistor. After initializing P0.9, something happens and pin P0.8 behaves as if it were a pull down. Therefore, capturing descending wounds does not work. 

How do the settings of pin P0.9 relate to pin P0.8? Can anyone advise me what to do with it?

Labels (1)
Tags (3)
0 Kudos
2 Replies

579 Views
nxf63973
NXP Employee
NXP Employee

Hi

 

I copied your code on a new project using the latest SDK Version available for this MCU. I loaded this project to the LPCXpresso804 development board. During debugging, the pin P0.8 seems to remain in pull-up configuration, and unfortunately, I was not able to reproduce the behavior that you described.

 

These could be a hardware issue, so could you please check the pin connections of your board? Just to be sure.

 

Also, could you please try using the latest SDK version?

 

Please let me know if you have any further issues.

0 Kudos

579 Views
nxf63973
NXP Employee
NXP Employee

Hi, I hope you're doing well!

 

We are taking a look at your code, and I will reply to you as soon as possible.

 

In the meantime, could you please let me know if all of the pins in the port are behaving the same? Or does this only affect P0.8 when configuring P0.9?

 

Please let me know if you have any further issues.

0 Kudos