2026-01-03 1:10 AM
Hello Everyone,
I am following below tutorial to create an ai application from scratch on my custom board.
I am able to run inference following the tutorial. Now, Instead of using UART for transmitting inference results, I want to use USB CDC to transmit the inference results. I have to enable USBX and ThreadX and move MX_X_CUBE_AI_Init() and MX_X_CUBE_AI_Process() from MAIN to app_ux_device_thread_entry. I have given below
pool sizes:
USBX_MEMORY_STACK_SIZE 1024*35
TX_APP_MEM_POOL_SIZE 1024*8
UX_APP_MEM_POOL_SIZE 46080
When I run the application, I can see the device enumurates as USB serial device. Once I run MX_X_CUBE_AI_Process(), ux_device_class_cdc_acm_write() no longer works. If I comment out MX_X_CUBE_AI_Process(), I am able to continously write data to ux_device_class_cdc_acm_write and view in PC terminal. Further If dont invoke ux_device_class_cdc_acm_write, I am able to continously execute MX_X_CUBE_AI_Process.
I have also tried creating spearate threads for usb_cdc_write and ai_inference. I observe the same behviour. Only 1 of the process keeps executing. I am not able to execute both the processes from threadx.
Is it possible to execute X-CUBE-AI from threadx? Is there anything more to be considered to run both USBX and X-CUBE-AI from threadx?