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
Solved! Go to Solution.
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.
After doing this with another test port (P1_7 which turned into GPIO1[0]) everything works as expected.
> 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.
Hello,
Please take a picture about your hardware connection when measure P1_6,
also show your code.
BR
Alice
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.
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.
After doing this with another test port (P1_7 which turned into GPIO1[0]) everything works as expected.