Hello,
I been having some difficulties to control P0_26 on lpc54102. I know this pins is used to contro i2c1, but i our pcb design we map this pin to be used gpio (output), but I been having a hard time doing this, i feel kinda dumb hahah.
I modified the blinky.c example code:
#include "board.h"
/*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/
#define TICKRATE_HZ (10) /* 10 ticks per second */
/*E1 - OUTPUT*/
#define PORT0 0
#define RS485_REn_PORT PORT0
#define RS485_REn_PIN 26
#define RS485_REn_OUT LPC_GPIO->DIR[RS485_REn_PORT]|=(1UL <<RS485_REn_PIN)
#define RS485_REn_HI LPC_GPIO->B[RS485_REn_PORT][RS485_REn_PIN] = true
#define RS485_REn_LO LPC_GPIO->B[RS485_REn_PORT][RS485_REn_PIN] = false
#define RS485_REn_INP LPC_GPIO->DIR[RS485_REn_PORT]&=~(1UL <<RS485_REn_PIN)
#define RS485_REn_IN LPC_GPIO->B[RS485_REn_PORT][RS485_REn_PIN]
#define RS485_REn_TOG LPC_GPIO->NOT[RS485_REn_PORT]|=(1UL <<RS485_REn_PIN)
/*****************************************************************************
* Public types/enumerations/variables
****************************************************************************/
/*****************************************************************************
* Private functions
****************************************************************************/
/*****************************************************************************
* Public functions
****************************************************************************/
/* Systick handler ISR */
void SysTick_Handler(void)
{
Board_LED_Toggle(0);
RS485_REn_TOG;
}
/* main function (C entry point) */
int main(void)
{
int loop = 1; /* Used to fix the unreachable statement warning */
SystemCoreClockUpdate();
Board_Init();
Board_LED_Set(0, false);
Chip_IOCON_PinMuxSet(LPC_IOCON, RS485_REn_PORT, RS485_REn_PIN,
(IOCON_FUNC0 | IOCON_DIGITAL_EN | IOCON_GPIO_MODE));
RS485_REn_OUT;
RS485_REn_HI;
/* Enable SysTick Timer */
SysTick_Config(SystemCoreClock / TICKRATE_HZ);
while (loop) {
__WFI();
}
return 0;
}
but I am not been able to change the behavior of this pin, on our custom project and also the lpcXpresso 54102 board. when I change the configuration on debug mode the value goes back to 0 (keil).
can someone help me sort this out ?
thanks