soypat / cyw43439

Driver for the Wifi+bluetooth integrated circuit on the pico.
MIT License
119 stars 6 forks source link

MQTT example v2 #43

Closed soypat closed 6 months ago

soypat commented 7 months ago

Tested against a local comqtt server. After a while of working correctly the TCP connection seems to have desynced on the pico's side. Might be a bug in the TCP implementation on seqs side, would be nice to get this tested on different computers and get a wide variety of wireshark captures.

soypat commented 7 months ago

Here's a log of it working:

``` $ tinygo flash -target=pico -stack-size=8kb -monitor ./examples/mqtt Connected to /dev/ttyACM0. Press Ctrl-C to exit. time=1970-01-01T00:00:01.585Z level=INFO msg=cyw43439:Init duration=1.581329s time=1970-01-01T00:00:01.586Z level=INFO msg="joining WPA secure network" ssid="WHITTINGSLOW 2.4" passlen=10 time=1970-01-01T00:00:05.031Z level=INFO msg="wifi join success!" mac=28:cd:c1:05:4d:bb time=1970-01-01T00:00:05.033Z level=INFO msg="DHCP ongoing..." time=1970-01-01T00:00:05.035Z level=INFO msg=DHCP:tx msg=Discover time=1970-01-01T00:00:05.085Z level=INFO msg=DHCP:rx msg=Offer time=1970-01-01T00:00:05.086Z level=INFO msg=DHCP:tx msg=Request time=1970-01-01T00:00:05.136Z level=INFO msg=DHCP:rx msg=Ack time=1970-01-01T00:00:05.534Z level=INFO msg="DHCP complete" cidrbits=24 ourIP=192.168.0.68 dns=192.168.0.1 broadcast=192.168.0.255 gateway="invalid IP" router=192.168.0.1 dhcp=192.168.0.1 hostname=tinygo-mqtt lease=1h0m0s renewal=30m0s rebinding=52m30s time=1970-01-01T00:00:05.667Z level=INFO msg=socket:listen time=1970-01-01T00:00:05.748Z level=INFO msg=TCP:rx-statechange port=14326 old=SynSent new=Established rxflags=[SYN,ACK] time=1970-01-01T00:00:05.758Z level=INFO msg=mqtt:start-connecting time=1970-01-01T00:00:05.925Z level=INFO msg="published message" packetID=19 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:00:15.962Z level=INFO msg="published message" packetID=20 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:00:25.999Z level=INFO msg="published message" packetID=21 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:00:36.036Z level=INFO msg="published message" packetID=22 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:00:46.073Z level=INFO msg="published message" packetID=23 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:00:56.110Z level=INFO msg="published message" packetID=24 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:01:06.147Z level=INFO msg="published message" packetID=25 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:01:16.184Z level=INFO msg="published message" packetID=26 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:01:26.220Z level=INFO msg="published message" packetID=27 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:01:36.257Z level=INFO msg="published message" packetID=28 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:01:46.294Z level=INFO msg="published message" packetID=29 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:01:56.331Z level=INFO msg="published message" packetID=30 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:02:06.368Z level=INFO msg="published message" packetID=31 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:02:16.405Z level=INFO msg="published message" packetID=32 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:02:26.442Z level=INFO msg="published message" packetID=33 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:02:36.479Z level=INFO msg="published message" packetID=34 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:02:46.516Z level=INFO msg="published message" packetID=35 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:02:56.553Z level=INFO msg="published message" packetID=36 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:03:06.590Z level=INFO msg="published message" packetID=37 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:03:16.627Z level=INFO msg="published message" packetID=38 time=1970-01-01T00:03:16.797Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:03:26.664Z level=INFO msg="published message" packetID=39 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:03:36.701Z level=INFO msg="published message" packetID=40 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:03:46.738Z level=INFO msg="published message" packetID=41 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:03:56.774Z level=INFO msg="published message" packetID=42 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:04:06.811Z level=INFO msg="published message" packetID=43 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:04:16.848Z level=INFO msg="published message" packetID=44 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:04:26.885Z level=INFO msg="published message" packetID=45 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:04:36.922Z level=INFO msg="published message" packetID=46 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:04:46.959Z level=INFO msg="published message" packetID=47 mqtt:handle-next-failed i/o timeout time=1970-01-01T00:04:52.270Z level=ERROR msg=tcb:rcv.reject err="reject in/out seg: seq not in snd/rcv.wnd" time=1970-01-01T00:04:56.996Z level=INFO msg="published message" packetID=48 time=1970-01-01T00:04:57.064Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:05:07.033Z level=INFO msg="published message" packetID=49 time=1970-01-01T00:05:07.111Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:05:17.070Z level=INFO msg="published message" packetID=50 time=1970-01-01T00:05:17.158Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:05:27.107Z level=INFO msg="published message" packetID=51 time=1970-01-01T00:05:27.205Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:05:37.144Z level=INFO msg="published message" packetID=52 time=1970-01-01T00:05:37.201Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:05:47.181Z level=INFO msg="published message" packetID=53 time=1970-01-01T00:05:47.249Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:05:57.218Z level=INFO msg="published message" packetID=54 time=1970-01-01T00:05:57.296Z level=ERROR msg=tcb:rcv.reject err="drop segment" mqtt:handle-next-failed i/o timeout time=1970-01-01T00:06:07.088Z level=INFO msg=TCP:rx-statechange port=14326 old=Established new=CloseWait rxflags=[FIN,ACK] time=1970-01-01T00:06:07.089Z level=INFO msg=TCP:tx-statechange port=14326 old=CloseWait new=LastAck txflags=[FIN,ACK] time=1970-01-01T00:06:07.139Z level=ERROR msg=tcb:rcv.reject err="use of closed network connection" time=1970-01-01T00:06:07.140Z level=INFO msg=TCP:rx-abort time=1970-01-01T00:06:07.255Z level=ERROR msg=mqtt:publish-failed reason="use of closed network connection" time=1970-01-01T00:06:07.256Z level=INFO msg="published message" packetID=55 mqtt:handle-next-failed use of closed network connection time=1970-01-01T00:06:12.255Z level=ERROR msg=mqtt:publish-failed reason="use of closed network connection" time=1970-01-01T00:06:12.256Z level=INFO msg="published message" packetID=56 mqtt:handle-next-failed use of closed network connection time=1970-01-01T00:06:17.255Z level=ERROR msg=mqtt:publish-failed reason="use of closed network connection" time=1970-01-01T00:06:17.256Z level=INFO msg="published message" packetID=57 mqtt:handle-next-failed use of closed network connection time=1970-01-01T00:06:22.255Z level=ERROR msg=mqtt:publish-failed reason="use of closed network connection" time=1970-01-01T00:06:22.256Z level=INFO msg="published message" packetID=58 mqtt:handle-next-failed use of closed network connection time=1970-01-01T00:06:27.255Z level=ERROR msg=mqtt:publish-failed reason="use of closed network connection" time=1970-01-01T00:06:27.256Z level=INFO msg="published message" packetID=59 mqtt:handle-next-failed use of closed network connection time=1970-01-01T00:06:32.255Z level=ERROR msg=mqtt:publish-failed reason="use of closed network connection" time=1970-01-01T00:06:32.256Z level=INFO msg="published message" packetID=60 mqtt:handle-next-failed use of closed network connection ```
soypat commented 6 months ago

Seems to work, will be pushing it more at work to find more bugs but this seems like a good starting point.