This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28386D: Can't get CLB quadrature encoder working

Part Number: TMS320F28386D

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

  • Hi Ken,

    Your XBAR and CLB configurations DriverLib code looks correct from what I can see. You mentioned that it just counts up, is this without an encoder attached to the input pins? Are you using an index input as well? I'm assuming no since you mentioned only using 10 inputs for the 5 QEPs. What have you configured as the maximum for these CLB-QEPs?

    Regards,

    Peter

  • thanks for your reply.

    There is a motor with encoder attached. There are 8 connectors and it works correctly on the 3 eQEP's. So wiring must be good. Not using index.

    What maximum do you mean? The CLB config is pretty simple; just 2FSM, 2 LUT and a counter.

    I'm not sure about how the clock to CLB is configured. I was assuming the default in deviceInit/SysCtrl_setClock would be fine with USE_20MHZ_XTAL. Anything else to set there?

    thanks

    Ken

  • Ah, I've got it.

    It should be    initTILE0(CLB1_BASE);

    not initTile1

    Doh.

    thanks.