2024-04-18 05:14 PM - edited 2024-04-19 10:49 AM
This is on a STM32H723ZGT6
Ok for testing i went to a blank project with only the usb turned on.
Set as
USB OTG HS
DEVICE ONLY
HID
Using the defaults for everything. With no optimization it works and shows up correctly. With any kind of optimization turned on it wont show up in device manager but i can see in "USB DEVICE VIEWER" tool that its being seen by the computer, everything is read correctly but it has the error "*!*ERROR: No open pipes!" and it has 0 listed for open pipes.
Maybe a bad assumption but I would assume with it working correctly with no optimization and then not working with optimization that this is not a physical issue but more of the compiler doing something weird?
Sometimes i also get a "low power" error as well to the no pipes but i always get the no pipes error.
Any thoughts, ideas or rabbit trails for me to go down would be much appreciated as I'm lost not being very experienced with usb.
Thanks!
Solved! Go to Solution.
2024-05-02 05:28 PM
I was able to load a HID example with no problems which meant this was a code issue somewhere.
Through process of elimination i was able to track down that the only real difference between the projects was 3 lines of code in the usbd_desc.c file.
on line 377 is function "static void Get_SerialNum(void)"
in it the following code.
static void Get_SerialNum(void)
{
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
{
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
}
}
as you might notice these lines are uniniatlized
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
by simply changing those 3 lines to the following i was able to get usb communication working even with optimized for speed level of optimization.
uint32_t deviceserial0, deviceserial1, deviceserial2;
deviceserial0 = *(uint32_t *) DEVICE_ID1;
deviceserial1 = *(uint32_t *) DEVICE_ID2;
deviceserial2 = *(uint32_t *) DEVICE_ID3;
This appears to be a error in the code generation of the stm32cube ide as I've tried/tested on multiple fresh/new projects for this chip and it always has this issue.
2024-05-02 05:28 PM
I was able to load a HID example with no problems which meant this was a code issue somewhere.
Through process of elimination i was able to track down that the only real difference between the projects was 3 lines of code in the usbd_desc.c file.
on line 377 is function "static void Get_SerialNum(void)"
in it the following code.
static void Get_SerialNum(void)
{
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
{
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
}
}
as you might notice these lines are uniniatlized
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
by simply changing those 3 lines to the following i was able to get usb communication working even with optimized for speed level of optimization.
uint32_t deviceserial0, deviceserial1, deviceserial2;
deviceserial0 = *(uint32_t *) DEVICE_ID1;
deviceserial1 = *(uint32_t *) DEVICE_ID2;
deviceserial2 = *(uint32_t *) DEVICE_ID3;
This appears to be a error in the code generation of the stm32cube ide as I've tried/tested on multiple fresh/new projects for this chip and it always has this issue.