PROGRaming use of 2do usb in nucleo.h7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-27 12:08 PM
I want to use the second USB of my nucleo-h753zi board, in a program that checks and graphs the movements and clicks of the mouse that enters through the USB port, but I only see the stlink, there is the init = MX_USB_DEVICE_Init (void); I used the power in "ext" and in "chgr" but without result. What am I missing or what am I doing wrong? Thanks
Solved! Go to Solution.
- Labels:
-
STM32H7 Series
-
USB
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-28 8:52 AM
You need HID class instead of CDC to interface a mouse. Here is a working example to start with on eval board STM32CubeH7/Projects/STM32H743I-EVAL/Applications/USB_Device/HID_Standalone at master · STMicroelectronics/STM32CubeH7 · GitHub You need to refer to schematics as well.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-27 2:16 PM
Middleware - USB device - select a proper class (CDC?) and write some code to handle the transfers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-27 7:42 PM
yes;That is contemplated:
void SendMessageToPC(char* message) {
CDC_Transmit_FS((uint8_t*)message, strlen(message));
}
void SendMovementData(int x, int y, uint8_t buttons) {
char buffer[50]; // Buffer para el mensaje
// Formatear el mensaje
sprintf(buffer, "Mov: X=%d, Y=%d, Buttons=%d\r\n", x, y, buttons);
// Enviar el mensaje al PC
CDC_Transmit_FS((uint8_t*)buffer, strlen(buffer));
}
void ProcessMovement() {
HID_ReportTypeDef report = {0, 0, 0}; // Inicializa el reporte
report.buttons = 1; // Emular clic en el botón 1
report.x = 5; // Desplazamiento en X
report.y = 0; // Desplazamiento en Y
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&report, sizeof(report));
// EnvÃa la información de movimiento por USB Serial
SendMovementData(report.x, report.y, report.buttons);
HAL_Delay(10); // Pausa para evitar sobrecarga de reportes
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-28 8:52 AM
You need HID class instead of CDC to interface a mouse. Here is a working example to start with on eval board STM32CubeH7/Projects/STM32H743I-EVAL/Applications/USB_Device/HID_Standalone at master · STMicroelectronics/STM32CubeH7 · GitHub You need to refer to schematics as well.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
