Setting EDRx

Hi,

I am trying to set EDRx en LOG_INF the result using following code:

static struct lte_lc_edrx_cfg drx_cfg;

//enable EDRx
LOG_INF("== Setting EDRx ==");
lte_lc_edrx_req (true);
lte_lc_edrx_param_set (LTE_LC_LTE_MODE_LTEM, NULL);
lte_lc_edrx_get (&drx_cfg);
LOG_INF("== drx_cfg.edrx (eDRX interval in seconds): %f",  drx_cfg.edrx);
LOG_INF(" == drx_cfg.ptw (Paging time window in seconds): %f",  drx_cfg.ptw);

Resulting in output:

[00:00:38.473,785] <inf> A:  == drx_cfg.edrx (eDRX interval in seconds): *float*

[00:00:38.473,815] <inf> A: == drx_cfg.ptw (Paging time window in seconds): *float*

So I get "*float*" and not the values. It seems the network also does not set edrx.

What am I doing wrong?

Best regards,

Mart

Parents
  • Hello Mart,

    Are you able to check the eDRX status using AT commands by chance?

    Best regards,

    Michal

  • Hi Michal,

    I did some research and found other posts regarding the same issue. eDRX was set correctly, the issue is printing the values using:

    • LOG_INF
    • printk

     It seems both cannot handle "%f" (float). See also posts like:

     nrf9160 samples cannot use sscanf or printk with float 

    All given possible solutions to make LOG_INF and printk work with floats are not working - or I am missing some information - using the latest SDK.

    A workaround using gcvt given in this forum also:

    static char buf[10];
    gcvt(drx_cfg.edrx, 6, buf);
    LOG_INF(" == drx_cfg.edrx (eDRX interval in seconds): %s",  buf);
    This is working although VisualCode gives an error regarding gcvt does not have any parameters. But is compiles, flashes and works without problems.
    So there is something wrong printing floats using %f in my config.
    Any ideas?
    Best regards,
    Mart
Reply
  • Hi Michal,

    I did some research and found other posts regarding the same issue. eDRX was set correctly, the issue is printing the values using:

    • LOG_INF
    • printk

     It seems both cannot handle "%f" (float). See also posts like:

     nrf9160 samples cannot use sscanf or printk with float 

    All given possible solutions to make LOG_INF and printk work with floats are not working - or I am missing some information - using the latest SDK.

    A workaround using gcvt given in this forum also:

    static char buf[10];
    gcvt(drx_cfg.edrx, 6, buf);
    LOG_INF(" == drx_cfg.edrx (eDRX interval in seconds): %s",  buf);
    This is working although VisualCode gives an error regarding gcvt does not have any parameters. But is compiles, flashes and works without problems.
    So there is something wrong printing floats using %f in my config.
    Any ideas?
    Best regards,
    Mart
Children
Related