Hi XiangJun Rong,
Thank you for your reply. I do have code that reads the position register and it was always zero. I could even use the debugger and it was always zero.
I got it working! I first attempted to read the pins as GPIO inputs by changing the entries in my pinmuxing array to set the pins as function 0. It still wasn't working. Then I added calls to Chip_SCU_PinMuxSet for each pin setting them to function 0 in my main code. Then I could read the pins. Then I changed them to function 1 and now the QEI is working.
Chip_SCU_PinMuxSet(0xA, 2, SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_PULLUP | SCU_MODE_FUNC1);
Chip_SCU_PinMuxSet(0xA, 3, SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_PULLUP | SCU_MODE_FUNC1);
I have no idea why my entries in my pinmuxing array do not work. All the other pins I setup in that array work for Ethernet, USB, I2C, GPIOS, etc. all work. This is when I call:
Chip_SCU_SetPinMuxing(pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
I have this in the board_sysinit.c file.
Here are the two entries for the encoder PHA and PHB on pins PA_3 and PA_2.
// PA_2 Encoder B GPIO4[9].
{0xA, 2, SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_PULLUP | SCU_MODE_FUNC1},
// PA_3 Encoder A GPIO4[10]
{0xA, 3, SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_PULLUP | SCU_MODE_FUNC1},
Any idea why this would not work when all the other pins I setup do?
Thank you,
Gary Altenberg