8 thoughts on “Returning control of the serial port to the AT command interpreter”
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 ?
Hello,
in addition to what you did, you need to physically close the hardware channel using the api m2m_uart_close_hwch
That did get me further. APPZONE C API REFERENCE GUIDE 2016-02-05 doesn’t have that one.
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.
Cheers,
Andrew
p.s. Telit AppZone C API Reference Guide.pdf ( Rev 2 2016-10-03 ) has the m2m_uart_close_hwch()
I’ll investigate it. I need to know what module you’re working on
This is on firmware version : stream_HE910_NAG-12.00.318.bin
We use cookies to enhance your browsing experience and help us improve our websites. To improve our website, we carefully select third parties that use cookies to allow us to serve specific content and achieve the purposes set out in our cookie policy. For more information on how to make adjustments through your browser to the cookies being used on your device, please click Find Out More link. By closing this banner or continuing to browse our website, you agree to our use of such cookies. FIND OUT MORE
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 ?
Hello,
in addition to what you did, you need to physically close the hardware channel using the api m2m_uart_close_hwch
http://www.telit.com/fileadmin/AppZone_Guide/az-c-api-ref-guide_V3/index.html#!Documents/m2muartclosehwch.htm
BR
Thank you.
That did get me further. APPZONE C API REFERENCE GUIDE 2016-02-05 doesn’t have that one.
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.
Cheers,
Andrew
p.s. Telit AppZone C API Reference Guide.pdf ( Rev 2 2016-10-03 ) has the m2m_uart_close_hwch()
I’ll investigate it. I need to know what module you’re working on
This is on firmware version : stream_HE910_NAG-12.00.318.bin
I confirm the issue, I’m reporting a bug
Thank you