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.

Toggling a GPIO on CLA

Other Parts Discussed in Thread: TMS320F28377D, TMS320F28075

I am using TMS320F28377D and i found on TI wiki for CLA that

On the 2837xD/S, the CLA can directly access the GPIO control and data registers.
I was trying to toggle a GPIO on CLA but was not able to do so. Can any one throw some light on this topic.
Greatly appreciate your help.
Thanks
  • Hi,

    To change the GPIO control register from CLA, user need to first change the core select for the specific GPIO by configuring the GPyCSELn (e.g. GPACSEL1) registers. By default CPU has control over all the GPIOs. Please refer "Figure 7-1. GPIO Logic for a Single Pin" in TRM for the same. Details of these registers are provided in section "7.11.4 GPIO_CTRL_REGS Registers" of TRM.

    Regards,

    Vivek Singh

     

     

  • Hello all,

    after configuring the core select register of the desired GPIO to be contolled by CLA, how do you write to the CLA Set register in order to actually control the GPIO?

    Regards,

    Alex 

  • Hi Alex,

    CLA has it's own GPIO data registers which can be updated by CLA code to drive the GPIO which are assigned to CLA (just like it's done from CPU). Does that answer your query?

    Regards,

    Vivek Singh

  • Yeah, thanks for the prompt response.
    I was confused there for a bit.
    Regards,
    Alex
  • Is there an example that exists for the 2837xD for toggling a GPIO from the CLA?

    I'm trying to manipulate the IO output from the CLA without much luck. I've set the GPxCSELx (GpioCtrlRegs.GPACSEL2.bit.GPIO14 = 1) for the CPU1.CLA. I'm trying to toggle the bit in Task 1 using GPxTOGGLE (GpioDataRegs.GPATOGGLE.bit.GPIO14=1) but I haven't been successful yet. I'm able to toggle GPIO in the CPU without a problem.

    Any suggestions or help would be appreciated.

    Thanks.
  • Ryan,

    you can execute the below code on CPU to handover the GPIO16 to CLA, before you trigger the CLA task that toggles GPIO 16 (in this case). In the CLA task you just do  GpioDataRegs.GPADAT.bit.GPIO16 = 1, to set it high and =0 to set the pin LOW.

    // GPIO_SetupPinOptions(16, GPIO_OUTPUT, GPIO_PUSHPULL);
    // GpioDataRegs.GPADAT.bit.GPIO16 = 0; // set HIGH
    // GPIO_SetupPinMux(16, GPIO_MUX_CPU1CLA, 0);

    Hope this helps.

    Best Regards

    Santosh Athuru

  • Santosh,

    Thanks for your reply. I used the CLA example code cla_iir2p2z_cpu01 and added GPIO per our discussion. This worked great for me. Here are the items that I inserted into the code:

    /------------------------------GPIO config--------------------------------------------------------
    EALLOW;
    GpioCtrlRegs.GPAGMUX2.bit.GPIO16 = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO16 = 1; // 1=OUTput, 0=INput
    GpioDataRegs.GPASET.bit.GPIO16 = 1; // Set High initially
    GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; // 0= enables pullup, 1= disables pullup
    GpioCtrlRegs.GPACSEL3.bit.GPIO16 = 1; // 0=CPU1, 1=CPU1.CLA1, 2=CPU2, 3=CPU2.CLA
    EDIS;
    /------------------------added header in .cla file---------------------------------------------
    #include "F28x_Project.h"
    ----------------------------TASK1 of iir2p2z.cla file-------------------------------------------
    interrupt void Cla1Task1 ( void )
    {
    __mdebugstop();
    GpioDataRegs.GPADAT.bit.GPIO16=1;
    yn = xn*S1_B[0] + W2[1];
    W2[0] = xn*S1_B[1] + yn*S1_A[1] + W1[1];
    W2[1] = W2[0];
    W1[0] = xn*S1_B[2] + yn*S1_A[2];
    W1[1] = W1[0];
    GpioDataRegs.GPADAT.bit.GPIO16=0;
    // __mnop();
    // __mnop();
    // __mnop();
    }
    /---------------------------------------------------------------------------------------------------

    Thanks for your help!

    Ryan
  • Hi,

    i tried this to access the gpio from TMS320F28075, by incorporating the changes in the above post to TMS320F28075.

    /------------------------------GPIO config--------------------------------------------------------
    EALLOW;
    GpioCtrlRegs.GPAGMUX2.bit.GPIO31 = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO31 = 1; // 1=OUTput, 0=INput
    GpioDataRegs.GPASET.bit.GPIO31 = 1; // Set High initially
    GpioCtrlRegs.GPAPUD.bit.GPIO31 = 0; // 0= enables pullup, 1= disables pullup
    GpioCtrlRegs.GPACSEL4.bit.GPIO31 = 1; // 0=CPU1, 1=CPU1.CLA1, 2=CPU2, 3=CPU2.CLA
    EDIS;
    /------------------------added header in .cla file---------------------------------------------
    #include "F28x_Project.h" 
    ----------------------------TASK1 of .cla file-------------------------------------------
    interrupt void Cla1Task1 ( void )
    {
    __mdebugstop();
    GpioDataRegs.GPADAT.bit.GPIO31=1;
    yn = xn*S1_B[0] + W2[1];
    W2[0] = xn*S1_B[1] + yn*S1_A[1] + W1[1];
    W2[1] = W2[0];
    W1[0] = xn*S1_B[2] + yn*S1_A[2];
    W1[1] = W1[0];
    // __mnop();
    // __mnop();
    // __mnop();
    }
    /---------------------------------------------------------------------------------------------------

    can anyone suggest what may be the reason?

  • In your ClaTask1, can you try changing "GpioDataRegs.GPADAT.bit.GPIO31=1" to "GpioDataRegs.GPATOGGLE.bit.GPIO31 = 1"
    Also, can you set a breakpoint at the instruction in CLA to see if it gets there consistently?

    BTW, unfortunately, I do not have access to the F28075 processor, so I cannot try your code.
    I may see if my ControlStick can use the code - however, probably not today...