DeeJay / WizFi360-EVB-Pico-microPython

0 stars 0 forks source link

Initial practical experience #2

Open DeeJay opened 2 years ago

DeeJay commented 2 years ago

Simply powering up the WizFi360-EVB-Pico and monitoring it with mpremote shows that the board comes pre-loaded with a simple P.O.S.T.

It emits the following about once a second -

AT+CIPSTAMAC_CUR?
+CIPSTAMAC_CUR:"00:08:dc:69:e2:b9"

OK

It doesn't look much, but as a POST it conveys quite a lot of information

I have used picotool to take a backup copy of the pre-installed .uf2 in case it is needed for later debugging. The Pico has been 'nuked' and then the pre-installed .uf2 re-flashed. It still runs.

DeeJay commented 2 years ago

Flashed the onboard RP2040 with a recent nightly build of MicroPython 1.19.1 - rp2-pico-20220729-unstable-v1.19.1-223-g963e599ec.uf2

This looks promising -

MicroPython v1.19.1 on 2022-07-29; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> from machine import UART
>>> wifi = UART(1,115200)
>>> wifi.write(("AT+GMR" + "\r\n").encode())
8
>>> res = wifi.read()
>>> res.decode()
'AT+GMR\r\nAT version:1.1.1.7(May  4 2021 15:14:59)\r\nSDK version:3.2.0(a0ffff9f)\r\ncompile time:May  4 2021 15:14:59\r\n\r\nOK\r\n'
>>>

Confirmation that MicroPython code on the rp2040 can interact with the WizFi360 module AT firmware over its serial UART.

Disappointing that a device shipped directly from WIZnet Germany on 20th July is not running the latest firmware.

DeeJay commented 2 years ago

Associated with ('joined') an AP, got an IP address assigned by DHCP, on the network and responding to a ping from a Windows PC -

>>> wifi.write(("AT+CWJAP_CUR=\""+ssid+"\",\""+psk+"\"" + "\r\n").encode())

>>> wifi.write(("AT+CIPSTA_CUR?"+ "\r\n").encode())
16
>>> res = wifi.read()
>>> print(res.decode())
AT+CIPSTA_CUR?
+CIPSTA_CUR:ip:"192.168.1.213"
+CIPSTA_CUR:gateway:"192.168.1.1"
+CIPSTA_CUR:netmask:"255.255.255.0"

OK
C:\Users\David>ping 192.168.1.213

Pinging 192.168.1.213 with 32 bytes of data:
Reply from 192.168.1.213: bytes=32 time=101ms TTL=255
Reply from 192.168.1.213: bytes=32 time=14ms TTL=255
Reply from 192.168.1.213: bytes=32 time=21ms TTL=255
Reply from 192.168.1.213: bytes=32 time=29ms TTL=255

Ping statistics for 192.168.1.213:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 14ms, Maximum = 101ms, Average = 41ms

C:\Users\David>
DeeJay commented 2 years ago

mqtt - wifi.write(("AT+MQTTSET="+uid+","+pwd+","+client+",60" +"\r\n").encode()) wifi.write(("AT+MQTTTOPIC="+topic+","+topic +"\r\n").encode()) wifi.write(("AT+MQTTCON=0,\"192.168.1.202\",1883" +"\r\n").encode()) wifi.write((f'AT+MQTTPUB="{msg}"' + '\r\n').encode())