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/DK-TM4C129X: Not able to write members of a char* array to the Display

Part Number: DK-TM4C129X

Tool/software: Code Composer Studio

Hi there,

I'm working with the DK-TM4C129X. For a simple IO tester i would like to write on the Display the name of the signal under Test.

So I defined a const char* array of the signal names and a counter, which indicates, which signal is under test.

If I try to debug the software, the MCU crashed during the FrameDraw function und stuck in the FaultISR routine.

When I replace sig[counter] with sig[8] or sig[0] in the GrStringDrawCentered function, it will work. Of course just printing always the same string.

Thanks for the Answer

Benjamin

Begin of the code:

int
main(void)
{

    //Start Test code
    volatile uint32_t ui32Loop;

    //char *test = "";

    const char* sig [] = {"FpgaMdprt1v8io[0]",
                    "FpgaMdprt1v8io[1]",
                    "FpgaMdprt1v8io[2]",
                    "FpgaMdprt1v8io[3]",
                    "FpgaMdprt1v8io[4]",
                    "FpgaMdprt1v8io[5]",
                    "FpgaMdprt1v8io[6]",
                    "FpgaMdprt1v8io[7]",
                    "FpgaMdprt1v8io[8]",
                    "FpgaMdprt1v8io[9]",
                    "FpgaMdprt1v8io[10]",
                    "FpgaMdprt1v8io[11]",
                    "FpgaTdprt1v8io[0]",
                    "FpgaTdprt1v8io[1]",
                    "FpgaTdprt1v8io[2]",
                    "FpgaTdprt1v8io[3]",
                    "CpldMdprt1v8io[0]",
                    "CpldMdprt1v8io[1]",
                    "FpgaMdprt1v8io[16] to [22]",
                    "FpgaMdprt1v8io[17] to [26]",
                    "FpgaMdprt1v8io[18] to [24]",
                    "FpgaMdprt1v8io[19] to [25]",
                    "FpgaMdprt1v8io[20] to [23]",
                    "FpgaMdprt1v8io[21] to [27]",
                    "FpgaTdprt1v8io[8] to [12]",
                    "FpgaTdprt1v8io[9] to [13]",
                    "FpgaTdprt1v8io[10] to [11]"};

    uint32_t PORT[] = {
                  GPIO_PORTK_BASE,
                  GPIO_PORTH_BASE,
                  GPIO_PORTK_BASE,
                  GPIO_PORTH_BASE,
                  GPIO_PORTG_BASE,
                  GPIO_PORTH_BASE,
                  GPIO_PORTG_BASE,
                  GPIO_PORTH_BASE,
                  GPIO_PORTK_BASE,
                  GPIO_PORTC_BASE,
                  GPIO_PORTK_BASE,
                  GPIO_PORTM_BASE,
                  GPIO_PORTM_BASE,
                  GPIO_PORTF_BASE,
                  GPIO_PORTF_BASE,
                  GPIO_PORTG_BASE,
                  GPIO_PORTA_BASE,
                  GPIO_PORTN_BASE,
                  GPIO_PORTG_BASE,
                  GPIO_PORTA_BASE,
                  GPIO_PORTM_BASE,
                  GPIO_PORTN_BASE,
                  GPIO_PORTP_BASE,
                  GPIO_PORTQ_BASE,
                  GPIO_PORTG_BASE,
                  GPIO_PORTQ_BASE,
                  GPIO_PORTG_BASE};

    uint8_t PIN[] = {
                 GPIO_PIN_5,
                 GPIO_PIN_0,
                 GPIO_PIN_4,
                 GPIO_PIN_1,
                 GPIO_PIN_4,
                 GPIO_PIN_2,
                 GPIO_PIN_5,
                 GPIO_PIN_3,
                 GPIO_PIN_6,
                 GPIO_PIN_7,
                 GPIO_PIN_7,
                 GPIO_PIN_7,
                 GPIO_PIN_6,
                 GPIO_PIN_3,
                 GPIO_PIN_2,
                 GPIO_PIN_7,
                 GPIO_PIN_7,
                 GPIO_PIN_4,
                 GPIO_PIN_2,
                 GPIO_PIN_6,
                 GPIO_PIN_4,
                 GPIO_PIN_6,
                 GPIO_PIN_0,
                 GPIO_PIN_5,
                 GPIO_PIN_3,
                 GPIO_PIN_6,
                 GPIO_PIN_6};

    uint32_t counter = 0;

    //
    // Configure the device pins.
    //


    //
    // Enable the GPIO port that is used for the on-board LED.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);



    //
    // Check if the peripheral access is enabled.
    //
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOQ))
    {
    }


    for(counter = 0; counter <= 26; counter++)
    {
        GPIOPinTypeGPIOOutput(PORT[counter], PIN[counter]);
    }
    GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_1);
    GPIOPinTypeGPIOOutput(GPIO_PORTJ_BASE, GPIO_PIN_7);
    GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_0);

    //
    // Loop forever.
    //

    //--
    tContext sContext;
    uint32_t ui32SysClock;
    PinoutSet();

    //
    // Run from the PLL at 120 MHz.
    //
    ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                                           SYSCTL_CFG_VCO_480), 120000000);




    while(1)
    {
        GPIOPinWrite(GPIO_PORTJ_BASE, GPIO_PIN_7, GPIO_PIN_7);
        GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_0, GPIO_PIN_0);
        //
        // Turn on the LED.
        //
        for (counter = 0; counter <= 26; counter++)
        {
            GPIOPinWrite(PORT[counter], PIN[counter], PIN[counter]);
            BtnSelPosEdge();
            GPIOPinWrite(PORT[counter], PIN[counter], 0x0);
            //WriteToDisplay(ui32SysClock, sContext);

            Kentec320x240x16_SSD2119Init(ui32SysClock);
            GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
            FrameDraw(&sContext, "Test");
            GrContextFontSet(&sContext, g_psFontCm20);

            GrStringDrawCentered(&sContext, sig[counter], -1,
                                 GrContextDpyWidthGet(&sContext) / 2,
                                 ((GrContextDpyHeightGet(&sContext) - 32) / 2) + 24,
                                 0);

            //
            // Flush any cached drawing operations.
            //
            GrFlush(&sContext);

        }