Тёмный

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

Brenden Adamczak
Подписаться 826
Просмотров 17 тыс.
50% 1

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...

Наука

Опубликовано:

 

6 май 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 80   
@RonSheely
@RonSheely 8 месяцев назад
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.
@jaxx-ce9cd
@jaxx-ce9cd 4 месяца назад
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
@abhishekak9619
@abhishekak9619 Год назад
Thank you. This is very helpfull
@dazealex
@dazealex Год назад
Pretty cool!
@AndrewHelgeCox
@AndrewHelgeCox 6 месяцев назад
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 6 месяцев назад
I made a video on usb ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-fEDp9053eZs.html. also this is the first one you should probably watch. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-yIXa-6DRW-Y.html
@ClacKeyTech
@ClacKeyTech 2 месяца назад
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 2 месяца назад
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. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-yIXa-6DRW-Y.html
@Quazee137
@Quazee137 3 месяца назад
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 3 месяца назад
I don't think you could do all of this. So you want to add a SD card like configuration file?
@murrij
@murrij 6 месяцев назад
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 😂
@matgaw123
@matgaw123 4 месяца назад
Pico its just awesome
@brendenadamczak9283
@brendenadamczak9283 4 месяца назад
true :)
@metaloidx
@metaloidx 9 месяцев назад
That's crazy. I use that same Nvidia Shield micro usb cable to plug in my pico 🤣
@theyounewb
@theyounewb 8 месяцев назад
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 8 месяцев назад
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.
@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.
@THE_CHEEESE_LORD
@THE_CHEEESE_LORD 5 месяцев назад
i like cheese
@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.
@tompaquette7138
@tompaquette7138 10 месяцев назад
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 9 месяцев назад
@@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.
@bflmpsvz870
@bflmpsvz870 5 месяцев назад
Out stan ding!
@kennyhubbell813
@kennyhubbell813 7 месяцев назад
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. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ATGZD2AyFkc.html. Code here github.com/brendena/USB_to_PS2_pico
@jesusderechte3889
@jesusderechte3889 Год назад
Hey, amazing video! How can you receive the Keyboard input via the usb port?
@brendenadamczak9283
@brendenadamczak9283 Год назад
If your looking for a more in-depth video on USB keyboard host you can watch this. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-yIXa-6DRW-Y.html
@mvs1c356
@mvs1c356 11 месяцев назад
Great work! Is it possible to change the GPIO pins of the usb Data+ and Data-?
@brendenadamczak9283
@brendenadamczak9283 9 месяцев назад
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
@sss22215
@sss22215 6 месяцев назад
...\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
@mealshake4284
@mealshake4284 6 месяцев назад
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
@mealshake4284 5 месяцев назад
How can i implement a host usb vendor specific ?
@brendenadamczak9283
@brendenadamczak9283 5 месяцев назад
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 5 месяцев назад
It should look like a much simpler version of the keyboard host example. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-yIXa-6DRW-Y.html. Here are the calls github.com/hathach/tinyusb/blob/master/src/class/vendor/vendor_host.h
@brendenadamczak9283
@brendenadamczak9283 5 месяцев назад
Just to make sure what are you trying to interface too? Are you sure its a vender specific device?
@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?
@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!
Далее
V-USB on an ATmega328! - V-USB and HID Explained
14:08
Usb Software Dev's - USB Descriptors
18:35
Просмотров 4,6 тыс.
Pico W Episode 1: Setting Up the Raspberry Pi Pico W
12:48
Connect A USB Keyboard To A Raspberry Pi Pico
15:47
Просмотров 20 тыс.
Transform an old broken Keyboard to a Macro Keyboard
8:11
raspberry pi pico - usb host
20:54
Просмотров 27 тыс.