How can changing P1_2 state from low to high output be seen in P1_6?

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

How can changing P1_2 state from low to high output be seen in P1_6?

Jump to solution
736 Views
Gaico
Contributor II

Hello,

We are currently trying to figure out why two pins seem almost interchangeable in controlling a HIGH/LOW output on the OM13084 board. Header: J1.19.

The setup is as follows:

An oscilloscope is connected to pin P1_6 on the board. When changing the state of the P1_6 pin (which is set to GPIO output) from low to high, nothing happens. When then changing the state of the P1_2 pin, we can see a change in output as expected when trying to change the P1_6 pin.

Short notation of the question is thus: Is there a reason as to why I cannot directly change the state of the P1_6 pin, only through changing P1_2? I am not configuring them any different in code. 

I hope this question is not too vague, but I would appreciate any kind of input!

Take care

Tags (1)
0 Kudos
1 Solution
710 Views
Gaico
Contributor II

I found the issue, it was my mistake for looking in the wrong place.

I was assuming the name(s) on the demo board were the same as the names needed in the code.

If looking in the datasheet, pin P1_6 has GPIO1[2], which was used in the code.

Gaico_0-1663232427972.png

 

After doing this with another test port (P1_7 which turned into GPIO1[0]) everything works as expected.

Gaico_1-1663232444472.png

 

View solution in original post

0 Kudos
4 Replies
721 Views
frank_m
Senior Contributor III

> An oscilloscope is connected to pin P1_6 on the board. When changing the state of the P1_6 pin (which is set to GPIO output) from low to high, nothing happens. When then changing the state of the P1_2 pin, we can see a change in output as expected when trying to change the P1_6 pin.

First thing I would do ist to measure the connections from J1.19 to both pins with an Ohmmeter, with power off.

I guess you have checked the schematics already.

0 Kudos
725 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

Please take a picture about your hardware connection when measure P1_6,

also show your code.

 

 

BR

Alice

0 Kudos
716 Views
Gaico
Contributor II

Hi Alice,

Thank you for your reply. As I don't reckon the issue is caused by faulty hardware (as I only read out the pin, same as say putting an LED on pin P1_9), I will for now only cover the software I have.

Initializer code is as follows (within main):

 

 

Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 2); //for some reason this one triggers on the 1,9 port
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 9); //port output wire is connected to

Chip_SCU_PinMuxSet(9,0, SCU_PINIO_FAST); // SCU_MODE_FUNC0 | SCU_PINIO_FAST);
Chip_SCU_PinMuxSet(9,1, SCU_PINIO_FAST); // SCU_MODE_FUNC0 | SCU_PINIO_FAST);

Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT,4,12);
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT,4,13);

 

 

Then the functioning code is as follows (within an infinite loop):

 

 

Board_LED_Set(1, true);
//Chip_GPIO_SetPinState(LPC_GPIO_PORT, 1, 2, true); //outputs on 1,9?
Chip_GPIO_SetPinState(LPC_GPIO_PORT, 1, 9, true); //nothing on 1,9?

_delay_ms(200); //wait, custom function

//Chip_GPIO_SetPinState(LPC_GPIO_PORT, 1, 2, false); // deactivate power
Chip_GPIO_SetPinState(LPC_GPIO_PORT, 1, 9, false); // deactivate power
Board_LED_Set(1, false);

 

 

With maybe the important functions for how the pinstate is set:

 

 

/**
 * @brief	Set GPIO direction for a single GPIO pin to an output
 * 	pGPIO	: The base of GPIO peripheral on the chip
 * 	port	: GPIO Port number where @a pin is located
 * 	pin		: GPIO pin to set direction on as output
 * @return	Nothing
 */
STATIC INLINE void Chip_GPIO_SetPinDIROutput(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
{
	pGPIO->DIR[port] |= 1UL << pin;
}
/**
 * @brief	Set a GPIO pin state via the GPIO byte register
 * 	pGPIO	: The base of GPIO peripheral on the chip
 *  	port	: GPIO Port number where @a pin is located
 * 	pin		: GPIO pin to set
 * 	setting	: true for high, false for low
 * @return	Nothing
 * @note	This function replaces Chip_GPIO_WritePortBit()
 */
STATIC INLINE void Chip_GPIO_SetPinState(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin, bool setting)
{
	pGPIO->B[port][pin] = setting;
}

 

 

 I am not seeing anything being done differently, but I might be overlooking something.

0 Kudos
711 Views
Gaico
Contributor II

I found the issue, it was my mistake for looking in the wrong place.

I was assuming the name(s) on the demo board were the same as the names needed in the code.

If looking in the datasheet, pin P1_6 has GPIO1[2], which was used in the code.

Gaico_0-1663232427972.png

 

After doing this with another test port (P1_7 which turned into GPIO1[0]) everything works as expected.

Gaico_1-1663232444472.png

 

0 Kudos