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.

TMS570LS1227: error _dabort when trying to control ECLK as GPIO

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Hello,

I have a board with a debug LED in ECLK pin. I configured it as GPIO, and I configured it properly in HALCoGen. I did it properly because I read other threads in the forum and if I set the default value to 0 or 1 and recompile, the LED is ON or OFF, so it seems the GPIO functionality is ok.

My problem is that system resets when I try to modify the pin logic level within the code.

I tried to use gioSetBit(systemPORT, 0, xxx), as states in the HAL, but it failed. I then tried to directly access to systemREG1->SYSPC4 as HAL does in systemInit, and it failed again.

Is there any configuration I am doing wrong? Is there anything else I should take into account?

<MY CODE>

void setDebugLed(uint8_t led, uint32_t on)
{
    if(led == 1)
    {
        gioSetBit(LED_DEBUGOUT1_PORT, LED_DEBUGOUT1_PIN, on);
    }
    else if(led == 2)
    {
        if(on != 0)
            gioSetBit(systemPORT, 0, 1);
        else
            gioSetBit(systemPORT, 0, 0);
    }
}

</MY CODE>

<CODE GENERATED BY HAL>

/* USER CODE BEGIN (24) */
/* USER CODE END */

/** - set ECLK pins functional mode */
systemREG1->SYSPC1 = 0U;

/** - set ECLK pins default output value */
systemREG1->SYSPC4 = 1U;

/** - set ECLK pins output direction */
systemREG1->SYSPC2 = 0U;

/** - set ECLK pins open drain enable */
systemREG1->SYSPC7 = 0U;

/** - set ECLK pins pullup/pulldown enable */
systemREG1->SYSPC8 = 1U;

/** - set ECLK pins pullup/pulldown select */
systemREG1->SYSPC9 = 0U;

/** - Setup ECLK */
systemREG1->ECPCNTL = (uint32)((uint32)0U << 24U)
| (uint32)((uint32)1U << 23U)
| (uint32)((uint32)(8U - 1U) & 0xFFFFU);

/* USER CODE BEGIN (25) */
/* USER CODE END */

</CODE GENERATED BY HAL>

  • I was doing several tests and the HAL code I copy-pasted had the pin set as input, but I have the pin properly set as an output.

    Actually, the configurations are: PinMode GPIO, DOUT = 1, DIR as output, PushPull driver, no PullDown nor Up.

    /* USER CODE BEGIN (24) */
    /* USER CODE END */

    /** - set ECLK pins functional mode */
    systemREG1->SYSPC1 = 0U;

    /** - set ECLK pins default output value */
    systemREG1->SYSPC4 = 1U;

    /** - set ECLK pins output direction */
    systemREG1->SYSPC2 = 1U;

    /** - set ECLK pins open drain enable */
    systemREG1->SYSPC7 = 0U;

    /** - set ECLK pins pullup/pulldown enable */
    systemREG1->SYSPC8 = 1U;

    /** - set ECLK pins pullup/pulldown select */
    systemREG1->SYSPC9 = 0U;

    /** - Setup ECLK */
    systemREG1->ECPCNTL = (uint32)((uint32)0U << 24U)
    | (uint32)((uint32)0U << 23U)
    | (uint32)((uint32)(8U - 1U) & 0xFFFFU);

    /* USER CODE BEGIN (25) */
    /* USER CODE END */

  • You can use gioSetBit(systemPORT, 0, x) to set bit for ECLK pin if it is configured as GPIO pin. I will do a test, and come back to you later.

  • It works without any issue:

  • It should work as you say, but I get a _dabort exception. If I debug, _dabort happens when I try to access port->DSET or port->DCLR when using systemPORT.

    I thought it may be a MPU configuration, but I unchecked "Enable MPU" and "Enable MPU Background Region" and dabort still happens...

    Is there any AN where _dabort exception causes are fully explained?

  • Hi David,

    Please check the value of the Data Fault Status Register (DFSR) of the Cortex-R CPU. It is one CP15 register. CCS-->View-->Registers-->CP15-->DFSR