2025-04-30 7:14 AM
Hi,
I'm working on setting up a Virtual COM Port for the STM32H563 using bare metal code, without any operating system. As a reference, I'm using the STM32CubeH5 project for the NUCLEO-H563ZI board, STM32CubeH5/Projects/NUCLEO-H563ZI/Applications/USBX/Ux_Device_HID_CDC_ACM at main · STMicroelectronics/STM32CubeH5. I've created the IOC file and enabled USBX and CDC ACM, which are necessary. However, after generating the source files, I couldn't find any definitions for _ux_device_class_cdc_acm_write and _ux_device_class_cdc_acm_read.
I found Solved: How to use virtual COM port with nucleo-H563ZI - STMicroelectronics Community which suggests writing a _write function for printf using _ux_device_class_cdc_acm_write. This is my next step, but since I can't find _ux_device_class_cdc_acm_write, I'm stuck.
I'm using CubeMX version 6.11.1 and I'm required to stick to this version.
Is there anyone who can assist me?
Best Regards,
Swaroop
2025-05-05 5:54 AM
Hi @SwaroopPK
You can find this example without threadx.
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.
2025-05-09 6:48 AM
Hi @FBL ,
Thank you for the reply. I have looked into this code and my only concern here is the ux_device_stack_tasks_run() function that needs to be called in a while(true) loop. I have tried removing this dependency but could not accomplish this since every callback in the "UX Device Controller" uses the UX Device Stack to indicate a request.
Is there any way to have a initialize, deinitialize, read and write functionalities without the infinite while loop?
Regards,
Swaroop
2025-05-12 11:05 AM
Hi @SwaroopPK
I suggest you insert a dummy flag to trigger USB events to manage the task. For example:
if (update_usb_data_event)
{
USBX_Device_Process(NULL);
// Clear the event flag after processing
update_usb_data_event = false;
}
So, this flag can be set when new data is ready to be processed.
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.