Hello, I have a project where I need 8 quadrature encoders. So I've created 5 using CLB's (plus the 3 built in encoders). I had it working fine with 2 tiles on 379 launchpad. Now I've got my production 386 board and can't get it to work. The position register just counts up at very high speed.
I configure like this:
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CLB1);
initTILE1(CLB1_BASE);
XBAR_setInputPin(CLBINPUTXBAR_BASE, XBAR_INPUT1, 30);
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_INPUT1);
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
XBAR_setInputPin(CLBINPUTXBAR_BASE, XBAR_INPUT2, 31);
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_INPUT2);
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
CLB_enableCLB(CLB1_BASE);
Then read the counter with this:
pos = (int32_t)CLB_getRegister(CLB1_BASE, CLB_REG_CTR_C0);
This all worked before, so I'm pretty sure the configuration of the tiles in syscfg is ok. With the launchpad, I used the AUGSIG inputs. But need to use the CLB_INPUT_XBAR here so I can have 10 inputs. There must be something else different between 379 and 386 project, but I can't find it. I also tried using the AUXSIG inputs and it does the same thing.
My new board has 20MHz clock, so I thought maybe the CLB clock was too fast and tried this, also did not help
SysCtl_setCLBClk (SYSCTL_CLBCLKOUT_DIV_1, SYSCTL_CLBTCLKOUT_DIV_2,
SYSCTL_CLB1, SYSCTL_CLBCLK_ASYNC);
Any ideas what I'm missing?
Thanks