Pico - USB (host) in and (device) out

Ғылым және технология

code can be found here
github.com/brendena/pico_devi...
Page for the project that made the PIO USB driver
github.com/sekigon-gonnoc/Pic...

Пікірлер: 80

  • @RonSheely
    @RonSheely8 ай бұрын

    Thank you Brenden. Good presentation. Clear, concise, and helpful.

  • @brendenadamczak9283

    @brendenadamczak9283

    8 ай бұрын

    Glad you like it :)

  • @vsmash2
    @vsmash2 Жыл бұрын

    This is exactly what i tried to get to work! very helpful!

  • @vsmash2

    @vsmash2

    Жыл бұрын

    Sadly it doesn't work with the keyboard i got, it gets recognized but then the polling doesnt start, trying a ma3421E with arduino next.

  • @abhishekak9619
    @abhishekak9619 Жыл бұрын

    Thank you. This is very helpfull

  • @dazealex
    @dazealex Жыл бұрын

    Pretty cool!

  • @jaxx-ce9cd
    @jaxx-ce9cd3 ай бұрын

    Will it work if I connect a mouse instead of a keyboard, will i have to make some changes on the code for that? I see the code has functions regarding mouse events as well

  • @murrij
    @murrij6 ай бұрын

    Really cool video. How do you not have more views.

  • @brendenadamczak9283

    @brendenadamczak9283

    6 ай бұрын

    I'm glad you liked it so much. As for the view count, I don't have any cats or funny faces in my thumbnail. So that's why it's so low 😂

  • @AndrewHelgeCox
    @AndrewHelgeCox5 ай бұрын

    Do you know a good introduction to the details of USB to give some context before diving in to a particular implementation like this code?

  • @brendenadamczak9283

    @brendenadamczak9283

    5 ай бұрын

    I made a video on usb kzread.info/dash/bejne/mHl40ptpZZbLitY.html. also this is the first one you should probably watch. kzread.info/dash/bejne/q32Mw49vdLW9Xbw.html

  • @metaloidx
    @metaloidx9 ай бұрын

    That's crazy. I use that same Nvidia Shield micro usb cable to plug in my pico 🤣

  • @matgaw123
    @matgaw1233 ай бұрын

    Pico its just awesome

  • @brendenadamczak9283

    @brendenadamczak9283

    3 ай бұрын

    true :)

  • @THE_CHEEESE_LORD
    @THE_CHEEESE_LORD5 ай бұрын

    i like cheese

  • @ClacKeyTech
    @ClacKeyTechАй бұрын

    how can i use the keyboard inputs for the pico, like pressing a key for like lighting up an led when caps lock is activated or something? like that, could be pretty useful imo

  • @brendenadamczak9283

    @brendenadamczak9283

    Ай бұрын

    Well in the main loop you can look for a given pin and toggle it high. If its helpful i have a simpler version of this, which is just a keyboard input. kzread.info/dash/bejne/q32Mw49vdLW9Xbw.html

  • @Nathendov
    @Nathendov Жыл бұрын

    Great work! This is exactly what I am trying to do now. I have been researching this for quite a while. Is there a way to inject my own response if certain keys are pressed? For example assigning "ALT + T" to print "K"?

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    Totally you can do what ever you want basically. The call that send out the keyboard messages looks like this.

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, report);

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    here's what the report looks like. wiki.osdev.org/USB_Human_Interface_Devices#USB_keyboard

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    So basically you just want to look at the host keyboard usb report and modify that pass it into the device usb report

  • @abhishekak9619

    @abhishekak9619

    Жыл бұрын

    their is autohotintercelption which can do this and it can also distinguish between different keyboards.

  • @volkanbey1355
    @volkanbey1355 Жыл бұрын

    Great work! thanks for sharing, i am also trying to connect a mouse , can i use same code or i need to modify much ? thanks

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    Very similar. You just have to use the function process_mouse_report function like we did for the process_keyboard_report function. From there, their's example online that you can find that will tell you how to use usb mice's.

  • @Quazee137
    @Quazee1372 ай бұрын

    Can this do SD card so the input key data can be looked up in SD card and output a string to computer? Being able to make any keypad/board a helper for disabled persons. Maybe include mouse functions so a single key press can be mapped to fixed mouse locations. Could work as a OS independent macro keypad/board. Also a kind of steam deck.

  • @brendenadamczak9283

    @brendenadamczak9283

    2 ай бұрын

    I don't think you could do all of this. So you want to add a SD card like configuration file?

  • @jesusderechte3889
    @jesusderechte388911 ай бұрын

    Hey, amazing video! How can you receive the Keyboard input via the usb port?

  • @brendenadamczak9283

    @brendenadamczak9283

    11 ай бұрын

    If your looking for a more in-depth video on USB keyboard host you can watch this. kzread.info/dash/bejne/q32Mw49vdLW9Xbw.html

  • @theyounewb
    @theyounewb7 ай бұрын

    I might have missed this but... What is the maximum poll rate the Pico can support on the the PIO-based USB port?

  • @brendenadamczak9283

    @brendenadamczak9283

    7 ай бұрын

    Poll rate? Is this poll rate related to a specific USB specification your trying to use. So it support USB FS, which is a 12 MHZ signal.

  • @kennyhubbell813
    @kennyhubbell8137 ай бұрын

    This is great! I have been using the Earle Philhower Arduino core since I started using the Pico. Do you have any tips on how to make use of your code and keep using the Philhower core?

  • @brendenadamczak9283

    @brendenadamczak9283

    7 ай бұрын

    Not entirely sure? So it goes PIO_USB_code -> tinyUSB -> arduino driver -> [use it in your code]

  • @brendenadamczak9283

    @brendenadamczak9283

    7 ай бұрын

    So you would have to add PIO_code and add the arduino drivers for USB host and setup all the configurations for it. In the actual arduino build. At least thats my interpretation of it. I don't know if can access the low level pio code parts once your running the arduino software.

  • @brendenadamczak9283

    @brendenadamczak9283

    7 ай бұрын

    But i've only ever programmed a normal arduino. So my understanding could be completely off. Its been a long time since i've tried to program one and it was just for turning on little leds and stuff like that.

  • @kennyhubbell813

    @kennyhubbell813

    6 ай бұрын

    @@brendenadamczak9283 I did manage to get it working, but now I'm wondering if you have any tips for connecting two USB devices to the Pico at once? Like both a mouse and keyboard. I can get them both to properly send the HID codes when connected separately, but I'm not sure how to do both simultaneously. I have attempted to create two TinyUSB host instances, each with their own pio_config with the respective D+ pin, but only the first device works in that instance.

  • @brendenadamczak9283

    @brendenadamczak9283

    6 ай бұрын

    @@kennyhubbell813 So it sounds like your trying to connect two usb devices from two different usb connections. Is that true? So i made a devices that would take two usb devices that were connected to a usb hub. kzread.info/dash/bejne/c4h7vKZrcdysm8Y.html. Code here github.com/brendena/USB_to_PS2_pico

  • @bflmpsvz870
    @bflmpsvz8705 ай бұрын

    Out stan ding!

  • @mvs1c356
    @mvs1c35611 ай бұрын

    Great work! Is it possible to change the GPIO pins of the usb Data+ and Data-?

  • @brendenadamczak9283

    @brendenadamczak9283

    8 ай бұрын

    Yes this sets the pins value PIO_USB_CONFIG. github.com/brendena/pico_device_and_host/blob/main/main_host.c

  • @fgregerfeaxcwfeffece

    @fgregerfeaxcwfeffece

    4 ай бұрын

    @@brendenadamczak9283How does that work? It only defines one pin and I tracked it down to: hcd_configure( which leads to some application of a struct that I have yet to track down. Is the pin it provides(1?) data + or - is the second pin 2 or 0? Am I even on the right track did I interpret this DP correctly as "Data Pin"?

  • @brendenadamczak9283

    @brendenadamczak9283

    4 ай бұрын

    @@fgregerfeaxcwfeffece It's been a a long time since i looked at this code, But i'm guessing if you replaced PIO_USB_TX_DEFAULT, with a another gpio it will probably work

  • @fgregerfeaxcwfeffece

    @fgregerfeaxcwfeffece

    4 ай бұрын

    @@brendenadamczak9283Okay, that would have taken a LOT of experimentation. Since I assumed that to be some setting for the com interface you are using additionally. As from my understand USB Data+/- is not transmit (TX) and receive (RX) but just Data and the same data inverted. So labeling one of those as TX seems let's say "counterintuitive". What is your wiring? Which GPIO is Data+ and which is Data -?

  • @brendenadamczak9283

    @brendenadamczak9283

    4 ай бұрын

    @@fgregerfeaxcwfeffece So this was just taken from the project that made the driver for PIO USB. github.com/sekigon-gonnoc/Pico-PIO-USB/blob/0f747aaa0c16f750bdfa2ba37ec25d6c8e1bc117/src/pio_usb_configuration.h#L38C9-L38C31

  • @tompaquette7138
    @tompaquette713810 ай бұрын

    Could you use this to have a, for example, USB game controller input and a specific console like the ps2 output?

  • @brendenadamczak9283

    @brendenadamczak9283

    9 ай бұрын

    Sure, the PS2 doesn't use usb for its controller. It has some weird spi interface. Well maby it can use because there's a usb port on it can the rock band controllers work over usb?

  • @tompaquette7138

    @tompaquette7138

    9 ай бұрын

    @@brendenadamczak9283 if they can engineer ps2 to usb adapter you wouldn't think it would be I possible to transpose USB to SPI the same way.

  • @brendenadamczak9283

    @brendenadamczak9283

    8 ай бұрын

    @@tompaquette7138 If you use the pico to take in USB and output spi. This should be no problem. I made the above comment because this video shows you how to do usb in and usb out. Which i think you could do. It just might need some weird usb driver.

  • @MineOrebaker
    @MineOrebaker Жыл бұрын

    Hii man I also want to create two usb output at once is it possible? ?

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    So by output are you meaning devices? Currently tiny usb doesn't support having more then 1 device or host.

  • @MineOrebaker

    @MineOrebaker

    Жыл бұрын

    @@brendenadamczak9283 my problem is my puco is showing his firmware I dont want to show that so thier is any possible way to.fix this problem ??

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    @@MineOrebaker Can you describe the problem again?

  • @mealshake4284
    @mealshake42846 ай бұрын

    I want to plug my PCB to Pico through the USB and enable it to communicate with my PC Software through wifi, is it possible ?

  • @brendenadamczak9283

    @brendenadamczak9283

    6 ай бұрын

    Probably? So the pico has a wifi board if that makes it easier for you? Then you potentially wouldn't need this PCB board? But to the original question yes. From you pcb you can talk to the pico over the same cable that powers it. You'll want to use the CMC class, which is basically a uart stream of data.

  • @mealshake4284

    @mealshake4284

    6 ай бұрын

    @@brendenadamczak9283 actually i'm using a device stm32 as USB CDC it's the same ?

  • @brendenadamczak9283

    @brendenadamczak9283

    6 ай бұрын

    @@mealshake4284 So this is how it sounds to me [STM32 PCB ] (USB Host) -> (USB Client)[Pico](WIFI) -> (WIFI) [PC]

  • @brendenadamczak9283

    @brendenadamczak9283

    6 ай бұрын

    If thats the case it should work no problem. The pico is just acting as a relay at that pont. Put a little ZMQ server on the pico and your all set to talk to your pc

  • @mealshake4284

    @mealshake4284

    6 ай бұрын

    @@brendenadamczak9283 exactly, my stm32 works as a device

  • @mealshake4284
    @mealshake42844 ай бұрын

    How can i implement a host usb vendor specific ?

  • @brendenadamczak9283

    @brendenadamczak9283

    4 ай бұрын

    I've never done it. But the first step would be to set the flag for vender specific. github.com/hathach/tinyusb/blob/master/examples/host/hid_controller/src/tusb_config.h#L108

  • @brendenadamczak9283

    @brendenadamczak9283

    4 ай бұрын

    It should look like a much simpler version of the keyboard host example. kzread.info/dash/bejne/q32Mw49vdLW9Xbw.html. Here are the calls github.com/hathach/tinyusb/blob/master/src/class/vendor/vendor_host.h

  • @brendenadamczak9283

    @brendenadamczak9283

    4 ай бұрын

    Just to make sure what are you trying to interface too? Are you sure its a vender specific device?

  • @sss22215
    @sss222156 ай бұрын

    ...\pico-sdk\lib\tinyusb\src\portable aspberrypi\pio_usb\hcd_pio_usb.c:32:10: fatal error: pio_usb.h: No such file or directory i face such difficulty while compiling , any way to over come , kindly help if possible

  • @brendenadamczak9283

    @brendenadamczak9283

    6 ай бұрын

    So if you look inside "Pico-usb-pio" do you see anything? If not do this "git submodule init" then "git submodule update". Then you should see files in there. Hopefully it builds after that. If that was your problem thats my bad and i updated the docs. If not just message me and i'll try again :)

  • @sss22215

    @sss22215

    6 ай бұрын

    @@brendenadamczak9283 [driver] Build completed: 00:01:30.302 [build] Build finished with exit code 0 done , instead of using cmd , i downloaded code form git as zip and tried to compile thanks

  • @Songpon10123aranmala
    @Songpon10123aranmala Жыл бұрын

    i need MIDI USB HOST CLASS arduino

  • @brendenadamczak9283

    @brendenadamczak9283

    Жыл бұрын

    Well this won't totally help you, but the next video i'm working on is midi usb host on the raspberry pi pico. It might help you out some way.

  • @benreeck5817

    @benreeck5817

    Жыл бұрын

    @@brendenadamczak9283 Trying this too! Cant get it to work unfortunately. I have a Launchpad and I want to use it Standalone with the Pico as the Host. Looking forward to the next video!

Келесі