Issues regarding configuration of UART

Hi all,

I have UART configured in my project but it seems like RX is influenced by TX.

I have IMX8QM running TorizonCore 5.7.2 on Ixora Carrier Board V1.2

I am using Pin 31 UART4_TXD and Pin 30 UART4_RXD on Ixora X27 Connector - which are Pin 138 and 140 in IMX8’s X1 Connector, respectively.

The UART is configured as below:
pin_mux.c:

void BOARD_InitPins(sc_ipc_t ipc)
{
  sc_err_t err = SC_ERR_NONE;
  err = sc_pad_set_all(ipc, BOARD_INITPINS_BB_UART2_TX_PIN_FUNCTION_ID, 1U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x0 ,SC_PAD_WAKEUP_OFF);
  if (SC_ERR_NONE != err)
  {
    assert(false);
  }
  err = sc_pad_set_all(ipc, BOARD_INITPINS_BB_UART2_RX_PIN_FUNCTION_ID, 1U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x0 ,SC_PAD_WAKEUP_OFF);
  if (SC_ERR_NONE != err)
  {
    assert(false);
  }
}

pin_mux.h:

#define BOARD_INITPINS_BB_UART2_RX_PIN_FUNCTION_ID              SC_P_LVDS0_I2C1_SDA
#define BOARD_INITPINS_BB_UART2_TX_PIN_FUNCTION_ID              SC_P_LVDS0_I2C1_SCL

lpuart_confg.c:

#define TMC_LPUART          DMA__LPUART2
#define TMC_LPUART_CLKSRC   kCLOCK_DMA_Lpuart2
#define TMC_LPUART_CLK_FREQ CLOCK_GetIpFreq(kCLOCK_DMA_Lpuart2)

#define TMC_LPUART_TX_DMA_CHANNEL       17U
#define TMC_LPUART_RX_DMA_CHANNEL       16U
#define LPUART_DMA_BASEADDR DMA__EDMA0

lpuart_config.c:

void LPUART_EDMA_Config(sc_ipc_t ipc)
{

    lpuart_config_t tmc_lpuartConfig;
    lpuart_config_t test_lpuartConfig;

    edma_config_t config;
    uint32_t tmc_uart_freq;


         /* Power on TMC LPUART for M4. */
    if (sc_pm_set_resource_power_mode(ipc, SC_R_UART_2, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
    {
        assert(false);
    }
    if (sc_pm_set_resource_power_mode(ipc, SC_R_DMA_0_CH16, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
    {
        assert(false);
    }
    if (sc_pm_set_resource_power_mode(ipc, SC_R_DMA_0_CH17, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
    {
        assert(false);
    }

    /* Set tmc UART Clock frequency */
    tmc_uart_freq = CLOCK_SetIpFreq(TMC_LPUART_CLKSRC, SC_133MHZ);
    if (tmc_uart_freq == 0)
    {
        assert(tmc_uart_freq);
    }
    LPUART_GetDefaultConfig(&tmc_lpuartConfig);
    tmc_lpuartConfig.baudRate_Bps = 256000 ;
    tmc_lpuartConfig.enableTx     = true;
    tmc_lpuartConfig.enableRx     = true;

    LPUART_Init(TMC_LPUART, &tmc_lpuartConfig, TMC_LPUART_CLK_FREQ);

    /* Init the EDMA module */
    EDMA_GetDefaultConfig(&config);
    EDMA_Init(LPUART_DMA_BASEADDR, &config);
    EDMA_CreateHandle(&g_tmc_lpuartTxEdmaHandle, LPUART_DMA_BASEADDR, TMC_LPUART_TX_DMA_CHANNEL);
    EDMA_CreateHandle(&g_tmc_lpuartRxEdmaHandle, LPUART_DMA_BASEADDR, TMC_LPUART_RX_DMA_CHANNEL);

    LPUART_TransferCreateHandleEDMA(TMC_LPUART, &g_tmc_lpuartEdmaHandle, TMC_LPUART_UserCallback, NULL, &g_tmc_lpuartTxEdmaHandle,
                                    &g_tmc_lpuartRxEdmaHandle);
}

Do you have any clue what would be the issue here?

Thank you in advance
Samir

Hi @hajili!

Thanks for reaching out to Toradex Community :slight_smile:

Before addressing your question directly, I would like to ask: have you gone through the articles related to Cortex-M from Heterogeneous Multi-core Processing (HMP) Documentation Overview | Toradex Developer Center?

More specifically, the article How to Run a Hello World on the Cortex-M | Toradex Developer Center teaches how to address the modifications needed to use an UART interface.

Did you apply the analogous steps to your case? By reading the article, you will find out the related modifications that might be needed both on Linux and Cortex-M side.

Best regards,