TDA4VH-Q1: Enabling UART debug from mcu2_0 in IPC example

Part Number: TDA4VH-Q1

Tool/software:

Hello experts,

I am trying to get some serial debug console output from the IPC examples.

* SDK 9
* Custom board where main_uart7 should be attached to mcu2_0.
* Using ipc_echo_test_freertos as test application

What I've done:

* Stripped the pinmux to only include the UART7:

static pinmuxPerCfg_t gUart7PinCfg[] =
{
    /* MyUART7 -> UART7_RTSn -> R24 */
    {
        PIN_MMC1_DAT0, PIN_MODE(1) | \
        ((PIN_PULL_DISABLE) & (~PIN_PULL_DIRECTION & ~PIN_INPUT_ENABLE))
    },
    /* MyUART7 -> UART7_RXD -> R26 */
    {
        PIN_MMC1_DAT3, PIN_MODE(1) | \
        ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
    },
    /* MyUART7 -> UART7_TXD -> R25 */
    {
        PIN_MMC1_DAT2, PIN_MODE(1) | \
        ((PIN_PULL_DISABLE) & (~PIN_PULL_DIRECTION & ~PIN_INPUT_ENABLE))
    },
    {PINMUX_END}
};


static pinmuxModuleCfg_t gUartPinCfg[] =
{
    {7, 1, gUart7PinCfg},
    {PINMUX_END}
};
pinmuxBoardCfg_t gJ721E_MainPinmuxData[] =
{
    {0, gUartPinCfg},
    // {0, gDebugssPinCfg},
    // {1, gDpPinCfg},
    // {2, gGpioPinCfg},
    // {3, gI2cPinCfg},
    // {4, gMcanPinCfg},
    // {5, gMdioPinCfg},
    // {6, gMlbPinCfg},
    // {7, gMmcsdPinCfg},
    // {8, gSystemPinCfg},
    // {9, gUartPinCfg},
    // {10, gUsbPinCfg},
    // {11, gMcaspPinCfg},
    {PINMUX_END}
};

pinmuxBoardCfg_t gJ721E_WkupPinmuxData[] =
{
    // {0, gMcu_i2cPinCfg},
    // {1, gMcu_i3cPinCfg},
    // {2, gMcu_mcanPinCfg},
    // {3, gMcu_mdioPinCfg},
    // {4, gMcu_fss0_ospiPinCfg},
    // {5, gMcu_rgmiiPinCfg},
    // {6, gMcu_uartPinCfg},
    // {7, gWkup_debugssPinCfg},
    // {8, gWkup_gpioPinCfg},
    // {9, gWkup_i2cPinCfg},
    // {10, gWkup_systemPinCfg},
    // {11, gWkup_uartPinCfg},
    // {12, gMcu_adcPinCfg},
    {PINMUX_END}
};

pinmuxBoardCfg_t gJ721E_WkupPinmuxDataHpb[] =
{
    // {0, gMcu_fss0_hpbPinCfg},
    {PINMUX_END}
};
* Edited the ipc_trace.c file to always print debug on UART:
int32_t Ipc_Trace_printf(const char *format, ...)
{
    char buffer[IPC_TRACE_MAX_LINE_LENGTH];
    va_list args;
    uint8_t i = 0;

    va_start(args, format);
    vsprintf(buffer, format, args);
    va_end(args);
// #if defined(ENABLE_UART_PRINT)
    if(gBoardinit==1)
    {
        UART_printf("%s\n",buffer);
    }
   
// #endif
    for (i = 0; i < strlen(buffer); i++)
    {
        Ipc_traceBuffer[gTraceBufIndex++] = buffer[i];

        if (gTraceBufIndex == IPC_TRACE_BUFFER_MAX_SIZE) {
            gTraceBufIndex = 0;
        }
    }
    return 0;
}
With the last change, the rproc is not working:
root@AS-P-3-340009:~# ./rpmsg_char_simple -r 2 -n 10
_rpmsg_char_find_ctrldev: could not find the matching rpmsg_ctrl device for virtio0.rpmsg_chrdev.-1.14
Can't create an endpoint device: Invalid argument
TEST STATUS: FAILED
root@AS-P-3-340009:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
Without the UART_printf function, it works:
root@AS-P-3-340009:~# ./rpmsg_char_simple -r 2 -n 10
Created endpt device rpmsg-char-2-551, fd = 4 port = 1025
Exchanging 10 messages with rpmsg device rpmsg-char-2-551 on rproc id 2 ...

Sending message #0: hello there 0!
Received message #0: round trip delay(usecs) = 229030
hello there 0!
Sending message #1: hello there 1!
Received message #1: round trip delay(usecs) = 116940
hello there 1!
Sending message #2: hello there 2!
Received message #2: round trip delay(usecs) = 107650
hello there 2!
Sending message #3: hello there 3!
Received message #3: round trip delay(usecs) = 94695
hello there 3!
Sending message #4: hello there 4!
Received message #4: round trip delay(usecs) = 93935
hello there 4!
Sending message #5: hello there 5!
Received message #5: round trip delay(usecs) = 91095
hello there 5!
Sending message #6: hello there 6!
Received message #6: round trip delay(usecs) = 91130
hello there 6!
Sending message #7: hello there 7!
Received message #7: round trip delay(usecs) = 94775
hello there 7!
Sending message #8: hello there 8!
Received message #8: round trip delay(usecs) = 91645
hello there 8!
Sending message #9: hello there 9!
Received message #9: round trip delay(usecs) = 108880
hello there 9!

Communicated 10 messages successfully on rpmsg-char-2-551

TEST STATUS: PASSED
root@AS-P-3-340009:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
ipc_boardInit done.
IPC_echo_test BOSSE (core : mcu2_0) .....
mcu2_0 <--> mpu1_0 : hello there 0! recvd
mcu2_0 <--> mpu1_0 : hello there 1! recvd
mcu2_0 <--> mpu1_0 : hello there 2! recvd
mcu2_0 <--> mpu1_0 : hello there 3! recvd
mcu2_0 <--> mpu1_0 : hello there 4! recvd
mcu2_0 <--> mpu1_0 : hello there 5! recvd
mcu2_0 <--> mpu1_0 : hello there 6! recvd
mcu2_0 <--> mpu1_0 : hello there 7! recvd
mcu2_0 <--> mpu1_0 : hello there 8! recvd
mcu2_0 <--> mpu1_0 : hello there 9! recvd
Can someone help me get UART debug prints working from mcu2_0?
Regards,
/Bo
  • Hello,

    The reason for not using UART prints is when A72 linux is booting up it prints the log on MAIN UART and MCU2_0 being main core loads at the same time of A72 Linux and it also tries to print the messages at the same time of MAIN UART ,which can create conflict and might lead to corruption.

    So as soon as we are booting up the MCU2_0 core we have printed the messages in trace buffer and later we get the prints into UART "cat /sys/kernel/debug/remoteproc/remoteproc0/trace0" 

     

    Regards

    Tarun Mukesh

  • Hello Tarun,

    That doesn't really make sense to me. At boot, I have my normal boot log and console on main_uart0 which should not conflict at all.

    Also, I am not loading the remote cores at boot (yet). They are manually started using:

    echo ipc_echo_test_freertos_mcu2_0_release_strip.xer5f > /sys/class/remoteproc/remoteproc0/firmware
    echo start > /sys/class/remoteproc/remoteproc0/state

    The final goal for this exercise is to be able to use serial communication on port main_uart7, attached to mcu2_0 and relaying that communication using ipc to the Linux side on the A72.

    So, I really need the uart to work with mcu2_0. Can you assist?

    Regards,

    /Bo

  • Hello,

    That doesn't really make sense to me. At boot, I have my normal boot log and console on main_uart0 which should not conflict at all.

    If you are able to ensure there will be no conflict then we have

    #define App_printf Ipc_Trace_printf
     
    you can remove this Ipc_Traceprintf.
    Regards
    Tarun Mukesh
  • Hello Tarun,

    Thank you for your help. I have gotten it to work now, and one of the things that was important was the
    following macro:

    #define BOARD_UART_SOC_DOMAIN    (BOARD_SOC_DOMAIN_MAIN) (instead of BOARD_SOC_DOMAIN_MCU)
    which was necessary to get outputs to the main_uart7 port.
    Now I have ipc echo working, with both trace and uart:
    Linux console:
    root@AS-P-3-340009:~# ./rpmsg_char_simple -r 2 -n 2
    Created endpt device rpmsg-char-2-542, fd = 4 port = 1025
    Exchanging 2 messages with rpmsg device rpmsg-char-2-542 on rproc id 2 ...

    Sending message #0: hello there 0!
    Received message #0: round trip delay(usecs) = 45620610
    hello there 0!
    Sending message #1: hello there 1!
    Received message #1: round trip delay(usecs) = 45866150
    hello there 1!

    Communicated 2 messages successfully on rpmsg-char-2-542

    TEST STATUS: PASSED
    root@AS-P-3-340009:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
    mcu2_0 <--> mpu1_0 : hello there 0! recvd
    mcu2_0 <--> mpu1_0 : hello there 1! recvd
    mcu2_0 debug uart:
    mcu2_0 <--> mpu1_0 : hello there 0! recvd

    mcu2_0 <--> mpu1_0 : hello there 1! recvd
    Thanks!
    /Bo