Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

DAVE™ Forum Discussions

Not applicable
I configured 40 + GPIO pins for my project. I was tracking down bad behavior on one pin, P5.1, using Handle37. It turns out that the code generated is incorrect. PORT5.IOCR0 for port 1 is set to 4 when it should be set to 1x, depending up drive.

The code generated is

/* Configuration of 5 Port 1 based on User configuration */
IO004_Handle37.PortRegs->OMR |= (0U<< 1);

IO004_Handle37.PortRegs->PDR0 &= (uint32_t)(~(PORT5_PDR0_PD1_Msk));
IO004_Handle37.PortRegs->PDR0 |= (uint32_t)((4UL << PORT5_PDR0_PD1_Pos) & \
PORT5_PDR0_PD1_Msk);
IO004_Handle37.PortRegs->IOCR0 |= (4U << 11);


Not the last line that sets IOCR0 bit 4. All combinations with

Yet, the configuration is clearly set up as an output === See attached image.

I can work around this with call to set output, but it makes me not trust the app.

284.attach
0 Likes
2 Replies
Not applicable
I ended up deleting the IO0004 App (1 of 38) and adding it back.

I was then able to configure the App properly.

I don't know what happend. But working OK now.
0 Likes
Not applicable
Hi danbeadle,

I believe you have noticed that there are two places involving port configurations:
1) In MULTIPLEXER.c
void DAVE_MUX_Init(void)
{

/* PORT Macro definitions for IOCR_OE, IOCR_PCR & HWSEL_HW */

WR_REG(PORT5->IOCR0, PORT_IOCR_PC1_OE_Msk, PORT_IOCR_PC1_OE_Pos, PORT_IOCR_OE1); /* P5.1 : PORT5_IOCR0_PC1_OE */
}
2) In IO004.c
void IO004_Init(void)
{
/* <<>> */

/* Configuration of 5 Port 1 based on User configuration */
IO004_Handle0.PortRegs->OMR = 1U<< 1;

IO004_Handle0.PortRegs->PDR0 &= (uint32_t)(~(PORT5_PDR0_PD1_Msk));
IO004_Handle0.PortRegs->PDR0 |= (uint32_t)((4UL << PORT5_PDR0_PD1_Pos) & \
PORT5_PDR0_PD1_Msk);
IO004_Handle0.PortRegs->IOCR0 |= (0U << 11);
}

In the UI configuration you attached, the "Input characteristics" is set to "InvertedTristate" although it is greyed out. However, it is set to "Tristate" (greyed out also) in the latest release IO004[1.0.16]. The code generated is tally with the UI setting in void IO004_Init(void).

Best regards,
Zain
0 Likes