Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32H7 USB, SD Card and ADC problem #304

Open
vahidajalluian opened this issue Jan 8, 2025 · 2 comments
Open

STM32H7 USB, SD Card and ADC problem #304

vahidajalluian opened this issue Jan 8, 2025 · 2 comments
Assignees
Labels
bug Something isn't working cube mx Issue related to the Cube MX tool rather than the firmware published within this repository usb Universal Serial Bus

Comments

@vahidajalluian
Copy link

Since my forum account has been banned, I'm reporting bugs here instead.

Describe the set-up
I am using a custom board with the following specifications:

MCU: STM32H743BIT6
STM32CubeMX version: 6.13
H7 firmware version: V1.12.0

Describe the bug
When one create project from scratch with stm32cubemx these bugs will appear.

1- USB Device Descriptor Issue with Optimizations
I had also this problem with f4 series, when enabling optimization (o1 and above), USB device descriptor cannot be estimated, and therefore no device is presented Device manager of windows.
Solution: Modify the Get_SerialNum function in usbd_desc.c as follows:

static void Get_SerialNum(void)
{
  uint32_t deviceserial0;
  uint32_t deviceserial1;
  uint32_t deviceserial2;

  deviceserial0 = *(uint32_t *) DEVICE_ID1;
  deviceserial1 = *(uint32_t *) DEVICE_ID2;
  deviceserial2 = *(uint32_t *) DEVICE_ID3;

  deviceserial0 += deviceserial2;

//  if (deviceserial0 != 0)
//  {
//    IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
//    IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
//  }

  USBD_StringSerial[2] = 'D';
  USBD_StringSerial[4] = 'E';
  USBD_StringSerial[6] = 'V';
  USBD_StringSerial[8] = 'M';
  USBD_StringSerial[10] = 'E';
}

2-USB HS Pin Configuration Issue

Enabling USB HS in device-only mode forces PB13 to take on an alternate function, but the specific function is unclear. Despite configuring PB13 as an input, the pin behavior was erratic, and how hard I have tried, I couldn't understand what is the problem, so I switched to USB FS peripheral.

3- Enabling USB does not automatically set the USB clock to 48 MHz, causing the USB to be unrecognizable by endpoint systems.

4- Enabling SDMMC and Fatfs, I could not make it work and emulate the SDCARD. However in F4 series program I had earlier, I saw that it was forcibly enabled NVIC, so I had enabled the NVIC and the problem solved.

5- (IOC file included) In ADC, I had set the resolution to be 12 bit for both ADC1 and ADC3, but only ADC1 is affected and ADC3 is generated without setting(and so the code presume it as 16 bit) although I have checked and it has been set to be 12 bit in IOC file.

ADC_H7.zip

@ALABSTM ALABSTM self-assigned this Jan 10, 2025
@ALABSTM ALABSTM added bug Something isn't working cube mx Issue related to the Cube MX tool rather than the firmware published within this repository usb Universal Serial Bus labels Jan 10, 2025
@ALABSTM
Copy link
Contributor

ALABSTM commented Jan 13, 2025

Hi @vahidajalluian,

Really sorry to hear your account has been disabled. Thank you for the above report. I have a request though. Would you mind logging a different issue for each one of problems 4 and 5, as they relate to two other topics than the USB?

Thank you,

@ALABSTM ALABSTM moved this from To do to Analyzed in stm32cube-mcu-fw-dashboard Jan 13, 2025
@vahidajalluian
Copy link
Author

@ALABSTM I have created two new issues for item 4 and 5.
And for those who don't know why my account has been disabled, It has been disabled, purely for being in Iran :( .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cube mx Issue related to the Cube MX tool rather than the firmware published within this repository usb Universal Serial Bus
Projects
Development

No branches or pull requests

2 participants