Returning control of the serial port to the AT command interpreter

8 thoughts on “Returning control of the serial port to the AT command interpreter

  1. Hi All,

    I have a “C” application, that generally will need control of the serial port – doing Modbus comms (as the Master).

    However the device it is talking to, can transparently send information to an external port which I can connect a console to (and will be the ONLY physical connection the Telit module has for debugging once its installed).

    On startup – I can send/receive AT commands.

    My application uses : m2m_hw_uart_open(),  then m2m_hw_uart_ioctl(M2M_HW_UART_IO_HW_OPTIONS_GET, M2M_HW_UART_IO_HW_OPTIONS_SET, M2M_HW_UART_IO_RCV_FUNC) to set Baudrate etc and receiving chars callback function, then m2m_hw_uart_write(),  and the callback function to send/receive  messages successfully.

    Once “finished”, I call m2m_hw_uart_close().  By itself this function does not appear to return control of the port to the command interpreter – AT commands now get ignored.

    I CAN get by with just cycling the power and using the start window to send AT commands, but would prefer to close the port cleanly if possible.

    If I want my application to return control of the port – do I somehow need to undo anything associated with M2M_HW_UART_IO_HW_OPTIONS_SET / M2M_HW_UART_IO_RCV_FUNC ?

      1. Thank  you.

        That did get me further.  APPZONE C API REFERENCE GUIDE 2016-02-05 doesn’t have that one.

      2. Hello again,

        After using m2m_uart_close_hwch() are there any further steps required to re-open the port programmatically?

        I’m finding after successful communications, then a call to m2m_uart_close_hwch (with or without  m2m_hw_uart_close first), that m2m_hw_uart_open() apparently succeeds (doesn’t return M2M_HW_UART_HANDLE_INVALID), as does M2M_HW_UART_IO_HW_OPTIONS_SET (required as M2M_HW_UART_IO_HW_OPTIONS_GET now reports a baudrate of 1409293088 ), but attempting to write using m2m_hw_uart_write doesn’t work the second time around – returning M2M_HW_UART_RESULT_FAIL

        Ah well, as I said, this function is useful but not essential – cycling the power works to return control to the AT command interpreter.



        p.s.  Telit AppZone C API Reference Guide.pdf ( Rev 2 2016-10-03 ) has the m2m_uart_close_hwch()