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.

IWRL1432BOOST: UART IN INTERUPT MODE

Part Number: IWRL1432BOOST
Other Parts Discussed in Thread: IWRL1432, SYSCONFIG

Tool/software:

Hello TI Support,

I'm currently using the IWRL1432 board for a level sensing application, and I have a couple of questions regarding UART functionality:

  1. To send sensor data to the serial monitor, I'm using the CLI_write() function inside the dpc.c file (snippet attached below). I’m able to see the data on the monitor. Could you please confirm if this is the recommended method?
  2. Now, I would like to receive user commands from an external MCU or serial monitor via UARTA in interrupt mode.
    • I enabled UARTA in the SysConfig file and selected the interrupt option.
    • However, after this change, I encountered several errors (attached below).
    • My question is: Do I need to implement a UART callback function to handle the interrupt? If yes, could you guide me on where to place the callback function and how to properly integrate it?
  3. Is it possible to use both the UART at a time in the code?

Looking forward to your support.

Thanks & Regards,

Swasthik.

  • HI Swasthik, 

    My apologies for the slow response. I appreciate your patience. Here are some answers to your questions. 

    1. CLI_write() is not recommended for data output to host. CLI_Write is used primarily for debug purposes. The demo application already outputs data via UART in 

    mmwDemo_TransmitProcessedOutputTask() (in level_sensing.c).
    2. If callback mode is selected, then yes, a callback function is required. You should be able to place it in level_sensing.c. Also, you can refer to the uart echo callback example from the SDK to see how this is done. ({MMWAVE_SDK5_INSTALL}\examples\drivers\uart\uart_echo_callback)
    3. Can you clarify what you mean here? Do you just mean is it possible to have both UART enabled? Or are you referring to writing to both uart at the same time?
    Best regards,
    Josh 
  • Hi Josh Dye,

    I reviewed the mmwDemo_TransmitProcessedOutputTask() function in level_sensing.c, and I noticed it includes a lot of processing and data handling. However, I only need to extract and send the distance data (from the object to the sensor) via UART.

    Could you please help by sharing the code snippet or modifications required to send only the distance data over UART?

    Also, just to clarify — yes, we are planning to use both UARTs:

    • One UART for transmitting the distance data output.
    • Another UART for receiving user commands from an external source.

    Thanks & Regards,
    Swasthik

  • Hi Swasthik, 

    Thanks for the clarification. It is possible to use the UART how you describe but you'll need to make some changes because the demo code does not support it by default. The required modifications include enabling a second UART instance in sysconfig (level_sensing.syscfg). Then just ensure the CLI and transmitDataOutput tasks use the correct UART handle.

    In the level sensing demo, the detected distance is output as part of the point cloud. This is the code snippet that does this:

    mmw_UartWrite (uartHandle, (uint8_t*)&gMmwMssMCB.pointCloudToUart, sizeof(MmwDemo_output_message_tl) + tl[tlvIdx].length);

    Best regards,

    Josh

  • Hi Josh Dye,

    Then just ensure the CLI and transmitDataOutput tasks use the correct UART handle.

    I checked both handlers. In the mmwDemo_TransmitProcessedOutputTask() function, the UART handle is:

    UART_Handle uartHandle = gUartHandle[0];
    And in the CLI write function, the UART handle is:

    UART_Handle uartWriteHandle;
    #if (CLI_REMOVAL == 0)
        uartWriteHandle = gCLI.cfg.UartHandle;
    #endif
    So, if I change the UART handle in mmwDemo_TransmitProcessedOutputTask() to use gCLI.cfg.UartHandle like this:

    UART_Handle uartHandle = gCLI.cfg.UartHandle;

    Will I then be able to receive the output in the serial monitor (since both CLI and output now use the same UART)?

    Is this the correct approach?

    Thanks && Regards

    Swasthik

  • Hi Swasthik, 

    I'm not sure if this accomplishes what you are trying to do. Previously you mentioned using separate UARTs for data output and CLI. Is this still needed?

    gCLI.cfg.UartHandle and  gUartHandle[0] are already equivalent in the demo code so the modifications you show actually have no effect. This is because of this line in level_sening(). gCLI.cfg.UartHandle is equivalent to gMmwMssMCB.commandUartHandle. 

    gMmwMssMCB.commandUartHandle = gUartHandle[0];

    I apologize for the confusion here. Can you please help me understand the main goal you are trying to achieve?

    Best regards,

    Josh

  • Hello Josh Dye,

    Sorry for the confusion earlier.

    The First Goal is below one,

    I would like to view only the distance data from the level sensing application on the serial monitor. Previously, I was viewing passing the distance value through a variable to the CLI_write function, which is located dpc.c below is the variable.

         gMmwMssMCB.cfarDetObjOut[i].y        = level_meas / 10000.0; // zoom meas in m

    Could you please guide me on how to view and pass the data correctly?
    When I run the demo code, I’m not receiving any output on the serial monitor. I'd like to understand what needs to be modified or configured to ensure the data—specifically the distance values—is properly transmitted and visible on the serial terminal.

    Thank you!
    Swasthik.

  • Hi Swasthik, 

    Okay thank you. To clarify, in the xWRLx432 examples, the guiMonitor configuration command dictates what data is transmitted to the host via UART. Then whatever data is selected is sent out in binary format, this is why after sending the configuration data shown on the serial terminal appears to consist of garbled incomprehensible characters. Our visualizer tools receive this binary UART data and decode/parse it according to the defined TLV formats. One could implement the same parsing of the data on a host MCU. 

    When you say 'visible on the serial terminal' do you mean the values should be human-readable? If so then yes, CLI_write should indeed be used. And in that case you would likely also want to disable all of the TLV outputs so that you can actually see the data in the serial monitor (this would be done by putting all 0 for guiMonitor). I'm curious though if this is just for debug purposes to read the data as it is coming off the device? CLI_write can be slow so typically this could cause issues. However, since you are only interested in the detected distance data which is pretty small every frame it may be okay.

    Best regards,

    Josh