How to use M66 UART PORT 1 or 2 for sending data on demand to external MCU?

  1. I want to use UART port 1/2 on M66 for sending commands to external MicroController for project.
  2. I have read the UART part from M66 User Manual , utilized example UART program in SDK V2.4
  3. The examples show when and how to read incoming data but no example has shown how to send
    data on UART whenever required.
    I got following Callback handler structure for UART :

    Ignore the commented part of code!

Now I want to send messages to external MCU whenever user asks M66 to do so. I am controlling water pump from M66 but I’m interfacing another MCU to manage other functions as well. So I am communicating M66 with other MCU using UART port 2(Debug) .

I want to send ON/OFF commands for various GPIO to other MCU whenever required(not only when UART is READR_TO_WRITE) . I don’t know if Callback function is called again & again whenever M66 UART is in READY_TO_WRITE condition.

How can I do that?
What will be the use of EVENT_UART_READY_TO_WRITE in UART_callback function ?
Can I write data to UART port whenever required without considering if UART port is READY TO WRITE?
Because to write data on UART port, only function needed to Call is QL_UART_WRITE() as per manual.

Please help me out.

SDK used : M66_OpenCPU_GS3_SDK_V2.4_Eclipse
UART port 2 (Debug Port) in use for application (Baud 115200)

Hello:

What do you mean there is no example to show UART sending data?In each of the examples there is the use of UART’s send API.It’s just encapsulated as the APP_DEBUG function, but it’s essentially the QL_UART_WRITE API, and QL_UART_WRITE is the serial port write function.This function has a selectable parameter that can be used to send data to UART1/2.