I am working with the BluemixDemo sample project taken from the Avnet MBED repo @ https://developer.mbed.org/teams/Avnet/. You will find the development platform, firmware revisions etc below.
I am seeing what looks to be intermittent issues with the modem returning an "Operation not Supported" error when running outside of the online mbed environment, that is when running under Kinetis Design Studio as well as when using the Mbed CLI tools.
I have modified the sample by commenting out the publishing to the MQTT broker. Thus the only activity would be the initial connect, subscribe and then the keepalive ping. The connect to the IP layer and the MQTT broker seem to be working ok.
During the failure the application is in a read loop sending AT@SOCKREAD=1,1 to the modem. At first I get back good status from the modem. However after a bit, perhaps 1-5 minutes, the following error is returned: "+CME ERROR: operation not supported"
I've imported the BluemixDemo project into my Embed workspace, added some debug code, disabled any MQTT publishing from the demo so as to test the keepalive pings but otherwise the code is unchanged from the original sample.
Then I have taken the code and compiled it 3 different ways and see 2 different results.
****** Seeing Good Results *****************
1. First Case: Online via the mbed compiler.
I've imported the project into my MBED environment, I did not update any dependency libraries. In this case everything looks fine. I have let the demo app run for up to 1-1/2 hours without any hiccups what so ever. The IP and MQTT connections remained connected, the keepalive pings were responded to as expected.
****** Seeing errors *****************
2. Second Case: Off line via exporting my version of the demo from Mbed, then importing it into Kinetis Design Studio.
- in this case to fix some compile time issues I need to add "mbed_config.h" to the compile options such that it is included in every compile statement. "mbed_config.h" appears to be am artifact built as a result of the export from mbed. It contains only the following:
#define MBED_CONF_RTOS_PRESENT 1 // set by library:rtos
- in this case when running the demo, the connection is made to IP and MQTT. The subscribe is sent and acknowledgement seen at the demo app side. Sometimes we are able to see 1 or more keepalive ping requests/responses before the modem returns the "operation not supported" status. This then results in the socket being closed and the connection torn down.
- I have debug output enabled for the MQTT broker and do not see any broker initiated socket disconnects.
- with KDS I tried the GCC Tool chain versions 4.8.2, 5.4.1, and 6.3.1. No appreciable difference was noted when trying different compiler versions.
3. Third Case: Off line via the MBED-cli tools, using the CLI tools to import the project and its dependency libraries onto my laptop.
- in this case to get past a compile time error due to an undefined __wrap_exit() function, I had to update (via CLI tools) the mbed library code. None of the other libraries needed to be updated.
- the mbed library update also required an update to WNCInterface/WncControllerK64F/MODSERIAL/Device/MODSERIAL_KSDK.cpp due to a slight change in the definition of serial_t in the latest MBED library.
- NOTE: these same changes made to the MBED online code version did not change it's behavior, it still works fine
- the mbed_config.h change seen with KDS is not required here as there is no mbed_config.h in the resulting code tree
- I see similar results to those seen with Kinetis Design Studio. The connections are made to the MQTT broker, we may get 1-4 successful ping requests/responses before we get the "Operation not supported".
- It did not seem to matter the GCC toolchain version for this method either.
- is there some command I can send to the modem when it returns "Operation not supported" in order to get meaningful status that might lead to a solution?
- is there some command I might send prior to each read query that may show an impending problem (buffer full, signal degradation, etc...).
*********************** putty terminal LOG FILE: ****************************
Note: >>> Leroy, my comments, not part of the log file
>>> I have disabled the TX:/RX: dbgPuts() in WncController::at_send_wnc_cmd() to cut down on the amount of output
>>> Leroy: this particular run was after 3 successful ping requests had been sent/received to the broker
MQTTClient sending PING Request to Broker. Count #: 4
[*] 285253814 <-------- Begin Cell Status ------------
[*] 285259410 mdmGetLine returns OK: [*] 285259526 AT+CSQ+CSQ: 19,99OK
[*] 285265643 mdmGetLine returns OK: [*] 285265759 AT+CPIN?+CPIN: READYOK
[*] 285273293 mdmGetLine returns OK: [*] 285273410 AT+CREG?+CREG: 2,1,6A43,07F23311,7OK
[*] 285301648 ------------ WNC Ready ---------------->
[*] 285370498 mdmGetLine returns OK: [*] 285400608 AT@SOCKWRITE=1,2,"c000"@SOCKWRITE:2OK
[*] 286276805 mdmGetLine returns OK: [*] 286276924 AT@SOCKREAD=1,1@SOCKREAD:1,"D0"OK
[*] 286989828 mdmGetLine returns OK: [*] 286989947 AT@SOCKREAD=1,1@SOCKREAD:1,"00"OK
MQTTClient received PING Response
>>> Leroy: the command sent, some of this is debug statements that I added.
[*] 303809906 >>> mdmGetLine +CME ERROR, cmd: [*] 303810036 AT@SOCKREAD=1,1
>>> Leroy: the response from the command
[*] 303810152 >>>cmd returned: [*] 303810260 ATSOCKREAD=1,1+CME ERROR: operation not supported
[*] 303810420 "at_send_wnc_cmd: returns:" [*] 303810544 WNC_AT_CMD_ERRCME
[*] 303875609 readBuf: [*] 303899564
[*] 303916231 Closing open socket
[*] 303954773 Try to close and re-open socket
[*] 304003731 at_sockclose_wnc
>>> Leroy: reinitializing things.. , I'm not sure this is successful but have not been looking at this aspect
[*] 304045770 mdmGetLine returns OK: [*] 304079773 AT@SOCKCLOSE=1OK
[*] 304113106 <-------- Begin Cell Status ------------
[*] 304172817 mdmGetLine returns OK: [*] 304212065 AT+CSQ+CSQ: 20,0OK
[*] 304249394 mdmGetLine returns OK: [*] 304288106 AT+CPIN?+CPIN: READYOK
[*] 304330792 mdmGetLine returns OK: [*] 304368314 AT+CREG?+CREG: 2,1,6A43,07F23311,7OK
[*] 304422481 ------------ WNC Ready ---------------->
****************** Hardware config info *****************************
development machine Linux 14.04 LTS 64 bit
Lenovo T61 laptop
3.8 GB memory
Intel core 2 Duo CPU T8100 @ 2,10GHZ
ATT IOT Starter Kit
FRDM-K64F Rev E
Firmware: DAPLink rev 0243: 0243_k20dx_frdmk64f_0x5000.bin
modem firmware: AT+GMRMPSS report : M14A2A_v11.50.164451 APSS: M14A2A_v11.53.164451OK
The Avnet board is powered via the external 5 v adapter provided in the starter kit.
The target mosquitto MQTT broker is running on my development laptop machine.