Is there some mechanism to subscribe to unsolicited modem responses?

SDK 2.0.0, nrf9160, modem fw 1.3.2

We are effectively running the GNSS sample and the MQTT sample in separate threads.  We are interested in seeing the modem temperature (via AT%XTEMP=1 command).  This command seems to enable periodic notifications of the form %XTEMP: N,M

Is there a way for one of my threads to register a "callback" that is executed when the %XTEMP string is received from the modem and delivers that %XTEMP: N,M to me?

We saw the nrf_modem_at_cmd_filter_set, but that looks like it is intercepting commands going to the modem rather than processing responses from the modem.

Thank you.

Parents Reply Children
  • Yes, it does seem like AT monitor is what I am looking for.  We started with the AT Monitor sample and it ran showing us the +CEREG and %CESQ messages.

    We modified it by adding another AT_MONITOR() for "XTEMP" (the monitor library uses strstr() for filtering) and did a nrf_modem_at_printf("AT%%XTEMP=1"); to enable perioding reporting.  This returned "OK".  We never saw an XTEMP message.  We even tried changing the AT_MONITOR filter to ANY.  And we enabled debug messages in the AT monitor library -- it never received an "%XTEMP" message from the modem.

    Does the modem ever send those %XTEMP notifications?  It doesn't seem to.

    Thank you.

  • Richard W Mincher said:
    Does the modem ever send those %XTEMP notifications?  It doesn't seem to.

    A notification is sent when the temperature is rising above a high or critical temperature level or cooling down from a critical or high temperature level.

    So if the modem temperature doesn't change much at all, it's possible that the modem will never send a notification.

  • The documentation seems to imply that the reporting frequency is approximately 60 seconds and that it may report more frequently if it gets closer to a critical threshold.  I find it hard to believe that it 1) doesn't give an initial report when it is turned on, and 2) it never reports unless it changes severely.  I can believe that the update frequency is dependent on the proximity to a critical threshold.  I can try hitting it lightly with a heat gun or some freeze spray, but I would have expected in the minutes that I waited for a report that I received nothing.

    Are there periodic reports (other than +CEREG and %CESQ) that I can see?  I would have expected that by setting the filter to ANY (NULL) I would see other things that other system components were watching.

    Thanks.

  • Richard W Mincher said:
    Are there periodic reports (other than +CEREG and %CESQ) that I can see?  I would have expected that by setting the filter to ANY (NULL) I would see other things that other system components were watching.

    Have you enabled any other notifications? The modem won't send notifications unless you subscribe. That includes the AT%XTEMP=1 to subscribe to temperature notifications.

    I don't have access to equipment until Wednesday, but if you wait I can try to test this myself.

  • I would love to see what you find.  We did send  AT%XTIME=1 and did get one single response from that.  I would expect that it would get this at some infrequent rate as well -- or maybe each time the LTE network connects at a minimum.  Still nothing with AT%XTEMP=1.

    If we were to poll the battery and temperature, what is a reasonable rate to do this without interfering with performance?  Is that too often if I send a %TEMP every minute?  Clearly, under normal circumstances, the temperature would not move quickly.  2 minutes?  Thirty seconds?  5 minutes?  I would like to have a relatively current reading to report whenever the client application requests it but don't want to unnecessarily choke the modem pipe.

    Thank you.

Related