Multicell Location / here_integration configuration

Hi,

I have trouble configuring Here service for multicell positioning. I've used the service before, but recently updated to NCS 2.0.0. I don't know what are the configuration flags that would print float numbers to string. Currently the only way I can get a location is to modify the here_integration.c file and ask the location without rsrq information.

The here_integrationc file has this template:

#define HTTP_REQUEST_BODY                       \

    "{"                             \
        "\"lte\":["                     \
            "{"                     \
                "\"mcc\":%d,"               \
                "\"mnc\":%d,"               \
                "\"cid\":%d,"               \
                "\"tac\":%d,"               \
                "\"rsrp\":%d,"              \
                "\"rsrq\":%.1f,"            \
                "\"ta\":%d,"                \
                "\"nmr\":["             \
                    "%s"                \
                "]"                 \
            "}"                     \
        "]"                         \
    "}"

That is later used to format the request json:

    len = snprintk(buf, buf_len, HTTP_REQUEST_BODY,
               cell_data->current_cell.mcc,
               cell_data->current_cell.mnc,
               cell_data->current_cell.id,
               cell_data->current_cell.tac,
               here_adjust_rsrp(cell_data->current_cell.rsrp),
               here_adjust_rsrq(cell_data->current_cell.rsrq),
               here_adjust_ta(cell_data->current_cell.timing_advance),
               neighbors);

This is the log of what is happening:

[00:30:50.569,061] <dbg> location: method_cellular_lte_ind_handler: Cell measurements results received
[00:30:50.572,052] <dbg> multicell_location_here: location_service_get_cell_location_here: Generated request body:
{"lte":[{"mcc":244,"mnc":91,"cid":36945675,"tac":4050,"rsrp":-119,"rsrq":%.1f,"ta":10,"nmr":[{"earfcn":474,"pci":105,"rsrp":-120,"rsrq":%.1f},{"earfcn":6300,"pci":417,"rsrp":-110,"rsrq":%.1f}]}]}
[00:30:50.888,702] <inf> cloud_module: RRC mode: Connected
%CESQ: 24,1,7,1
%CESQ: 24,1,12,1
[00:30:56.234,619] <err> multicell_location_here: HTTP status: 400
[00:30:56.234,710] <dbg> multicell_location_here: location_service_get_cell_location_here: Received response body:
{"title":"Bad Request","status":400,"code":"E606400","action":"Please correct the request and retry","cause":"Request body must be a valid JSON formatted Positioning API request object.","correlationId":"b883f1e5-c9d5-4a25-aa66-140321352089"}
[00:30:56.235,137] <dbg> multicell_location_here: location_service_parse_response: No 'location' object found
[00:30:56.235,229] <err> multicell_location_here: Failed to parse HTTP response
[00:30:56.235,229] <err> location: Failed to acquire location from multicell_location lib, error: -35
[00:30:56.235,260] <err> location: Location acquisition failed and fallbacks are also done
[00:30:56.235,260] <inf> position_module: * location_event_handler *
[00:30:56.235,260] <inf> position_module: Getting location failed

The Here service responds with an error as my request doesn't have numbers in the "rsrq" field. I have copied these settings from modem_shell sample:

CONFIG_CBPRINTF_LIBC_SUBSTS=y
CONFIG_MINIMAL_LIBC=n
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

Regards,
Ilkka

  • Hi,

    Try to add CONFIG_NEWLIB_LIBC_NANO=n to your prj.conf, then rebuild the project.

    Best regards,

    Didrik

  • Hi Didrik,

    I tried the config CONFIG_NEWLIB_LIBC_NANO=n, but it didn't change how the string was formatted. I did check the .config before and after changing CONFIG_NEWLIB_LIBC_NANO. The option was set before and is not set after I added CONFIG_NEWLIB_LIBC_NANO=n in prj.conf.

    #
    # C Library
    #
    CONFIG_REQUIRES_FULL_LIBC=y
    CONFIG_SUPPORT_MINIMAL_LIBC=y
    CONFIG_NEWLIB_LIBC=y
    # CONFIG_EXTERNAL_LIBC is not set
    CONFIG_HAS_NEWLIB_LIBC_NANO=y
    # CONFIG_NEWLIB_LIBC_NANO is not set
    CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=8192
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    # CONFIG_NEWLIB_LIBC_FLOAT_SCANF is not set
    # CONFIG_NEWLIB_LIBC_HEAP_LISTENER is not set
    CONFIG_STDOUT_CONSOLE=y
    # end of C Library
    However, I noticed the OS Support Library has a config CONFIG_CBPRINTF_FP_SUPPORT. After I added CONFIG_CBPRINTF_FP_SUPPORT=y in my prj.conf, Here location started working.
    Here is what I have in prj.conf:
    CONFIG_CBPRINTF_LIBC_SUBSTS=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    CONFIG_NEWLIB_LIBC_NANO=n
    CONFIG_MINIMAL_LIBC=n
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    And this is from the .config after a building with CONFIG_CBPRINTF_FP_SUPPORT=y
    #
    # OS Support Library
    #
    # CONFIG_JSON_LIBRARY is not set
    # CONFIG_RING_BUFFER is not set
    # CONFIG_BASE64 is not set
    # CONFIG_PRINTK_SYNC is not set
    CONFIG_MPSC_PBUF=y
    # CONFIG_SHARED_MULTI_HEAP is not set
    # CONFIG_WINSTREAM is not set
    # CONFIG_MPSC_CLEAR_ALLOCATED is not set
    CONFIG_REBOOT=y
    # CONFIG_UTF8 is not set
    CONFIG_CBPRINTF_COMPLETE=y
    # CONFIG_CBPRINTF_NANO is not set
    CONFIG_CBPRINTF_FULL_INTEGRAL=y
    # CONFIG_CBPRINTF_REDUCED_INTEGRAL is not set
    CONFIG_CBPRINTF_FP_SUPPORT=y
    # CONFIG_CBPRINTF_FP_A_SUPPORT is not set
    # CONFIG_CBPRINTF_FP_ALWAYS_A is not set
    CONFIG_CBPRINTF_N_SPECIFIER=y
    CONFIG_CBPRINTF_LIBC_SUBSTS=y
    # CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE is not set
    # CONFIG_CBPRINTF_STATIC_PACKAGE_CHECK_ALIGNMENT is not set

    There are now two options that both define floats for printf.
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y  / This is required at least by CJSON_LIB


    CONFIG_CBPRINTF_FP_SUPPORT=y / This is needed to get 
    CONFIG_MULTICELL_LOCATION_SERVICE_HERE to work

    The build fails, when I set CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=n due to CJSON_LIB dependency. Seems that CONFIG_CBPRINTF_FP_SUPPORT=y increases flash size 1632 bytes.

     At least there is a solution to the original issue. However, the need for several FLOAT_PRINTF related flags feels confusing.

Related