-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP over Wifi for Raspberry Pi Pico W in TinyGo #1
Comments
@abebeos Thank you for notifying us of this! Knowing bounty-source has an issue with payments I'd suggest no more payments be added to the link above until the issue be solved. Also fair warning to anyone who tries to solve this bounty that bounty-source may delay or omit payment. |
Just a brief note on driver status: it now connects to Wifi AP and receives Eth pkts. Link status isn't working, send Eth pkt is incomplete, and knowing when there is async work to do isn't working. Lots more work to do, including a small thing called the tcpip stack (lwip replacement). Thanks @soypat for the help and support. |
@soypat @scottfeldman Hi. What's the progress so far? It would be great if it worked! |
@Evilran, not working yet. Progress has been slow for a couple weeks, but now continuing... |
The Bounty Source links are down; seems they spent the bounty $$. |
Criminal liability: https://twitter.com/abebeos/status/1701925706526085243 |
Current status is cwy43 driver is working (sending/recv eth frames). @soypat is working on TCP/IP stack that sits on top of cwy43 driver. He's working out of this repo for the TCP/IP work: https://github.com/soypat/seqs. I'm working on porting cyrpto/tls package over from Go to TinyGo so we can use TLS sockets with cyw43. |
@scottfeldman - Fantastic updates! Thank you. |
You're welcome. The cyw43 driver is actually working really good. We used the Rust cyw43 driver for reference. Very clean implementation to copy from. rp2040 has PIO programming where you can offload your hot-loop to hardware, so all the bit-banging across the SPI bus happens from hardware (PIO), not from the software (driver). Performance should be on-par with Rust driver. I'm anxious to get some real TCP/IP perf numbers; need to find an iperf port we can run from TinyGo. Bluetooth support is still missing in our TinyGo driver, but it uses a lot of the core work already in place for the wifi driver, so if someone has time to port bluetooth from the Rust ref driver, that would be great! |
Oh, and we haven't ported over the Wifi scanning code, if someone wants to work on that. That one should be pretty easy to port and test. Just need a pico-w... If someone is interested in porting bluetooth or wifi scanning, we can help get your env set up. |
Fixed by #24. We now have a working TCP stack. What is left is to fix bugs. Let's get to testing it! Instructions on how to run it have been posted in the related tinygo issue |
This is huge... awesome work on it @soypat and others! |
BOUNTY OVER. (READ COMMENT BELOW)
Scope
The aim of this project is to implement the missing functionality needed to control the Ethernet/TCP interface on the Raspberry Pi Pico W's on board CYW43439 wifi/bluetooth chip. The way this is to be done is by implementing the Netdev interface, which is really a Berkeley Socket(2) interface via software:
Background
The development target is the RP2040 microcontroller using the Go programming language that comes in the Pico W board package. TinyGo is the compiler which lets us compile Go code to the RP2040. The CYW43439 is connected to the RP2040 (Raspberry Pi's microcontroller) via SPI where SDO and SDI are shared on the same pin. The communication today in TinyGo happens via software (bitbang) SPI.
The work done so far has been achieved by porting over the C version of the driver: georgerobotics/cyw43-driver. This driver is used by the SDK maintained by the Raspberry Pi foundation in raspberrypi/pico-sdk. Some functionality may also be needed from the
pico-sdk
repository.Work done so far
cy_io.go
.cy_ioctl.go
].(https://github.com/soypat/cyw43439/blob/main/cy_io.go).blinky.go
whd/protocol.go
andwifiOn
incy43439.go
Requirements
RFC2119 language will be used throughout this document and MUST be interpreted accordingly1, source that does not conform to this specification may be rejected as a solution to this issue. The Programmer or just Programmer is the entity which submits the pull request seeking to resolve this issue. Source is the source code submitted by the Programmer seeking to resolve this issue. The Maintainer is Patricio Whittingslow- github alias @soypat.
It is important to note that the Source will not be held to higher standards than the already existing code in this repository, so looking at existing code is a good way to get up to speed on expectations.
Code Style
See cyw43439.go
The programmer may be requested to make changes based on style. To avoid sweeping changes it is recommended the programmer show regular initial progress updates so maintainer and programmer quickly agree on the scope of code style requirements.
Source constraints
Since this project will run on a constrained system some considerations must be taken:
// reference: cy43_function_name
defer
keyword unless there is a simplicity, performance or security reason for doing so.Debug()
calls to aid in debuggingmake
calls (or large array creation) unless reference implementation allocates memory in ported section of code situation. By extension allocation packages such asfmt
must be avoided.dev
branch.lwip
like library for marshalling and unmarshalling of ethernet, IP, ARP, and TCP frames. In the case of using a third party package the Programmer MUST consult with the Maintainer on the viability of the thrid party package being included. See this comment for more information and alternatives.Documentation
Final product requirements
The Source MUST permit the compilation of the following program and said program
MUST work as detailed below in the explanation section.
Explanation
The program above makes use of existing functions that initialize the CYW43439 device
up to the ConnectWifi method call, which must itself be implemented along with all
the following method calls of the cyw43439.Device type. The Source MUST perform the
following actions when the above program is run:
Init
method.ConnectWifi
and connects toa wifi endpoint. The SSID and password are not provided directly but can be left as
hardcoded variables by the programmer to be easily modified later.
Socket
call acquires a TCP connection handle and returns an error if it is unable to acquire a functional TCP handle.Connect
attempts to connect to the IP and TCP port specified (192.168.1.1:8080). It returns an errorif the connection fails or if there is no answer back.
Connect
call the TCP connection SHOULD be established and ready for communications.The
for
loop demonstrates the correct functioning of the connection by first usingSend
to send bytes to the listener and
Recv
to receive bytes from the listener.Most of the above program can be summarized as follows:
The Source should seek to implement the Linux Socket(2) interface for the CYW43439 using TinyGo.
Caveat: It is possible that the Source will include use of a
lwip
like library formarshalling Ethernet, ARP, IP and TCP packets received. The Source can choose
to use an external library for this matter but MUST first consult with the Maintainer. See relevant comment.
Aid
The Maintainer can provide facilities to help the Programmer debug, these include
but are not limited to:
Footnotes
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. ↩
The text was updated successfully, but these errors were encountered: