This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Lowering the power consumption of nRF9160 mqtt_example

Hi,

I've been trying to lower the power consumption of the MQTT example and followed the guide in here

1. I compiled the low power UDP example and do exactly all the things provided here. However, the minimum current for me is 50uA at 5V supply. The supply is external and everything is set properly but I do not know why I produce the results reported( My DK version is 0.8.2). I want to know why I am not getting the same results.

2. I tried to lower the power consumption of the MQTT example by modifying it to be like the low power UDP example(here) and lowered the minimum current to 50uA which is again like the UDP example. But when the LTE link is established, the average current increases to 500uA . In the UDP example, I do not see any spikes on the current unless when it transfers data. But at the MQTT example, there are some spikes that are related to the LTE connection( I activated PSM but there are not any sensible difference). Is there any way that I can reduce the power consumption in the MQTT example? Why PSM is not helping?

This is the main.c of my code:

 modem_configure();

        err = lte_lc_psm_req(true);
        if (err) {
                printk("ERROR: set edrx %d\n", err);
                return;
        }


	client_init(&client);

	err = mqtt_connect(&client);
	if (err != 0) {
		printk("ERROR: mqtt_connect %d\n", err);
		return;
	}

	err = fds_init(&client);
	if (err != 0) {
		printk("ERROR: fds_init %d\n", err);
		return;
	}

3. The thing that is strange to me is that in the MQTT example there is a "modem_configure" function that calls the "lte_lc_init_and_connect" function for establishing the LTE connection. However, in the UDP example, this function is not used and only "lte_lc_psm_req" is used. However, if I delete the "lte_lc_init_and_connect" function from MQTT example, it cannot get connected to the server because there is not an LTE connection. Can anyone clear this up for me?

Parents
  • Hi,

     

    First, you need to disable the serial output by setting CONFIG_SERIAL=n in both the spm/prj.conf and mqtt_simple/prj.conf.

     

    The thing that is strange to me is that in the MQTT example there is a "modem_configure" function that calls the "lte_lc_init_and_connect" function for establishing the LTE connection. However, in the UDP example, this function is not used and only "lte_lc_psm_req" is used. However, if I delete the "lte_lc_init_and_connect" function from MQTT example, it cannot get connected to the server because there is not an LTE connection. Can anyone clear this up for me?

    The start up procedure runs certain functions and drivers prior to the application reaching the main() function, one of these can be initializing a LTE connection to the network, but you can also set this config in your prj.conf to call it in your application instead (via modem_configure()):

    https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/applications/asset_tracker/prj.conf#L20

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    First, you need to disable the serial output by setting CONFIG_SERIAL=n in both the spm/prj.conf and mqtt_simple/prj.conf.

     

    The thing that is strange to me is that in the MQTT example there is a "modem_configure" function that calls the "lte_lc_init_and_connect" function for establishing the LTE connection. However, in the UDP example, this function is not used and only "lte_lc_psm_req" is used. However, if I delete the "lte_lc_init_and_connect" function from MQTT example, it cannot get connected to the server because there is not an LTE connection. Can anyone clear this up for me?

    The start up procedure runs certain functions and drivers prior to the application reaching the main() function, one of these can be initializing a LTE connection to the network, but you can also set this config in your prj.conf to call it in your application instead (via modem_configure()):

    https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/applications/asset_tracker/prj.conf#L20

     

    Kind regards,

    Håkon

Children
  • Hi,

    Thanks for the response. 

    First, you need to disable the serial output by setting CONFIG_SERIAL=n in both the spm/prj.conf and mqtt_simple/prj.conf.

    1. I actually did disable serial by setting CONFIG_SERIAL=n in both spm/prj.conf and mqtt_simple/prj.conf. When I do not disable the serial in both of them I will get the idle current of 600uA. The thing is when I disable both of them I still get 50uA as the idle current which is higher than the 7uA that is reported. At first, I thought maybe because I did something wrong with the MQTT example. However, when I exactly compiled the PSM example and uploaded it to the chip again I got 50uA as the idle current.

    The start up procedure runs certain functions and drivers prior to the application reaching the main() function, one of these can be initializing a LTE connection to the network, but you can also set this config in your prj.conf to call it in your application instead (via modem_configure()):

    2. Can you please help me with those certain functions? I want to activate the LTE before my main function too. Which modifications should I do? I looked at the In the proj.conf of the PSM code, and there are two following options

    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_LEGACY_PCO_MODE=y

    However, when I add them into my MQTT proj.conf I still do not get connected to LTE prior to the main function. 

    3. One last question, what does "CONFIG_LTE_LEGACY_PCO_MODE=y" do?

  • Hi,

     

    Which modem firmware are you running? If running v0.7.0-29, this should cut off the power to the SIM during PSM.

    If you do not go into PSM mode (network driven, nRF only requests it), the clock stop on the SIM card may add such additional current consumption.

    You can check PSM status by issuing AT commands:

    AT+CEREG=5
    AT+CEREG?

     

    This will enable additional output from cereg, and the last two strings (in binary) should give you your PSM settings (if accepted by the network).

     

    Mohammad Amin said:
    2. Can you please help me with those certain functions? I want to activate the LTE before my main function too. Which modifications should I do? I looked at the In the proj.conf of the PSM code, and there are two following options

    Legacy PCO is expanded in the help for the kconfig entry: https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/drivers/lte_link_control/Kconfig#L73

    This is a LTE specific feature, which were used for some base stations.

     

    To connect to the LTE network before you enter main, you need this config entry set to =y in your prj.conf:

    https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/drivers/lte_link_control/Kconfig#L14

     

    Kind regards,

    Håkon

  • Hi,

    Which modem firmware are you running? If running v0.7.0-29, this should cut off the power to the SIM during PSM.

    I use v0.7.0-29 modem firmware. 

    This will enable additional output from cereg, and the last two strings (in binary) should give you your PSM settings (if accepted by the network).

    I issued the two AT commands that you mentioned. 

    When I issue "AT+CEREG=5" I get "error" as the result. I even changed the notification level in the subscribe command at "lte_lc.c" module to 5 but still the notification level is 0.

    When I issue "AT+CEREG?" I get, "+CEREG: 0,1,"7F58","0642AE0A",7 OK"

    Looking at the status I think PSM is set in the device as I get proper TAU and AT. However, still, the floor current is 40uA. Is PSM set correctly based on the status I get? Although TAU to me is meaningless and a very large number(more than 8 bits!).

    To connect to the LTE network before you enter main, you need this config entry set to =y in your prj.conf:

    Thanks. That works.

    One thing that came to my mind is that in here Gnotman stated that the USB cable must be connected otherwise the board draws additional current from P24. Is that right? 

  • Mohammad Amin said:
    One thing that came to my mind is that in here Gnotman stated that the USB cable must be connected otherwise the board draws additional current from P24. Is that right? 

     Yes, this is correct. Sorry, should have seen this earlier. There's logic on the board that might draw extra current, as voltages might be applied to the unpowered switches/mux'es.

    Have you tried plugging in the USB, while doing your current measurements, to see if this fixes the issue?

     

    Kind regards,

    Håkon

  • Yes, this is correct. Sorry, should have seen this earlier. There's logic on the board that might draw extra current, as voltages might be applied to the unpowered switches/mux'es.

    Have you tried plugging in the USB, while doing your current measurements, to see if this fixes the issue?

    Do you mean that USB cable and external power of P28 both must be connected? Doesn't it harm the board? Because now we will have two power supply connected.

    I have measured the current when only USB cable was connected (P28 was unconnected) and did not see any improvement on the floor current.

Related