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.

CCS/TMS320F280049: Problems writing to GPAMUX1 register

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hello,

I want to set up a SCI connection with a custom board powered by TMS320F280049 in the 64pin package.

I tried to set up SCIA on GPIO2 and GPIO3, but I always get an error while uploading the code to the Microcontroller.

My code is basically the SCI Example Code from C2000Ware, but I changed the Part where the GPIO Settings are made.

The error occures when im trying to write to the GPAMUX1 registers (Line 29 and 33). If I delete this lines, there is no problem uploading the code.

void main(void)
{
    uint16_t ReceivedChar;
    unsigned char *msg;

    //
    // Initialize device clock and peripherals
    //
    InitSysCtrl();

    //
    // Initialize GPIO
    //
    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 GPIOs
    // These functions are found in the F28X7x_Gpio.c file.
    //

    EALLOW;

    GpioCtrlRegs.GPAMUX1.all = 0x00;

    GpioCtrlRegs.GPAPUD.bit.GPIO2 = 0;   // Enable pullup on GPIO2

    GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 0x9;  // GPIO2 = SCITXDA

    GpioCtrlRegs.GPAPUD.bit.GPIO3 = 0;   // Enable pullup on GPIO3
    GpioCtrlRegs.GPAQSEL1.bit.GPIO3 = 3; // Asynch input
    GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 0x9;  // GPIO3 = SCIRXDA


    EDIS;
    //
    // Disable CPU interrupts
    //
    DINT;

    //
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    //
    InitPieCtrl();

    //
    // Disable CPU interrupts and clear all CPU interrupt flags
    //
    IER = 0x0000;
    IFR = 0x0000;

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR)
    //
    InitPieVectTable();

    loopCounter = 0;

    initSCIAFIFO();                         // Initialize the SCI FIFO
    initSCIAEchoback();                     // Initialize SCI for echoback

    msg = "\r\n\n\nHello World!\0";
    transmitSCIAMessage(msg);

    msg = "\r\nYou will enter a character, and the DSP will echo it back! \n\0";
    transmitSCIAMessage(msg);

    for(;;)
    {
        msg = "\r\nEnter a character: \0";
        transmitSCIAMessage(msg);

        //
        // Wait for character
        //
        while(SciaRegs.SCIFFRX.bit.RXFFST == 0)
        {

        } // wait for empty state

        //
        // Get character
        //
        ReceivedChar = SciaRegs.SCIRXBUF.all;

        //
        // Echo character back
        //
        msg = "  You sent: \0";
        transmitSCIAMessage(msg);
        transmitSCIAChar(ReceivedChar);

        loopCounter++;
    }
}

This is the error:

C28xx_CPU1: Error: (Error -1135 @ 0x0) The debug probe reported an error. Confirm debug probe configuration and connections, reset the debug probe, and retry the operation. (Emulation package 8.0.903.2)
C28xx_CPU1: Trouble Halting Target CPU: (Error -1044 @ 0x0) The debug probe reported an error. Confirm debug probe configuration and connections, reset the debug probe, and retry the operation. (Emulation package 8.0.903.2)
C28xx_CPU1: Error: (Error -1135 @ 0x0) The debug probe reported an error. Confirm debug probe configuration and connections, reset the debug probe, and retry the operation. (Emulation package 8.0.903.2)
C28xx_CPU1: Unable to determine target status after 20 attempts
C28xx_CPU1: Failed to remove the debug state from the target before disconnecting.  There may still be breakpoint op-codes embedded in program memory.  It is recommended that you reset the emulator before you connect and reload your program before you continue debugging

Thanks in advance Sebastian

  • Ok,
    I figured out, that I have to set GPAGMUX1 and GPAMUX1 together to achieve muxing state 9.
    The error while uploading is gone, but the code still doesn't work properly. GPIO 2 and 3 just stay HIGH all the time.
  • hi Sebastian ,

    Why aren't you using the below common APIs?

    GPIO_SetupPinMux() - Sets the GPxMUX1/2 and GPyMUX1/2 register bits or the
    GPIO_SetupPinOptions() - Sets the direction and configuration of GPIOs functions found in the F28X7x_Gpio.c file.

    These will take care of the configuring all the needed internally .

    "I tried to set up SCIA on GPIO2 and GPIO3" -> These GPIOs cannot be used as SCI pins .
    Please check Table 7-8. GPIO Muxed Pins for details on the same .

    Eg. below.
    GPIO_SetupPinMux(28, GPIO_MUX_CPU1, 1);
    GPIO_SetupPinOptions(28, GPIO_INPUT, GPIO_PUSHPULL);
    GPIO_SetupPinMux(29, GPIO_MUX_CPU1, 1);
    GPIO_SetupPinOptions(29, GPIO_OUTPUT, GPIO_ASYNC);

    Regards.
  • Thanks for the answer,

    The TMS320F280049 should support SCI on GPIO2,3 reffereing to the datasheet.

    http://www.ti.com/lit/ds/symlink/tms320f280049.pdf

    I am not using the API, because I had some trouble with it.

    To use InitSysCtrl() for example, I had to delete a lot of the lines for activating periphal clocks in InitPeriphalClocks();

    I think the 64pin version does not support all registers, the bigger versions support.

    Is there maybe a way to tell the API which package I use?

    MEGHANA MANAVAZHI said:



    Please check Table 7-8. GPIO Muxed Pins for details on the same .


    Where can I find this table?

    Table 8.5 in the Technical refference tells me the same as the Datasheet.

  • Hi Sebastian ,

    My apologies.  I guess i checked the TRM of another device family.

    You are right. You should be able to use the GPIO2 and GPIO3 as per Table 8-5. GPIO Muxed Pins of the TRM .

    Please use the below configurations and let me know if it works.

    GPIO_SetupPinMux(3, GPIO_MUX_CPU1, 9);

    GPIO_SetupPinOptions(3, GPIO_INPUT, GPIO_PUSHPULL);

    GPIO_SetupPinMux(2, GPIO_MUX_CPU1, 9);

    GPIO_SetupPinOptions(2, GPIO_OUTPUT, GPIO_ASYNC);

    The APIs like InitSysCtrl()  are written keeping the superset device in mind .

    The only differentiation we have is based on the configurations for Launchpad vs the controlcard in the driverlib variant of examples.

    C2000Ware\device_support\f28004x\examples

    But not based on the packages.

    Regards.

  • Hi Meghana,

    Using your code, its now working!

    There was also an mistake in my PCB Layout, that probably effected the SCI_TX Pins...

    Thank you for your help

    Sebastian