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.

TMS570LC4357: HALCoGen does not set PSL bit for N2HET2[22] despite pull-up selection in UI (TMS570LC4357)

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Good morning,

I am working with TMS570LC4357 (part: TMS5704357BZWTQQ1) and HALCoGen v04.07.01

I am using HALCoGen to configure various N2HET2 pins as inputs with pull-ups. I observed unexpected behavior for N2HET2[22], where pull-up selection in UI is not reflected in generated register configuration. 

Steps to reproduce: 

  1. Create new/clean HALCoGen project, Device: TMS570LC4357ZWT
  2. Navigate to 'HET2' tab, then to 'Pin 16-23' tab
  3. Scroll to Bit 22, select checkbox for 'Bit 22 Pullup', observe label HET2[22]
  4. Save project, generate code
  5. Navigate to HL_het.c
  6. Observe hetREG2->PSL = 0 (see line 2602)
  7. Inspect [projectname].dil
  8. Observe 
    DRIVER.HET.VAR.HET2_BIT22_PULDIS.VALUE=0x00000000, 
    DRIVER.HET.VAR.HET2_BIT22_PULL.VALUE=2,  DRIVER.HET.VAR.HET2_BIT22_PSL.VALUE=0x00000000

As you can see, PULL.VALUE is 2 (expected when selecting pullup), but PSL.VALUE is still 0. 

Additionally, I returned to the UI and selected pull up configuration for bits 21, 22, 23. I saw expected behavior for PSL value regarding bits 21 and 23. So, this seems to be specific to N2HET2[22].

I will add user code to force this pullup select, for now.

Thank you,

Savanah Evans

  • Hi Savanah,

    We have one internal AI, which can analyze all the documents and data related to this device. And i got some suggestions from the AI tool, first i would suggest you refer these suggestions.

    # Analysis and Confirmation

    You've discovered what appears to be a **HALCoGen bug specific to N2HET2[22]**. Your investigation is thorough and clearly demonstrates the issue:

    ## The Problem
    - **UI Setting**: HET2[22] Pullup checkbox is selected
    - **DIL File**: Shows `HET2_BIT22_PULL.VALUE=2` (correct - pullup selected)
    - **Generated Code**: `hetREG2->PSL = 0` (incorrect - bit 22 should be set)
    - **Adjacent Pins**: HET2[21] and HET2[23] work correctly

    This indicates the HALCoGen code generation engine has a bug in translating the HET2[22] pullup configuration to the PSL register value.

    ## Recommended Workaround

    Since you need to modify the generated code anyway, here's the cleanest approach:

    ### Option 1: Modify in user code section of `HL_het.c`
    ```c
    /* USER CODE BEGIN (2) */
    /* Workaround for HALCoGen bug - HET2[22] pullup not generated correctly */
    hetREG2->PSL |= (1U << 22U); /* Enable pullup for HET2[22] */
    /* USER CODE END */
    ```

    ### Option 2: Create a custom initialization function
    In your application code (not generated code):
    ```c
    void applyHET2PullupFix(void)
    {
    /* HALCoGen v04.07.01 bug workaround for HET2[22] */
    hetREG2->PSL |= (1U << 22U);
    }
    ```

    Call this after `hetInit()`.

    ## Reporting the Issue

    I recommend reporting this to TI through:
    - **E2E Forums**: e2e.ti.com/.../
    - **TI Support**: Direct support ticket

    Include your findings:
    - HALCoGen version: v04.07.01
    - Device: TMS570LC4357ZWT (TMS5704357BZWTQQ1)
    - Affected pin: N2HET2[22] only
    - Issue: PSL register bit not set despite UI configuration

    ## Additional Verification

    You might also want to verify the PULDIS register is correctly set to 0 (pullup/pulldown enabled, not disabled):

    ```
    /* Verify pullup is not disabled */
    hetREG2->PULDIS &= ~(1U << 22U); /* Ensure pull is enabled */
    hetREG2->PSL |= (1U << 22U); /* Select pullup */
    ```

    This is a clear code generation defect in HALCoGen for this specific pin. Your workaround approach is correct.

    --
    Thanks & regards,
    Jagadish.