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: LINREG2 TX/RX pins not pulled up

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN,

Hi,

I am trying to use LIN2 TX/RX pins (T5/P4) as a slave node pins. However, when I connect the oscilloscope, I see these pins are not pulled up in spite of selecting the pullup checkbox in HALCoGen. Here is the relevant lines from the lin.c file:

    /** - Release from reset */
    linREG2->GCR0 = 1U;

    /** - Start LIN configuration
    *     - Keep state machine in software reset
    */
    linREG2->GCR1 = 0U;

    /**   - Enable LIN Mode */
    linREG2->GCR1 = 0x40U;
    
    /** - Setup control register 1
    *     - Enable transmitter
    *     - Enable receiver
    *     - Stop when debug mode is entered
    *     - Disable Loopback mode
    *     - Disable / Enable HGENCTRL (Mask filtering with ID-Byte)
    *     - Use enhance checksum
    *     - Enable multi buffer mode
    *     - Disable automatic baudrate adjustment
    *     - Disable sleep mode
    *     - Set LIN module as master
    *     - Enable/Disable parity
    *     - Disable data length control in ID4 and ID5
    */
    linREG2->GCR1 |= 0x03000C60U
                 | (uint32)((uint32)1U << 12U)
                 | (uint32)((uint32)0U << 2U);
                    
    /** - Setup maximum baud rate prescaler */
    linREG2->MBRSR = (uint32)5155U;

    /** - Setup baud rate prescaler */
    linREG2->BRS = (uint32)357U;

    /** - Setup RX and TX reception masks */
    linREG2->MASK = ((uint32)((uint32)0xFFU << 16U) | (uint32)0xFFU);

    /** - Setup compare
    *     - Sync delimiter
    *     - Sync break extension
    */
    linREG2->COMP = ((uint32)((uint32)(1U - 1U) << 8U) | ((uint32)13U - 13U));

    /** - Setup response length */
    linREG2->FORMAT = ((linREG2->FORMAT & 0xFFF8FFFFU) | (uint32)(((uint32)8U - 1U) << 16U));

    /** - Set LIN pins functional mode
    *     - TX
    *     - RX
    *     - CLK
    */
    linREG2->PIO0 = ((uint32)4U | (uint32)2U | (uint32)0U);

    /** - Set LIN pins default output value
    *     - TX
    *     - RX
    *     - CLK
    */
    linREG2->PIO3 = ((uint32)0U | (uint32)0U | (uint32)0U);

    /** - Set LIN pins output direction
    *     - TX
    *     - RX
    *     - CLK
    */
    linREG2->PIO1 = ((uint32)0U | (uint32)0U | (uint32)0U);

    /** - Set LIN pins open drain enable
    *     - TX
    *     - RX
    *     - CLK
    */
    linREG2->PIO6 = ((uint32)0U | (uint32)0U | (uint32)0U);

    /** - Set LIN pins pullup/pulldown enable
    *     - TX
    *     - RX
    *     - CLK
    */
    linREG2->PIO7 = ((uint32)0U | (uint32)0U | (uint32)0U);

    /** - Set LIN pins pullup/pulldown select
    *     - TX
    *     - RX
    *     - CLK
    */
    linREG2->PIO8 = ((uint32)4U | (uint32)2U | (uint32)1U);

    /** - Set interrupt level
    *     - Bit error level
    *     - Physical bus error level
    *     - Checksum error level
    *     - Inconsistent sync field error level
    *     - No response error level
    *     - Framing error level
    *     - Overrun error level
    *     - Parity error level
    *     - Identifier level
    *     - RX level
    *     - TX level
    *     - Timeout after 3 wakeup signals level
    *     - Timeout after wakeup signal level
    *     - Timeout level
    *     - Wakeup level
    *     - Break detect level
    */
    linREG2->SETINTLVL = ((uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U
                       | (uint32)0x00000000U);

    /** - Set interrupt enable
    *     - Enable/Disable bit error
    *     - Enable/Disable physical bus error level
    *     - Enable/Disable checksum error level
    *     - Enable/Disable inconsistent sync field error level
    *     - Enable/Disable no response error level
    *     - Enable/Disable framing error level
    *     - Enable/Disable overrun error level
    *     - Enable/Disable parity error level
    *     - Enable/Disable identifier level
    *     - Enable/Disable RX level
    *     - Enable/Disable TX level
    *     - Enable/Disable timeout after 3 wakeup signals level
    *     - Enable/Disable timeout after wakeup signal level
    *     - Enable/Disable timeout level
    *     - Enable/Disable wakeup level
    *     - Enable/Disable break detect level
    */
    linREG2->SETINT = ((uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000200U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U
                    | (uint32)0x00000000U);

    /** - Finaly start LIN */
    linREG2->GCR1 |= 0x00000080U;
    

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

Is it setup correctly? If yes why it is not pulled up?

Thanks,

SA

  • Hello SA,

    The LIN2 RX and TX pins are muxed behind some NHET functional pins, have you checked to insure you have configured the PINMUX tab so that these functions are brought to the pins instead of the default NHET functions? Also, when configurred in functional mode, the pullups will be configured by default and there should be no need to re-configure them using the PIO registers. In fact, once configured to functional mode, I believe the PIO registers are ignored.

    If you would like for me to take a look at your setup, please post your hcg project file and I can import it to verify the configuration settings.
  • Thanks. I found them on PINMUX tab. But do you know which files change? I have an older project generated with another version of HALCoGen and would like to only import these changes to that one (i.e. copy/paste).

    Thanks,

    SA

  • I was too fast in answering, I have checked the project and they are enabled in PINMUX. Why aren't they pulledup then?

    Should I select the pullup for HET19 and HET20 in HET2 tab as well? (I am not sure if HET and NHET are the same?)

    I have attachef the .hcg and .dil files.0882.pr.tar

    Thanks

  • Hello SA,

    Sorry for the delay in getting back to your post. I had a look at your hcg setup and, although there is a conflict on 2 pins, I don't believe these should affecting the selection of the LIN2TX and LIN2RX pin functionality.

    Can you have a look at the HL_pinmux.c file and see how the pinmux register is being written the applicable pinmux register is PINMUX[36]. It should be as shown below:

    pinMuxReg->PINMUX[36] = PINMUX_BALL_P4_LIN2RX | PINMUX_BALL_T5_LIN2TX | PINMUX_BALL_T4_MII_RXCLK | PINMUX_BALL_U7_MII_TX_CLK;


    As you can see, the #defines for PINMUX_BALL_P4_LIN2RX and PINMUX_BALL_T5_LIN2TX are setting the bits to select these outputs on the associated balls. Your code should have the same. If not, then they are not getting initialized properly.

  • Hello,

    I checked my HL_pinmux.c and the pinMuxReg[36], and it is as you wrote here. So that can't be the problem. My colleague suggested that these LIN pins are not connected from the TMS570LC4357 to the development board's pins P4 and T5. So even if they are named the same, there is no real connection.

    Best,

    SA