cancel
Showing results for 
Search instead for 
Did you mean: 

How to use virtual COM port with nucleo-H563ZI

Christian_Janz
Associate II

Hello,

I am new in the STM world.

I am using the nucleo-H563ZI deverlopment board and I want to get the virtual COM port to work.

On github I found the examples of the Board.

https://github.com/STMicroelectronics/STM32CubeH5 

I opend the project "...\Projects\NUCLEO-H563ZI\Applications\USBX\Ux_Device_HID_CDC_ACM" and compiled it.

After that the PC recognize a vitual COM Port. So far so good.

Now I want to send or receive Data by the virtual COM port.

But I can't find the function for sending or receiving Data.

 

Is there anybody who can help me, please?

 

Best regards

Christian

 

 

13 REPLIES 13

Hi @Christian_Janz  , you have a lot to understand now - using a RTOS , no more "just" a program.

1. no more "main"  = the program ! now many "main" possible, all running (virtual) at same time.

2. read the comment in main.c , and believe it :

AScha3_0-1701094087247.png

now your program is in processing tasks or threads !

so if you dont need this (maybe same me: had to use this Azure just because STM leaves us no choice anymore : want USB , Fat-file system ? then use Azure! )

you can use the first and only thread, that is generated by Cube if you let it do it :

AScha3_2-1701094493253.png

then in core -> app_threadx.c :

 

AScha3_1-1701094421160.png

i just rename this first thread to  >> tx_app_main_entry << , to see my "main" now by a similar name. 🙂

so write here, what you in old times wrote in "main" , here my H563 program begins:

 

void tx_app_main_entry(ULONG thread_input)
{
  /* USER CODE BEGIN tx_app_main_entry */
	printf("app_main start \n");
	/*##-2- Register the file system object to the FatFs module ##############*/
  	fresult = f_mount(&SDfs, (TCHAR const*)SDPath, 1);			// SD card mount
    if(fresult)
    {
    	printf(" mount error ! \n");
.....

 

- ( but i am using fatfs here , not filex )

 

If you feel a post has answered your question, please click "Accept as Solution".

Hi @AScha.3 ,

thanks for your help.

Yes, you are right. I have a lot to understand now.

That means in main.c  in the while(1) loop is nothing happening anymore?

So If i want to run code, I have to do this in the ux_device_cdc_acm.c?

 

right.

no more "main" .

your program is in a thread.    maybe...the ux thread.

If you feel a post has answered your question, please click "Accept as Solution".

recommended: first read a "little" about ...

https://learn.microsoft.com/en-us/azure/rtos/

 

+

let Cube make a first thread for you , as i wrote . then write there, what you would/want write as your "main".

If you feel a post has answered your question, please click "Accept as Solution".