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: TMS320F28379D controlSUITE v210 SCIBTX (GPIO70)

Part Number: TMS320F28379D
Other Parts Discussed in Thread: CONTROLSUITE

Hello,

I configure, in CPU1, GPIO70 to work as SCIBTx in order to implement a little example which periodically sends some text through it. And it works fine.

Then I want to do exactly the same but in CPU2 but I am not able. I know I must configure GPIO in CPU1 and I do it. The difference is that when I call routine "GPIO_SetupPinMux()" I pass, as second parameter, "GPIO_MUX_CPU2" instead of "GPIO_MUX_CPU1" (which is what I do in the CPU1 example). And I still can't send anything through GPIO70 from CPU2.

Can anyone tell me if I am missing anything?

One more thing, if in the CPU1 project I pass "GPIO_MUX_CPU2" as second parameter to "GPIO_SetupPinMux()", I still can send text through GPIO70, this is confusing me. Please can anyone help?

Thanks in advance!

Best regards,

Adria

  • Show me your gpio setup for this gpio , also do you assign the peripheral itself to cpu2?
  • Hello Nima,

    Thanks for your answer.

    I do the next as initialization and configuration in CPU1:

    /* Initialize Gpio Module */
    InitGpio();
    /* GPIO setup */
    GPIO_SetupPinMux(70, GPIO_MUX_CPU2, 6);
    GPIO_SetupPinOptions(70, GPIO_OUTPUT, GPIO_ASYNC);
    /* SCI FIFO config */
    ScibRegs.SCIFFTX.all = 0xE040;
    ScibRegs.SCIFFRX.all = 0x2044;
    ScibRegs.SCIFFCT.all = 0x0;
    /* SCI communication config */
    ScibRegs.SCICCR.all = 0x0007;
    ScibRegs.SCICTL1.all = 0x0003;
    ScibRegs.SCICTL2.all = 0x0003;
    ScibRegs.SCICTL2.bit.TXINTENA = 1;
    ScibRegs.SCICTL2.bit.RXBKINTENA = 1;
    ScibRegs.SCIHBAUD.all = 0x0002;
    ScibRegs.SCILBAUD.all = 0x008B;
    ScibRegs.SCICTL1.all = 0x0023;

    Then in CPU2, to transmit text through SCI, I use the next routine:

    void scib_xmit(int a)
    {
        while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
        ScibRegs.SCITXBUF.all =a;
    }

    As you can see in the first piece of code, when I call "GPIO_SetupPinMux()" routine I specify "GPIO_MUX_CPU2". Is there anything else I have to do to make this GPIO work on CPU2?

    I have also tried to do the "SCI FIFO config" and "SCI communication config" (both from first piece of code) in CPU2, but still not working.

    Best regards,

    Adria

  • I know what your problem is :)

    You need to assign your PERIPHERAL to CPU2.

       //ASSIGN SCIx to CPU2
       DevCfgRegs.CPUSEL5.bit.SCI_A = 1;
       DevCfgRegs.CPUSEL5.bit.SCI_B = 1;
       DevCfgRegs.CPUSEL5.bit.SCI_C = 1;
       DevCfgRegs.CPUSEL5.bit.SCI_D = 1;

    After this CPU1 can no longer access SCIx. So you can do this before or after you configure the SCI control registers.

    The section of the TRM for these regs are:

    Good luck with the rest of your development.

    Nima Eskandari

  • Hello Nima,

    I though when I called "GPIO_SetupPinMux(70, GPIO_MUX_CPU2, 6)" I was already assigning SCIB to CPU2, otherwise what does "GPIO_SetupPinMux()" routine do?

    I tried doing what you said and still not working, in fact it doesn't make any change because after adding "DevCfgRegs.CPUSEL5.bit.SCI_B = 1" in CPU1 I can keep successfully transmitting from CPU1 and not from CPU2.

    Please find attached 2 files: one is CPU1 source code file and the other one is CPU2 source code file. Don't worry they are very simple examples.

    One more thing that confuses me: if you take a look at GPIO_CTRL_REGS struct:

    struct GPIO_CTRL_REGS {
        union   GPACTRL_REG                      GPACTRL;                      // GPIO A Qualification Sampling Period Control (GPIO0 to 31)
        union   GPAQSEL1_REG                     GPAQSEL1;                     // GPIO A Qualifier Select 1 Register (GPIO0 to 15)
        union   GPAQSEL2_REG                     GPAQSEL2;                     // GPIO A Qualifier Select 2 Register (GPIO16 to 31)
        union   GPAMUX1_REG                      GPAMUX1;                      // GPIO A Mux 1 Register (GPIO0 to 15)
        union   GPAMUX2_REG                      GPAMUX2;                      // GPIO A Mux 2 Register (GPIO16 to 31)
        union   GPADIR_REG                       GPADIR;                       // GPIO A Direction Register (GPIO0 to 31)
        union   GPAPUD_REG                       GPAPUD;                       // GPIO A Pull Up Disable Register (GPIO0 to 31) 
        Uint16                                   rsvd1[2];                     // Reserved
        union   GPAINV_REG                       GPAINV;                       // GPIO A Input Polarity Invert Registers (GPIO0 to 31)
        union   GPAODR_REG                       GPAODR;                       // GPIO A Open Drain Output Register (GPIO0 to GPIO31)
        Uint16                                   rsvd2[12];                    // Reserved
        union   GPAGMUX1_REG                     GPAGMUX1;                     // GPIO A Peripheral Group Mux (GPIO0 to 15)
        union   GPAGMUX2_REG                     GPAGMUX2;                     // GPIO A Peripheral Group Mux (GPIO16 to 31)
        Uint16                                   rsvd3[4];                     // Reserved
        union   GPACSEL1_REG                     GPACSEL1;                     // GPIO A Core Select Register (GPIO0 to 7)
        union   GPACSEL2_REG                     GPACSEL2;                     // GPIO A Core Select Register (GPIO8 to 15)
        union   GPACSEL3_REG                     GPACSEL3;                     // GPIO A Core Select Register (GPIO16 to 23)
        union   GPACSEL4_REG                     GPACSEL4;                     // GPIO A Core Select Register (GPIO24 to 31)
        Uint16                                   rsvd4[12];                    // Reserved
        union   GPALOCK_REG                      GPALOCK;                      // GPIO A Lock Configuration Register (GPIO0 to 31)
        union   GPACR_REG                        GPACR;                        // GPIO A Lock Commit Register (GPIO0 to 31)
        union   GPBCTRL_REG                      GPBCTRL;                      // GPIO B Qualification Sampling Period Control (GPIO32 to 63)
        union   GPBQSEL1_REG                     GPBQSEL1;                     // GPIO B Qualifier Select 1 Register (GPIO32 to 47)
        union   GPBQSEL2_REG                     GPBQSEL2;                     // GPIO B Qualifier Select 2 Register (GPIO48 to 63)
        union   GPBMUX1_REG                      GPBMUX1;                      // GPIO B Mux 1 Register (GPIO32 to 47)
        union   GPBMUX2_REG                      GPBMUX2;                      // GPIO B Mux 2 Register (GPIO48 to 63)
        union   GPBDIR_REG                       GPBDIR;                       // GPIO B Direction Register (GPIO32 to 63)
        union   GPBPUD_REG                       GPBPUD;                       // GPIO B Pull Up Disable Register (GPIO32 to 63) 
        Uint16                                   rsvd5[2];                     // Reserved
        union   GPBINV_REG                       GPBINV;                       // GPIO B Input Polarity Invert Registers (GPIO32 to 63)
        union   GPBODR_REG                       GPBODR;                       // GPIO B Open Drain Output Register (GPIO32 to GPIO63)
        union   GPBAMSEL_REG                     GPBAMSEL;                     // GPIO B Analog Mode Select register (GPIO32 to GPIO63)
        Uint16                                   rsvd6[10];                    // Reserved
        union   GPBGMUX1_REG                     GPBGMUX1;                     // GPIO B Peripheral Group Mux (GPIO32 to 47)
        union   GPBGMUX2_REG                     GPBGMUX2;                     // GPIO B Peripheral Group Mux (GPIO48 to 63)
        Uint16                                   rsvd7[4];                     // Reserved
        union   GPBCSEL1_REG                     GPBCSEL1;                     // GPIO B Core Select Register (GPIO32 to 39)
        union   GPBCSEL2_REG                     GPBCSEL2;                     // GPIO B Core Select Register (GPIO40 to 47)
        union   GPBCSEL3_REG                     GPBCSEL3;                     // GPIO B Core Select Register (GPIO48 to 55)
        union   GPBCSEL4_REG                     GPBCSEL4;                     // GPIO B Core Select Register (GPIO56 to 63)
        Uint16                                   rsvd8[12];                    // Reserved
        union   GPBLOCK_REG                      GPBLOCK;                      // GPIO B Lock Configuration Register (GPIO32 to 63)
        union   GPBCR_REG                        GPBCR;                        // GPIO B Lock Commit Register (GPIO32 to 63)
        union   GPCCTRL_REG                      GPCCTRL;                      // GPIO C Qualification Sampling Period Control (GPIO64 to 95)
        union   GPCQSEL1_REG                     GPCQSEL1;                     // GPIO C Qualifier Select 1 Register (GPIO64 to 79)
        union   GPCQSEL2_REG                     GPCQSEL2;                     // GPIO C Qualifier Select 2 Register (GPIO80  to 95)
        union   GPCMUX1_REG                      GPCMUX1;                      // GPIO C Mux 1 Register (GPIO64 to 79)
        union   GPCMUX2_REG                      GPCMUX2;                      // GPIO C Mux 2 Register (GPIO80  to 95)
        union   GPCDIR_REG                       GPCDIR;                       // GPIO C Direction Register (GPIO64 to 95)
        union   GPCPUD_REG                       GPCPUD;                       // GPIO C Pull Up Disable Register (GPIO64 to 95) 
        Uint16                                   rsvd9[2];                     // Reserved
        union   GPCINV_REG                       GPCINV;                       // GPIO C Input Polarity Invert Registers (GPIO64 to 95)
        union   GPCODR_REG                       GPCODR;                       // GPIO C Open Drain Output Register (GPIO64 to GPIO95)
        Uint16                                   rsvd10[12];                   // Reserved
        union   GPCGMUX1_REG                     GPCGMUX1;                     // GPIO C Peripheral Group Mux (GPIO64 to 79)
        union   GPCGMUX2_REG                     GPCGMUX2;                     // GPIO C Peripheral Group Mux (GPIO80  to 95)
        Uint16                                   rsvd11[4];                    // Reserved
        union   GPCCSEL1_REG                     GPCCSEL1;                     // GPIO C Core Select Register (GPIO64 to 71)
        union   GPCCSEL2_REG                     GPCCSEL2;                     // GPIO C Core Select Register (GPIO72 to 79)
        union   GPCCSEL3_REG                     GPCCSEL3;                     // GPIO C Core Select Register (GPIO80  to 87)
        union   GPCCSEL4_REG                     GPCCSEL4;                     // GPIO C Core Select Register (GPIO88 to 95)
        Uint16                                   rsvd12[12];                   // Reserved
        union   GPCLOCK_REG                      GPCLOCK;                      // GPIO C Lock Configuration Register (GPIO64 to 95)
        union   GPCCR_REG                        GPCCR;                        // GPIO C Lock Commit Register (GPIO64 to 95)
        union   GPDCTRL_REG                      GPDCTRL;                      // GPIO D Qualification Sampling Period Control (GPIO96 to 127)
        union   GPDQSEL1_REG                     GPDQSEL1;                     // GPIO D Qualifier Select 1 Register (GPIO96 to 111)
        union   GPDQSEL2_REG                     GPDQSEL2;                     // GPIO D Qualifier Select 2 Register (GPIO112 to 127)
        union   GPDMUX1_REG                      GPDMUX1;                      // GPIO D Mux 1 Register (GPIO96 to 111)
        union   GPDMUX2_REG                      GPDMUX2;                      // GPIO D Mux 2 Register (GPIO112 to 127)
        union   GPDDIR_REG                       GPDDIR;                       // GPIO D Direction Register (GPIO96 to 127)
        union   GPDPUD_REG                       GPDPUD;                       // GPIO D Pull Up Disable Register (GPIO96 to 127) 
        Uint16                                   rsvd13[2];                    // Reserved
        union   GPDINV_REG                       GPDINV;                       // GPIO D Input Polarity Invert Registers (GPIO96 to 127)
        union   GPDODR_REG                       GPDODR;                       // GPIO D Open Drain Output Register (GPIO96 to GPIO127)
        Uint16                                   rsvd14[12];                   // Reserved
        union   GPDGMUX1_REG                     GPDGMUX1;                     // GPIO D Peripheral Group Mux (GPIO96 to 111)
        union   GPDGMUX2_REG                     GPDGMUX2;                     // GPIO D Peripheral Group Mux (GPIO112 to 127)
        Uint16                                   rsvd15[4];                    // Reserved
        union   GPDCSEL1_REG                     GPDCSEL1;                     // GPIO D Core Select Register (GPIO96 to 103)
        union   GPDCSEL2_REG                     GPDCSEL2;                     // GPIO D Core Select Register (GPIO104 to 111)
        union   GPDCSEL3_REG                     GPDCSEL3;                     // GPIO D Core Select Register (GPIO112 to 119)
        union   GPDCSEL4_REG                     GPDCSEL4;                     // GPIO D Core Select Register (GPIO120 to 127)
        Uint16                                   rsvd16[12];                   // Reserved
        union   GPDLOCK_REG                      GPDLOCK;                      // GPIO D Lock Configuration Register (GPIO96 to 127)
        union   GPDCR_REG                        GPDCR;                        // GPIO D Lock Commit Register (GPIO96 to 127)
        union   GPECTRL_REG                      GPECTRL;                      // GPIO E Qualification Sampling Period Control (GPIO128 to 159)
        union   GPEQSEL1_REG                     GPEQSEL1;                     // GPIO E Qualifier Select 1 Register (GPIO128 to 143)
        union   GPEQSEL2_REG                     GPEQSEL2;                     // GPIO E Qualifier Select 2 Register (GPIO144  to 159)
        union   GPEMUX1_REG                      GPEMUX1;                      // GPIO E Mux 1 Register (GPIO128 to 143)
        union   GPEMUX2_REG                      GPEMUX2;                      // GPIO E Mux 2 Register (GPIO144  to 159)
        union   GPEDIR_REG                       GPEDIR;                       // GPIO E Direction Register (GPIO128 to 159)
        union   GPEPUD_REG                       GPEPUD;                       // GPIO E Pull Up Disable Register (GPIO128 to 159) 
        Uint16                                   rsvd17[2];                    // Reserved
        union   GPEINV_REG                       GPEINV;                       // GPIO E Input Polarity Invert Registers (GPIO128 to 159)
        union   GPEODR_REG                       GPEODR;                       // GPIO E Open Drain Output Register (GPIO128 to GPIO159)
        Uint16                                   rsvd18[12];                   // Reserved
        union   GPEGMUX1_REG                     GPEGMUX1;                     // GPIO E Peripheral Group Mux (GPIO128 to 143)
        union   GPEGMUX2_REG                     GPEGMUX2;                     // GPIO E Peripheral Group Mux (GPIO144  to 159)
        Uint16                                   rsvd19[4];                    // Reserved
        union   GPECSEL1_REG                     GPECSEL1;                     // GPIO E Core Select Register (GPIO128 to 135)
        union   GPECSEL2_REG                     GPECSEL2;                     // GPIO E Core Select Register (GPIO136 to 143)
        union   GPECSEL3_REG                     GPECSEL3;                     // GPIO E Core Select Register (GPIO144  to 151)
        union   GPECSEL4_REG                     GPECSEL4;                     // GPIO E Core Select Register (GPIO152 to 159)
        Uint16                                   rsvd20[12];                   // Reserved
        union   GPELOCK_REG                      GPELOCK;                      // GPIO E Lock Configuration Register (GPIO128 to 159)
        union   GPECR_REG                        GPECR;                        // GPIO E Lock Commit Register (GPIO128 to 159)
        union   GPFCTRL_REG                      GPFCTRL;                      // GPIO F Qualification Sampling Period Control (GPIO160 to 168)
        union   GPFQSEL1_REG                     GPFQSEL1;                     // GPIO F Qualifier Select 1 Register (GPIO160 to 168)
        Uint16                                   rsvd21[2];                    // Reserved
        union   GPFMUX1_REG                      GPFMUX1;                      // GPIO F Mux 1 Register (GPIO160 to 168)
        Uint16                                   rsvd22[2];                    // Reserved
        union   GPFDIR_REG                       GPFDIR;                       // GPIO F Direction Register (GPIO160 to 168)
        union   GPFPUD_REG                       GPFPUD;                       // GPIO F Pull Up Disable Register (GPIO160 to 168) 
        Uint16                                   rsvd23[2];                    // Reserved
        union   GPFINV_REG                       GPFINV;                       // GPIO F Input Polarity Invert Registers (GPIO160 to 168)
        union   GPFODR_REG                       GPFODR;                       // GPIO F Open Drain Output Register (GPIO160 to GPIO168)
        Uint16                                   rsvd24[12];                   // Reserved
        union   GPFGMUX1_REG                     GPFGMUX1;                     // GPIO F Peripheral Group Mux (GPIO160 to 168)
        Uint16                                   rsvd25[6];                    // Reserved
        union   GPFCSEL1_REG                     GPFCSEL1;                     // GPIO F Core Select Register (GPIO160 to 167)
        union   GPFCSEL2_REG                     GPFCSEL2;                     // GPIO F Core Select Register (GPIO168)
        Uint16                                   rsvd26[16];                   // Reserved
        union   GPFLOCK_REG                      GPFLOCK;                      // GPIO F Lock Configuration Register (GPIO160 to 168)
        union   GPFCR_REG                        GPFCR;                        // GPIO F Lock Commit Register (GPIO160 to 168)
    };

    In the line comments seems like it is not possible configure GPIO70 with SCIB, because it says that SCIB ranges from GPIO32 to GPIO63. Instead, in image below:

    It says that GPIO70 can be mapped to SCIB TX.

    Can anyone code 2 files (one for CPU1 and the other for CPU2) to use SCIB in GPIO70 from CPU2?

    Best regards,

    Adria

  • Please check my last reply to see how this didn't resolve the issue and there are still confusing things.
  • Hi Nima,

    it seems that this issue is not solved yet.
    Could you please advice and help my customer?
    Please check the last replies.

    Thanks a lot in advance for your fast reply.

    Best regards,
    Massimiliano De Cristofaro
    TI Staff Field Application Engineer - WEU
  • I am working on this right now!
  • Ok so first thing is that GPIO is assigned to the different core when you assign the pin to a specific core.

        //
        // GPIO_SetupPinMux - Set the peripheral muxing for the specified pin. The
        //                    appropriate parameters can be found in the GPIO Muxed
        //                    Pins table(4.4) in the  datasheet. Use the GPIO index
        //                    row (0 to 15) to select a muxing option for the GPIO.
        //
        void GPIO_SetupPinMux(Uint16 pin, Uint16 cpu, Uint16 peripheral)
        {
            volatile Uint32 *gpioBaseAddr;
            volatile Uint32 *mux, *gmux, *csel;
            Uint16 pin32, pin16, pin8;
    
            pin32 = pin % 32;
            pin16 = pin % 16;
            pin8 = pin % 8;
            gpioBaseAddr = (Uint32 *)&GpioCtrlRegs + (pin/32)*GPY_CTRL_OFFSET;
    
            //
            //Sanity check for valid cpu and peripheral values
            //
            if (cpu > GPIO_MUX_CPU2CLA || peripheral > 0xF)
                return;
    
            //
            //Create pointers to the appropriate registers. This is a workaround
            //for the way GPIO registers are defined. The standard definition
            //in the header file makes it very easy to do named accesses of one
            //register or bit, but hard to do arbitrary numerical accesses. It's
            //easier to have an array of GPIO modules with identical registers,
            //including arrays for multi-register groups like GPyCSEL1-4. But
            //the header file doesn't define anything we can turn into an array,
            //so manual pointer arithmetic is used instead.
            //
            mux = gpioBaseAddr + GPYMUX + pin32/16;
            gmux = gpioBaseAddr + GPYGMUX + pin32/16;
            csel = gpioBaseAddr + GPYCSEL + pin32/8;
    
            //
            //Now for the actual function
            //
            EALLOW;
    
            //
            //To change the muxing, set the peripheral mux to 0/GPIO first to avoid
            //glitches, then change the group mux, then set the peripheral mux to
            //its target value. Finally, set the CPU select. This procedure is
            //described in the TRM. Unfortunately, since we don't know the pin in
            //advance we can't hardcode a bitfield reference, so there's some
            //tricky bit twiddling here.
            //
            *mux &= ~(0x3UL << (2*pin16));
            *gmux &= ~(0x3UL << (2*pin16));
            *gmux |= (Uint32)((peripheral >> 2) & 0x3UL) << (2*pin16);
            *mux |= (Uint32)(peripheral & 0x3UL) << (2*pin16);
    
            *csel &= ~(0x3L << (4*pin8));
            *csel |= (Uint32)(cpu & 0x3L) << (4*pin8);
    
            //
            //WARNING: This code does not touch the analog mode select registers,
            //which are needed to give the USB module control of its IOs.
            //
            EDIS;
        }
    

    Now I will check the rest of the code.

     

  • Third comment I have is , you need to write to the DEVCFG regs to assign the peripheral to the different cores. In driverlib we have a function for this. I think It is a possibility that the EALLOW protection didnt let you configure the DEVCFGs.

    static inline void
    SysCtl_selectCPUForPeripheral(SysCtl_CPUSelPeripheral peripheral,
                                  uint16_t peripheralInst, SysCtl_CPUSel cpuInst)
    {
        uint32_t tempValue;
        uint16_t shift;
    
        if(SYSCTL_CPUSEL14_DAC == peripheral)
        {
            shift = peripheralInst + SYSCTL_CPUSEL_DAC_S - 1U;
        }
        else
        {
            shift = peripheralInst - 1U;
        }
    
        tempValue =
            HWREG(DEVCFG_BASE + SYSCTL_O_CPUSEL0 + ((uint32_t)peripheral * 2U)) &
            (~((uint32_t)1U << shift));
    
        EALLOW;
        HWREG(DEVCFG_BASE + SYSCTL_O_CPUSEL0 + ((uint32_t)peripheral * 2U)) =
            tempValue | ((uint32_t)cpuInst << shift);
        EDIS;
    }
    

    So maybe this is the problem:

    EALLOW;
    
    //ASSIGN SCIx to CPU2
    DevCfgRegs.CPUSEL5.bit.SCI_A = 1;
    DevCfgRegs.CPUSEL5.bit.SCI_B = 1;
    DevCfgRegs.CPUSEL5.bit.SCI_C = 1;
    DevCfgRegs.CPUSEL5.bit.SCI_D = 1;
    
    EDIS;

  • One last thing before I test on my HW. I do not see any comment mentioning the range for SCIB, can you point it out?

    In my pinmux header file I have,

    #define GPIO_70_GPIO70         0x00860C00U
    #define GPIO_70_EM1D14         0x00860C02U
    #define GPIO_70_EMU0           0x00860C03U
    #define GPIO_70_CANRXA         0x00860C05U
    #define GPIO_70_SCITXDB        0x00860C06U
    #define GPIO_70_SPISOMIC       0x00860C0FU
    
    #define GPIO_71_GPIO71         0x00860E00U
    #define GPIO_71_EM1D13         0x00860E02U
    #define GPIO_71_EMU1           0x00860E03U
    #define GPIO_71_CANTXA         0x00860E05U
    #define GPIO_71_SCIRXDB        0x00860E06U
    #define GPIO_71_SPICLKC        0x00860E0FU

    which clearly points out the SCIB and GPIO70 connection. If you see otherwise in another document please point it out to me.

    Also your two file attachments didnt go through. If you can reattach them that would be ideal.

  • Here is your final solutions.

    1. Calling the following functions,

       GPIO_SetupPinMux(70, GPIO_MUX_CPU2, 6);
       GPIO_SetupPinOptions(70, GPIO_INPUT, GPIO_PUSHPULL);
       GPIO_SetupPinMux(71, GPIO_MUX_CPU2, 6);
       GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_ASYNC);

    does NOT block SCIB to write to the pins. These functions ONLY BLOCK GPIO accesses. Ex. writes to GPIODAT GPIOSET GPIOCLEAR , ... are blocked

    2. What will block CPU1 access to SCIB and the pins? the following line does it.

       EALLOW;
       DevCfgRegs.CPUSEL5.bit.SCI_B = 1;
       EDIS;

    This was tested on my hardware.

    You can use these two files.

    a. CPU1 has access and CAN write: /cfs-file/__key/communityserver-discussions-components-files/171/cpu1_5F00_has_5F00_access_5F00_and_5F00_can_5F00_write.c

    b. CPU1 no access and CANNOT WRITE: /cfs-file/__key/communityserver-discussions-components-files/171/cpu1_5F00_no_5F00_access_5F00_will_5F00_not_5F00_work.c

    Now for a full project to give access to CPU2 and have it write to the pins:

    Please build both CPU1_RAM and CPU2_RAM configurations. Load in the CPU1 .out and run then load the CPU2.out and run.

    Inside each config a macro for each core is defined. (CPU1 and CPU2)

    /cfs-file/__key/communityserver-discussions-components-files/171/scib_5F00_cpu1_5F00_gives_5F00_access_5F00_to_5F00_cpu2.zip

    The code for the correct operation for both CPUs is below.

    //###########################################################################
    // $TI Release: F2837xD Support Library v210 $
    // $Release Date: Tue Nov  1 14:46:15 CDT 2016 $
    // $Copyright: Copyright (C) 2013-2016 Texas Instruments Incorporated -
    //             http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    
    //
    // Included Files
    //
    #include "F28x_Project.h"
    
    #ifdef CPU2
    //
    // Globals
    //
    Uint16 LoopCount;
    Uint16 ErrorCount;
    
    //
    // Function Prototypes
    //
    void scib_loopback_init(void);
    void scib_fifo_init(void);
    void scib_xmit(int a);
    void error();
    #endif
    
    //
    // Main
    //
    void main(void)
    {
    #ifdef CPU2
        Uint16 SendChar;
        Uint16 ReceivedChar;
    #endif
    //
    // Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to
    // default state:
    // This function is found in the F2837xD_SysCtrl.c file.
    //
        InitSysCtrl();
    
    
    #ifdef CPU1
        //
        // Step 2. Initialize GPIO:
        // This example function is found in the F2837xD_Gpio.c file and
        // illustrates how to set the GPIO to it's default state.
        //
           InitGpio();
    
        //
        // For this example, only init the pins for the SCI-A port.
        //  GPIO_SetupPinMux() - Sets the GPxMUX1/2 and GPyMUX1/2 register bits
        //  GPIO_SetupPinOptions() - Sets the direction and configuration of the GPIOS
        // These functions are found in the F2837xD_Gpio.c file.
        //
    
       GPIO_SetupPinMux(70, GPIO_MUX_CPU2, 6);
       GPIO_SetupPinOptions(70, GPIO_INPUT, GPIO_PUSHPULL);
       GPIO_SetupPinMux(71, GPIO_MUX_CPU2, 6);
       GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_ASYNC);
    
       EALLOW;
       DevCfgRegs.CPUSEL5.bit.SCI_B = 1;
       EDIS;
    #endif
    
    //
    // Step 3. Initialize PIE vector table:
    // The PIE vector table is initialized with pointers to shell Interrupt
    // Service Routines (ISR).  The shell routines are found in F2837xD_DefaultIsr.c.
    // Insert user specific ISR code in the appropriate shell ISR routine in
    // the F2837xD_DefaultIsr.c file.
    //
    
    //
    // Disable and clear all CPU __interrupts:
    //
        DINT;
        IER = 0x0000;
        IFR = 0x0000;
    
    //
    // Initialize Pie Control Registers To Default State:
    // This function is found in the F2837xD_PieCtrl.c file.
    //
        InitPieCtrl();  //PIE is not used for this example
    
    //
    // Initialize the PIE Vector Table To a Known State:
    // This function is found in F2837xD_PieVect.c.
    // This function populates the PIE vector table with pointers
    // to the shell ISR functions found in F2837xD_DefaultIsr.c.
    //
        InitPieVectTable();
    
    //
    // Enable CPU and PIE __interrupts
    // This example function is found in the F2837xD_PieCtrl.c file.
    //
        EnableInterrupts();
    
    //
    // Step 4. User specific functions, Reassign vectors (optional),
    // Enable Interrupts:
    //
    #ifdef CPU2
        LoopCount = 0;
        ErrorCount = 0;
    
        scib_fifo_init();       // Initialize the SCI FIFO
        scib_loopback_init();  // Initialize SCI for digital loop back
    
        //
        // Note: Autobaud lock is not required for this example
        //
    
    //
    // Send a character starting with 0
    //
        SendChar = 0;
    
    //
    // Step 5. Send Characters forever starting with 0x00 and going through
    // 0xFF.  After sending each, check the receive buffer for the correct value
    //
        for(;;)
        {
           scib_xmit(SendChar);
    
           //
           // wait for RRDY/RXFFST =1 for 1 data available in FIFO
           //
           while(ScibRegs.SCIFFRX.bit.RXFFST == 0) { }
    
           //
           // Check received character
           //
           ReceivedChar = ScibRegs.SCIRXBUF.all;
           if(ReceivedChar != SendChar)
           {
               error();
           }
    
           //
           // Move to the next character and repeat the test
           //
           SendChar++;
    
           //
           // Limit the character to 8-bits
           //
           SendChar &= 0x00FF;
           LoopCount++;
        }
    #endif
    #ifdef CPU1
    
        ESTOP0;
        while(1);
    
    #endif
    }
    
    #ifdef CPU2
    //
    // error - Function to count errors
    //
    void error()
    {
        ErrorCount++;
    //   asm("     ESTOP0");  // Uncomment to stop the test here
    //   for (;;);
    }
    
    //
    // scib_loopback_init - Configure SCIB settings
    //
    void scib_loopback_init()
    {
        //
        // Note: Clocks were turned on to the SCIB peripheral
        // in the InitSysCtrl() function
        //
    
        ScibRegs.SCICCR.all = 0x0007;  // 1 stop bit,  No loopback
                                       // No parity,8 char bits,
                                       // async mode, idle-line protocol
        ScibRegs.SCICTL1.all = 0x0003; // enable TX, RX, internal SCICLK,
                                       // Disable RX ERR, SLEEP, TXWAKE
        ScibRegs.SCICTL2.all = 0x0003;
        ScibRegs.SCICTL2.bit.TXINTENA = 1;
        ScibRegs.SCICTL2.bit.RXBKINTENA = 1;
        ScibRegs.SCIHBAUD.all = 0x0000;
        ScibRegs.SCILBAUD.all = 0x000F;
        ScibRegs.SCICCR.bit.LOOPBKENA = 0; // Enable loop back
        ScibRegs.SCICTL1.all = 0x0023;     // Relinquish SCI from Reset
    }
    
    //
    // scib_xmit - Transmit a character from the SCI
    //
    void scib_xmit(int a)
    {
        ScibRegs.SCITXBUF.all=a;
    }
    
    //
    // scib_fifo_init - Initialize the SCI FIFO
    //
    void scib_fifo_init()
    {
        ScibRegs.SCIFFTX.all = 0xE040;
        ScibRegs.SCIFFRX.all = 0x2044;
        ScibRegs.SCIFFCT.all = 0x0;
    }
    #endif
    //
    // End of file
    //
    

  • Hello Nima,

    It is already working. Apparently the problem was some missing initialization in CPU1 (InitPieVectTable() and EnableInterrupts()) and in CPU2 (InitSysCtrl()). I hadn't initialized those modules based on some controlSUITE examples I saw.

    Thank you!

    Best regards,

    Adria