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.

TMS320F28377D: GPxCSEL1 changed during execution

Part Number: TMS320F28377D

Hello,

I use CPU1 and CPU2 in my software, and I've a question : 

Is it possible to drive a GPIO (for example GPIO0) with CPU1, and changed master which control this GPIO pin to CPU2 while program is running ?

For example, if I have a program which execute CPU1 then CPU2 : 

CPU1 :

    EALLOW;
    GpioCtrlRegs.GPACSEL1.bit.GPIO0 = 0x0; // CPU1 selected
    EDIS;
    
    GpioDataRegs.GPADAT.bit.GPIO0 = 1;
    
    DELAY_US(500);

    EALLOW;
    GpioCtrlRegs.GPACSEL1.bit.GPIO0 = 0x2; // CPU2 selected
    EDIS;

CPU2 :

  GpioDataRegs.GPADAT.bit.GPIO0 = 0;
  
  DELAY_US(500);

It doesn't seem to work.

Thanks for your feedback.

Regards,

  • Hi,

    We should be able to change the control master from CPU1 to CPU2 at runtime. Are you using IPC to tell CPU2 that master has changed?

  • Hi Santosh,

    Yes, I'm using IPC but just to synchronize both CPUs.

    Unlike my example where I toggled a single bit, in reality I have to drive 1 byte (to generate a wave).

    IPC side is ok, each task is done one after the other (CPU1 then CPU2 then CPU1 ...)

    CPU1 side is working, signal is generated each time I'm executing the loop.

    CPU2 side is not working, signal is never generated (=0V).

    Any ideas ?

    CPU1 :

        EALLOW;
        GpioCtrlRegs.GPCCSEL1.all = 0x00000000; // CPU1 selected
        EDIS;
        
        GpioDataRegs.GPADAT.bit.GPIO64 = 1;
        GpioDataRegs.GPADAT.bit.GPIO65 = 0;
        ....
        GpioDataRegs.GPADAT.bit.GPIO71 = 1;
        
    
        EALLOW;
        GpioCtrlRegs.GPCCSEL1.all = 0x22222222; // CPU2 selected
        EDIS;
        
        IPCLtoRFlagSet(IPC_FLAG1);
        
        while (IPCLtoRFlagBusy(IPC_FLAG1));     // CPU2 hasn't clear FLAG1

    CPU2 :

        while(!IPCRtoLFlagBusy(IPC_FLAG1));         // No event was set by CPU1
    
        EALLOW;
        GpioDataRegs.GPADAT.bit.GPIO64 = 0;          // Toggle bit
        GpioDataRegs.GPADAT.bit.GPIO65 = 1;          // Toggle bit
        ....
        GpioDataRegs.GPADAT.bit.GPIO71 = 0;          // Toggle bit
        EDIS;
        
        IPCRtoLFlagAcknowledge(IPC_FLAG1);
        IPCLtoRFlagClear(IPC_FLAG1);

    Regards,

  • Hi,

    This should work. I am trying to reproduce the issue locally. I will get back to you tomorrow.

  • Santosh,

    I don't know what happens but the next day after my question, it worked.
    So the code is correct.

    Regards,