-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add networking stack from TinyUSB. #334
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be useful; not sure why some things are on tinyusb_common, and some on tinyusb_host and none on tinyusb_net!
Rebased to the latest branch. :) |
@@ -93,6 +94,13 @@ if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH}) | |||
${PICO_TINYUSB_PATH}/src/class/vendor/vendor_host.c | |||
) | |||
|
|||
add_library(tinyusb_net INTERFACE) | |||
target_sources(tinyusb_host INTERFACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
presumably you meant tinyusb_net here
I've been playing around with the rndis stuff in tiny usb. I can't really see the point of running a dhcp server on the device. What would you use this for? It would be nicer if dhcp could somehow obtain an address for the pico and use that as a network to get access to the internet. But I can't really get network sharing to work reliably. It looks like it sort of works on Windows if you're lucky. I'm not sure I can get it to work at all on Ubuntu. Unless this is easy to use, I can't really see this being worth it? |
I mean, this is not the easiest way to get data out of the Pico. But, unfortunately, it's the only way to do it with a decent speed without extra hardware. I can get a stable 5 Mbps running an Regarding compatibility, the current version of the PiccoloSDR, which uses this PR, works very well with Linux and macOS (including Apple Silicon). You plug it in, an IP is automatically assigned, and you can access it with zero configuration. I never tested this on Windows, but looks like Microsoft added support to USB NCM on Windows 11. This theoretically solves support for Windows. While developing PiccoloSDR, a major hurdle was patching the SDK to give me the right headers and binaries. The actual development of the network application was trivial. This PR comes at almost zero cost for those who don't use this feature while significantly facilitating the development process of network apps for those who need it. |
i'm just confused by the PR in general; why are existing libraries being modified; can you just not add a new "tinyusb_net library"? |
I guess you could, but tiny usb already seems to pile everything into tinyusb_device_base? What's more confusing is that this doesn't live in the pico-sdk anymore. We're missing networking/rndis_reports.c and the include folder lib/networking, which are easy enough to add to your own project. I'm more interested in knowing if we can use this for real. |
@luigifcruz Sorry, I missed your comment. So your use case is just to connect two computers and communicate with IP stacks. The IP address comes from the Pico - effectively a small private network. |
I am trying to build a subsampling receiver, learning as I go, and to my surprise the excellent demo from luigifcruz wouldn't work with stock SDK. 😅 Now seriously, using UDP to stream data over USB is a decent idea and with DHCP server it works out-of-box. I believe that USB tethering on Android works like that as well. It saves you the hassle of configuring network interfaces manually or writing specific device drivers. I can imagine using it like that in a classroom setting. (Sorry for butting in just to +1.) |
@luigifcruz @mordae Did you test by connecting to Windows or a Linux PC? I still don't seem to get an IP address when connecting to Linux. |
Ignore me - I had a static IP address assigned. It worked ok after I removed this. |
I'm not sure if this is a path the maintainers want to pursue. But I added a
tinyusb_net
target on CMakeLists to import the necessary headers and files to make it possible to use the Pico as a network device based on the RNDIS example from TinyUSB.As of now, I use these patches to build my PiccoloSDR project without known problems.