2024-07-01 09:48 AM
Hello all,
currently I am facing next problem - I have STM32H743 with USB configured such as CDC Virtual port COM. Receiving data works very well. But I have a strange problem with sending data. Data I send are not correct received in case of using dynamic array:
If I use CDC_Transmit_FS(buffer, 5) are bad data received.
If I use CDC_Transmit_FS((char*)data, 5) all is good.
I have checked memory locations and both data pointers in function CDC_Transmit_FS have correct data, but on different memory address.
I don't have idea why it is so behave. Can anybody help with this? CHATGPT failed, so I try live peoples.
Thank you very much.
2024-07-01 09:53 AM
Please don't post code as images - see this for the proper tool:
Presumably, CDC_Transmit_FS is non-blocking?
So it's not going to work for sending auto (ie, local non-static) variables - as your buffer.
When you use
char* data[] = "Tesxt";
You get a pointer to a static location.