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.