nrf5340 Enabling WiFi

This ticket is the continuation and related to the previous ticket on the matter:
https://devzone.nordicsemi.com/f/nordic-q-a/121669/enabling-the-tls-layer-to-get-a-https-connection-going

Here is the full project in this link:

files.ro/.../uheAZuqLyOqf61U7

(note: the link has a 24H expiry date)

The way I build and flash is:

- navigate in terminal to /Users/tudor/Documents/GitHub/micropython_nrf/ports/zephyr

- run this command once: west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine 

- run this command 2-3 times to make the build succeed: west build -b nrf7002dk/nrf5340/cpuapp/ns

- then flash normally with: west flash

To run the connection: open the usb serial and this should bring the MicroPython REPL up. Example of normal startup:

[00:00:00.382,019] <inf> wifi_nrf: Configuring SLEEP CTRL GPIO control register

[00:00:00.518,493] <dbg> net_dns_resolve: dns_resolve_init_locked: (main): [0] 8.8.8.8
[00:00:00.526,977] <dbg> net_dns_resolve: dns_resolve_init_locked: (main): [1] 8.8.4.4
[00:00:00.535,736] <dbg> net_sock: zsock_socket_internal: (main): socket: ctx=0x2000a9a0, fd=3
[00:00:00.544,952] <dbg> net_sock_svc: socket_service_thread: (net_socket_service): Service WEST_TOPDIR/zephyr/subsys/net/lib/dhcpv4/dhcpv4_server.c:1535 has 1 pollable sockets
[00:00:00.561,187] <dbg> net_sock_svc: socket_service_thread: (net_socket_service): Service WEST_TOPDIR/zephyr/subsys/net/lib/dns/resolve.c:41 has 2 pollable sockets
[00:00:00.576,477] <dbg> net_sock_svc: socket_service_thread: (net_socket_service): Monitoring 3 socket entries
[00:00:00.587,493] <dbg> net_sock: zsock_socket_internal: (main): socket: ctx=0x2000aa50, fd=5
*** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
*** Using Zephyr OS v4.0.99-a0e545cb437a ***
[00:00:00.606,323] <inf> net_config: Initializing network
[00:00:00.612,121] <inf> net_config: Waiting interface 1 (0x20008e00) to be up...
[00:00:00.621,063] <inf> wifi_supplicant: wpa_supplicant initialized
[00:00:00.628,326] <inf> net_config: IPv4 address: 192.168.1.1
[00:00:00.634,582] <inf> net_config: Running dhcpv4 client...
MicroPython v1.24.0-preview.469.g54a132e70.dirty on 2025-06-17; zephyr-nrf7002dk with nrf5340
Type "help()" for more information.
>>>

In REPL, run the commands:

import sock_test

sock_test.do_steps()

This executes the function inside the python file located at: /Users/tudor/Documents/GitHub/micropython_nRF/ports/zephyr/modules/sock_test.py

That file is designed as a script that essentially emulates the behaviour of the of the https_sample since it connects to the WiFi, gets DNS address, brings up a socket and connects it to google.com and then tries the request from line 79:

httpreq = 'HEAD / HTTP/1.1 \r\nHost: '+ host +":"+ str(port) +'\r\nConnection: close\r\n\r\n'

Note:

Lines 27 and 29 are very important:

# wlan.scan()

wlan.connect("TP-Link_7474", "55920322", network.SECURITY_PSK, 4)

Scan is there and commented since for wlan.connect() you need to provide the channel number as the final parameter.

Parents
  • Hi Tudor

    I am not sure if I understand what the problem is. Is it that you are not getting a reply coming from the local host, like you explain in the message?

    Also, if you are concerned about the privacy of the project you've shared here I can make the ticket private. Currently, what you've shared is open for everyone to see.

    Regards,

    Elfving

  • Hey Elfving,

    This is the second topic on the matter; see my previous link.

    Yes, it would be great to make this ticket private. :)

    Edit: to elaborate on the matter:

    we're trying to get WiFi + sockets TLS connection to google.com while also using MicroPython. We started off from a MicroPython port and then used the WiFi sample and the https_client sample to reach the point described in this ticket.

    I put the whole project here because in the previous ticket there was a lot of ping-pong going on as Hakon was trying to manually get the diffs from me to reproduce the issue on his side. I've asked him but I'll try with you also: would it be possible to have a call so we can quickly solve the issue on my side and then post the answer here Elfving?

Reply
  • Hey Elfving,

    This is the second topic on the matter; see my previous link.

    Yes, it would be great to make this ticket private. :)

    Edit: to elaborate on the matter:

    we're trying to get WiFi + sockets TLS connection to google.com while also using MicroPython. We started off from a MicroPython port and then used the WiFi sample and the https_client sample to reach the point described in this ticket.

    I put the whole project here because in the previous ticket there was a lot of ping-pong going on as Hakon was trying to manually get the diffs from me to reproduce the issue on his side. I've asked him but I'll try with you also: would it be possible to have a call so we can quickly solve the issue on my side and then post the answer here Elfving?

Children
No Data
Related