STM32 as HID device - Keyboard | Video 22

  Рет қаралды 26,246

Matej Blagšič

Matej Blagšič

Күн бұрын

Пікірлер: 72
@antonioescamez4549
@antonioescamez4549 4 жыл бұрын
Could upload another video explainign how can create a library to not loss the changes maked when do some change in the ioc?. Thanks
4 жыл бұрын
I will come back to this topic soon, as a lot of people have requested additional information and solutions on this topic. Stay tuned and thank you for watching :)
@antonioescamez4549
@antonioescamez4549 4 жыл бұрын
@ thanks you for share It!
@ilkeraykut7064
@ilkeraykut7064 2 жыл бұрын
Thanks For tutorial .I have 2 questions .First in 01:57 ,it says 1 keyboard 2 mouse but in usbh_hid.h file it says ; typedef enum { HID_MOUSE = 0x01, HID_KEYBOARD = 0x02, HID_UNKNOWN = 0xFF, } HID_TypeTypeDef; Why is it like this?(By the way I configured stm32 as Host only mode ) Question 2 :Can you make a tutorial about gamepad?
@stevenpaul9307
@stevenpaul9307 4 жыл бұрын
Great job! I have a broken surface book keyboard with ps/2 touch pad. I've removed all the useless parts and I'm trying to make a usb keyboard with stm32f103c8t6.I've test all the key positions from the matrix and I got the keymap. Keep working!
4 жыл бұрын
Thank you. That is a very practical project for this video topic. Thanks for sharing. Good luck on resurrecting your keyboard :)
@azamtamboli3186
@azamtamboli3186 Жыл бұрын
hii brother i was working same controller give tips or code i am new in industry
@stevenpaul9307
@stevenpaul9307 Жыл бұрын
@@azamtamboli3186 it's been 3years. I have some simple codes with arduino ide. keyboard is working fine now. you need a keypad library to drive the key matrix.
@utsavsuha
@utsavsuha 2 жыл бұрын
Hello, nice explanation, but i am getting one issue where the D is getting typed without any delay. what could be the issue?
2 жыл бұрын
I think I don't understand your question. Are you refering to a key being press all the time?
@kityacat5419
@kityacat5419 4 жыл бұрын
I was trying to do it myself but failed miserably but thanks to you I now get it
4 жыл бұрын
Amazing! Glad I could help :)
@dymastro788
@dymastro788 3 жыл бұрын
Just discovered your channel! Great content keep it up!
@AlexBolm
@AlexBolm 4 жыл бұрын
Big Thanks ! Chinise Bluepill and STv2 - work!
4 жыл бұрын
Amazing! Thank you for watching
@mashurshalehin4972
@mashurshalehin4972 4 жыл бұрын
Were you able to use the debugger with the Chinese Bluepill? I had to generate the .bin file and flash it with the cube programmer!
4 жыл бұрын
If you can download code to your board via stlink, then you can also debug on it. Just connect 3v3, gnd, swd, swc, reset just like for downloading bin files
@mashurshalehin4972
@mashurshalehin4972 4 жыл бұрын
@ What I found out that with the knockoff bluepills the GDB debugger will not work and I have to use the OpenOCD. I haven't tried that yet. Great tutorial btw. Very helpful.
@mashurshalehin4972
@mashurshalehin4972 4 жыл бұрын
community.st.com/s/question/0D50X0000BUjpxvSQB/error-in-initializing-stlink-device-reason-18-could-not-verify-st-device-abort-connection?fbclid=IwAR0VqBv1n8vgCmE_F4RLdQUIuNbkoRUwicOV_S9ag4fzBCSRzy3R0unH38c
@jianyang6810
@jianyang6810 4 жыл бұрын
Great tutorial! Do you think the stm32 can also be used to send touch inputs if I just use the functions in the github? I am trying to use the stm32 as a touchscreen usb hid device.
4 жыл бұрын
Of course. I would create functions that react to certain "input" in your case touch. That function would send a pre-defined character/combination of characters to computer. If you want to make it more universal you can create an array of all commands you want to send and all types of your input signals/conditions and create just one function that sends appropriate characters/combinations. cheers
@TaizLa
@TaizLa 4 жыл бұрын
I did all the steps in the video however when I run main through the debugger, my pc tells me "The last USB device you connected to this computer malfunctioned and Windows does not recognize it." I am using an STM32F042K6 device so it does not have the usb port like the discovery so I had to connect the USB DP and DM pins manually. I'm not sure as to what is wrong with it. Your tutorial was really good and in depth so I'm sure something is just happening on my end.
4 жыл бұрын
First I would make sure that you have the peripheral working normally. Then the hardware; usb is just enaugh fast that it requires some care around the physical connection. You need series resistors on data lines around 22Ohm and a pull resistor on data +. This might be already implemented by the Cube by using internal pull up resistors. Regarding the code, make sure to also view my newer video on usb device where I show you how to solve some problems that were mentioned at the end of this video. Good luck and thank you for watching.
@TaizLa
@TaizLa 4 жыл бұрын
@ Thank you so much for responding. Just a few follow up questions, how do I test if the peripheral is working? For the pull up resistor, would connecting the pin to the +3.3V pin with a 330 ohm resistor be enough? Perhaps there is a way for me to enable the internal pullup resistor within the Cube IDE so I will look into that. Thank you so much for responding
4 жыл бұрын
@TaizLa No problem, that's why I have this channel, to help as much as I can and know. I suggest using 22R series resistors and around 1k5 to 4k7 pullup on D+ line. 330R could be too strong pull. You can also take a look at schematics for stm32 boards that have usb fs connector for reference. As far as testing the peripheral, make sure that everything compiles with no warnings, that the clock for usb peripheral in clock tree is right (48MHz) and maybe put a breakpoint on usb fs interrupt handler as it should be used by the middleware. Also try another computer. Also make sure no interrupts with the same priority as usb are used on your sistem. Code should start and not stop and the it should work. Also check out video 33 where i show you how to fix some problems mentioned in this video, regarding cube erasing hid configurations. Cheers
@TaizLa
@TaizLa 4 жыл бұрын
@ So I have attached a 4k pullup to the D+ line and 22 ohm series resistors to the data lines but am running into the device descriptor request failed error. When I step through the code using the debug, I run into the error after executing the MX_USB_DEVICE_Init(); line. I'm not sure as to how the device descriptor actually works but it looks like that might be my problem? I'm really not sure. I watched your other video and have a new project setup using the same files as the one in the newer video
4 жыл бұрын
@TaizLa Then I would check if settings from your MX configuratin match those from mine from the vide, like usb PID VID, name, manufacturer, also check file where usb device descriptor is stored that it matches mine from the video. Also, do you have the newest ide or CubeMx software? Some bugs may be fixed in configurator code. Also maybe try on other computers, operating system. The fact that your computer gives an error is good because something is happening right in the code, but it fails.
@hectoreliucaballerodimas6752
@hectoreliucaballerodimas6752 4 жыл бұрын
I'm trying to make an arcade keyboard with the stm32f4 but I have some issues because I'm not undestanding at all how to use the microcontroller as HID device, the arcade works with push bottom,, how can I make that my computer reads this bottoms? I know I have to use EXTI or simple inputs but I'm really miss trying to make per example buttom 1 = w
@hectoreliucaballerodimas6752
@hectoreliucaballerodimas6752 4 жыл бұрын
btw excellent video is the best I've seen
4 жыл бұрын
Thank you for the comment. I would use the functions provided to you in the github link to send characters / strings. You can use those to send particular button press that you want to trigger on the computer, so this is the first thing you should look into; list of all button actions. Then I would either use interrupts for gpio with those external buttons connected or just for a simple test put an if statment for reding button/gpio states. Those interrupt functions or that quick while loop can just send a character/string for the action you want to send based on the button pressed. You can also add debouncing for a more reliable button reading. Hope this helps.
@ScuffedCircuits
@ScuffedCircuits 2 жыл бұрын
Great video. I got this working first try and that never happens for me when following a video tutorial
@MatthGyver
@MatthGyver 4 жыл бұрын
Thank's for this tutorial. It is really useful for a beginner like me :-) It's work great as bare metal on a stm32f746G-disco bord. Now I'd like to build a GUI with TouchGfx that send keystroke when I touch an interface button. To start, I configured my project on CubeMX to enable USB FS and HID but my OS does not recognize the HID interface. Do you have any advice for me please?
@MatthGyver
@MatthGyver 4 жыл бұрын
Self reply For this to work: - create a project with TouchGFX Designer - open the .ioc file in CubeIDE - in "Project Manager> Code Genrator", uncheck "Generate peripheral initialization as a pair of ..." - in the FreeRTOS settings, set "Stack Size" to 5120
4 жыл бұрын
I am glad you found the tutorial usefull. I had problems too when setting it up and I point out some in the end / second half of video. Also you have to make sure that your code is running without any long while loops or just stuck. Also disable breakpoints so the device is running. The way usb work demands the device to respond quite frequently so that pc sees your device as present. Other than that you might want to check with your usb libraries, if you are using any proprietary ones and of course check your settings, pins, ports, right usb peripheral (i know this is obvious but I cannot count the times I still had those wrong).
@chibyshev
@chibyshev 4 жыл бұрын
Hello! You planned (lesson 22) to record a video in which you will tell how to make sure that when you make a change in the STM 32CUB MX environment, you do not have to make the changes manually. Did you manage to record a lesson?
4 жыл бұрын
I have been busy with school and other project, so I haven't done a followup on that issue. I have it on my to-do list, so when I will come to it, I will make a video about it, but for now the advice I give in the video is the best I can give.
@erlichdumas5982
@erlichdumas5982 4 жыл бұрын
Hi there great video! I am having trouble with the tutorial though. I did everything you said in the video but for some reason the letter D is not being typed. I am using a STM32 Nucleo F767ZI. Do you by any chance know what the problem is?
4 жыл бұрын
I would check if you are using the correct usb peripheral and also correct pins for that peripheral. f767 is a large IC so it might have plenty of those to choose from. So make sure to select the correct one. Then in the end of video I address a bug and how I got around it, so maybe try that as well. Untill I take another look at that I cannot provide you with any new solutions. After these checks, does it compile and upload? Does you win/linux machine see the device? On win I would go to device manager and linux type in terminal "lsusb" and see if it is listes (something including words like ST, ST Microelectronics). Also, after debug upload, make sure to run code and disable breakpoints.
@erlichdumas5982
@erlichdumas5982 4 жыл бұрын
@ Yeah so I tried those solutions but when I try to debug before I plug my device in, I get the error: ST-Link enumeration failed Error in initializing ST-LINK device. Reason: ST-LINK DLL error. The debugger only initializes if my device is plugged in.
4 жыл бұрын
Sounds like problems detecting drivers for your stlink. If you are on win machine, make sure to install then from STs site, but maybe they come with CubeIde installation?
@erlichdumas5982
@erlichdumas5982 4 жыл бұрын
@ Yes that worked thank you. Also a solution that worked for me in solving the USB problem in your video was changing my clock to 96. (I am using one of the F7 series so max clock is 216)
4 жыл бұрын
Interesting solution. I will look into that. Thank you for the idea. Will post an update video for potential solutions for some problems.
@yithzak99
@yithzak99 2 жыл бұрын
Hi, Matej, I follow all your instructions using an STM32F401Re, but didn't work, it doesn´t recognize the board as a keyboard and at the end doesn't press or send any keyboard command. Appreciate if you can help. I designed a script alone just to execute the keyboard commands. Nice video.
2 жыл бұрын
I recommend you to also check out video 33, there are some points about certain parameters that are important.
@NeonilRosca
@NeonilRosca 4 жыл бұрын
hi, i use an stm32f411ceu6 and i have this problem (Windows has stopped this device because it has reported problems. (Code 43) A request for the USB device descriptor failed.), do you have any hints . I tried every usb configuration but nothing changed. PS. Nice video
4 жыл бұрын
It looks like the same type of error that I get at the end of the video. I still didnt manage to find a solution apart from remaking the cube settings and then for some reason, it works. I will follow up with a possible solution. I also doubt there is a difference of operating systems, as usb is universal. Thank you for watching.
@NeonilRosca
@NeonilRosca 4 жыл бұрын
@ thanks, the problem magicaly dissapeard 😆 after many tries.
4 жыл бұрын
Welcome to computers and technology 😉
@chibyshev
@chibyshev 4 жыл бұрын
@@NeonilRosca USB Clock 48 MHz?
@MrSkyNightHD
@MrSkyNightHD 4 жыл бұрын
Hi, really great video! I am using a blue pill stm32f103c8, after debugging, I get this error in the console: "Error in initializing ST-LINK device. Reason: ST-LINK: Could not verify ST device! Abort connection. " The ST LINK is updated, correctly identified by the OS (I use Windows and it recognized the ST LINK as a ST LINK). Do you know what is the problem? Thank you in advance for helping me!
4 жыл бұрын
Should be some kind of connection problem. Do you have all your swd line connected? Vcc, gnd, swd and swc should be all connected with stlink
@MrSkyNightHD
@MrSkyNightHD 4 жыл бұрын
Matej Blagšič Of course, all is connected to the STM 32
4 жыл бұрын
What debugger are you using. You said stlink, but is it on a nucleo/discovery board or just a dtand alone version. In my experience this error comes from conenction problems. In rare case I had "bricked" boards that I had to mass erase in stutility for windows and using connect under reset. Sometimes even using tweezers to manualy hold reset while clicking mass erase and releasing after half a second.
@MrSkyNightHD
@MrSkyNightHD 4 жыл бұрын
@ I am using a blue pill board with a stm32f103c8t6. I already tried this hold reset/mass erase without solving the problem.
4 жыл бұрын
What debugger are you using? If you have a nucleo board, you have to remove some jumpers as well.
@AllanUchoa
@AllanUchoa 4 жыл бұрын
Great tutorial!!!
4 жыл бұрын
Thank you :)
@MDMAviation
@MDMAviation 4 жыл бұрын
19.44 linux mint logo?
4 жыл бұрын
That would be a capture error. Nvidia and Linux do not like each other :P
@MDMAviation
@MDMAviation 4 жыл бұрын
@ Yeah!! I noticed later, but at the beggining I tought it was on purpose like an easter egg haha
4 жыл бұрын
Good Idea hah.I am still fighting this, maybe Ill get a cheap amd card.
@vietnamnguyen9843
@vietnamnguyen9843 3 жыл бұрын
Thank for your tutorial.
@RatijasT
@RatijasT 3 жыл бұрын
For things like "it's gonna be '2'", "the buffer size... we know it's 8" - there's a good reason programmers invented named constants and sizeof operator. Don't write "just 2". Name it, and make self-descriptory. Especially for buffers sizes.
@RatijasT
@RatijasT 3 жыл бұрын
I watched till the end. SendChar and SendString sounds like a much safer alternative. Good stuff. However, size of a buffer is still manually provided, and usage is inconsistent: sometimes it is used as a global, other times it is passed by reference/value.
@daniel-lb4bh
@daniel-lb4bh 9 ай бұрын
alt+f4 doesn't work
STM32 USB HID Custom Joystick/Gamepad - Phil's Lab #149
35:56
Phil’s Lab
Рет қаралды 12 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
3 engineers race to design a PCB in 2 hours | Design Battle
11:50
Predictable Designs
Рет қаралды 495 М.
How does a USB keyboard work?
34:15
Ben Eater
Рет қаралды 3,2 МЛН
Use STM32 as a KEYBOARD || F103C8 || USB Device HID
19:19
ControllersTech
Рет қаралды 33 М.
Interrupts on Cortex M - NVIC (demonstrated on STM32) | VIDEO 34
34:24
Matej Blagšič
Рет қаралды 17 М.
Linux Kernel 6.12 | This is Historic
1:07:22
Maple Circuit
Рет қаралды 124 М.
Custom HID keyboard device | VIDEO 33
23:41
Matej Blagšič
Рет қаралды 9 М.
Usb Software Dev's - USB Descriptors
18:35
Brenden Adamczak
Рет қаралды 6 М.
Is Functional Programming DEAD Already?
21:07
Continuous Delivery
Рет қаралды 75 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.