[W600 Pico] Uart to TCP problems

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
daple
Posts: 1
Joined: Tue May 26, 2020 1:16 am

[W600 Pico] Uart to TCP problems

Post by daple » Tue May 26, 2020 3:13 am

I wanted to start toying with this board by making a simple little UART to TCP bridge, but ran into a couple of problems.

The UART does seem to work with poll.

Code: Select all

>>> from machine import UART
>>> uart = UART(1, 115200)
>>>
>>> import select
>>> po = select.poll()
>>> po.register(uart, select.POLLIN)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: stream operation not supported
UART doesn't support any()

Code: Select all

>>> uart.any()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'UART' object has no attribute 'any'
I might not understand how poll is supposed to work. In the following, I make a connection with netcat, enter some text which should mean data is ready for input, but poll just blocks:

Code: Select all

>>> import socket
>>> import select
>>>
>>> server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> server.bind(('0.0.0.0', 8000))
>>> server.listen(0)
>>>
>>> client, addr = server.accept()
>>> print("connection from ", addr)
connection from  ('192.168.0.124', 55362)
>>>
>>> client.settimeout(0)
>>>
>>> po = select.poll()
>>> po.register(client, select.POLLIN)
>>>
>>> events = po.poll()
Any ideas would be welcomed. The board is running:

Code: Select all

MicroPython v1.10-282-g6a9b3cb-dirty on 2019-09-17; WinnerMicro module with W600

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: [W600 Pico] Uart to TCP problems

Post by Roberthh » Tue May 26, 2020 6:05 am

The mentioned W600 firmware has a few omissions. You may try the image from this place: https://github.com/robert-hh/Shared-Stuff
It has a few fixes, like providing uart.any(). And it is based on the latest micropython release.
I do not know if it helps in your case, but you could try.

Post Reply