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

Asset Tracker V1 and DHCP/HTTP

Hi,

I am trying to add an IPv4 HTTP client post-action into the asset tracker v1 app, I have a couple of questions.

I am looking at the http_client and DHCP client samples, I would like to make a POST to a web server using the LTE data connection which bypasses the cloud setup.

When the modem connects to the cloud (using nnRFCloud) does it already get assigned an IPv4 address? If so, how can I access this address for use with the http_client module?

I have tried to merge the IPv4 DHCP client, but the build fails with:

undefined reference to `net_dhcpv4_init' in net_core.c

I have the following prj.conf entries:

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y

CONFIG_NET_IPV4=y
CONFIG_NET_ARP=y
CONFIG_NET_UDP=y
CONFIG_NET_DHCPV4=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_INIT_STACKS=y
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
# Network address config
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.0.192"
CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.0.1"

# HTTP
CONFIG_HTTP_CLIENT=y
CONFIG_SLIP_STATISTICS=n
CONFIG_NET_SHELL=y

Many thanks for your help

  • Hi!

    When the modem connects to the cloud (using nnRFCloud) does it already get assigned an IPv4 address? If so, how can I access this address for use with the http_client module?

    The IP connectivity is usually provided after the APN is successfully activated: +CGEV.

    However, this does not give you the local IP address directly, which must be queried using AT+CGDCONT?.
    undefined reference to `net_dhcpv4_init' in net_core.c

     As for this, could you send me the whole application so I can reproduce it? Or the .config file from the build? You're probably just missing some configuration. 

    Best regards,
    Heidi
Related