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.

TMS320F28379D: Loading the CLB Count Register

Part Number: TMS320F28379D


Greetings,

I am trying to load a counter’s count register.  According to the TRM section 26.4.2.2, “This register can either be loaded statically before counting commences, or dynamically at run time.".  This leads me to believe that there is a means, other than the event mechanism, which can be used to load the count register.  Is this true, or am I misinterpreting the sentence, and that events must always be used?

Thank you,

Ed

  • No Ed you are correct. At run time, using the C28x, "CLB write interface" function can update the counter. There are many examples for the CLB and this should be included in many of them. 

  • Hi Nima,

    The CLB_writeInteface function is used to write the Counter’s, and HLC’s, peripheral registers.  But I don’t see an example of it being used to write a Counter’s count register.  My current understanding is that the only way to write this is from the Counter's Load register or one of the HLC's registers when an event occurs on the respective block.  But there is a mechanism by which the count register can be read, via the CLB_DBG_Cx registers which are read  only.  I was hoping there was an equivalent method for writing it which could simply be done from the microprocessor and would not require an event.  Is there such a capability?

    Thank you,

    Ed

  • You are correct. I misspoke. This is how I had done it in the past:

    1. Write the new value for the CTR to FIFO.

    2. Generate a trigger to cause the HLC to run a program.

    3. The HLC PULLs the value in FIFO to Cx.

    Ex7 of CLB:

    CLB_writeInterface(CLB1_BASE, CLB_ADDR_COUNTER_1_LOAD, period);
    HWREG(CLB1_BASE + CLB_LOGICCTL + CLB_O_BUF_PTR) = 0U;
    HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(0)) = period;
    HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(1)) = duty;
    CLB_setGPREG(CLB1_BASE, 1 << TRIGGER_PWM_UPDATE_SHIFT);

    Nima

  • Makes sense.

    Thank you Nima,

    Ed