2024-01-03 09:54 PM
I am confused:
I have a PCB designed for STMU575 and I am using USB FS - works.
USB DM and DP are pins PA11 and PA12.
On U575:
- all fine as USB FS, available via AF10 (PA11 = OTG_FS_DM, OTG_FS_DM) - works
I have checked the packages and pin assignments and saw: U5A5 is identical with U5A5 (and I want to solder U5A5 due to larger memories instead of U575).
But UA5A datasheet is a bit different on PA11, PA12:
1. it mentions "OTG_HS_DM(boot)" as "additional functions"
2. in pin mux ALT table: there is nothing under ALT10 - there is NOT an ALT option to configure PA11, PA12 as USB pin
My questions:
a) changing from U575 to a U5A5 on same PCB and package (LQPF64) - are PA11 and PA12 usable in the same way as USB (FS)?
b) if changing to U5A5 and PA11, PA12 become OTG_HS_DM, OTH_HS_DP now: does it mean I have to configure now USB HS instead of USB FS (as on U575)?
c) how to configure ALT function of USB_HS (if not listed in table) for U5A5?
Solved! Go to Solution.
2024-01-13 07:27 PM
"hmmm" - no clear answer for me. Anyway, I close the ticket if you want me to do.
2024-01-03 10:48 PM
When I see my NUCLEO-U5A5 project (using OTG USB HS:(
- it does NOT configure any PA11, PA12 (nothing for PA11, PA12, no ALT needed neither used)
- instead, it enables in function "void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd)" only the USB HS
So, it looks to me as:
PA11, PA12 are implicitly used as USB_DP, USB_DM when USB HS is enabled (therefore "other functions"):
no need to configure PA11, PA12 via an ALT (not available): it is done (used) automatically via USB HS enabled
But it means also:
on U5A5 PA11, PA12 become USB HS signals now: all my code for FS on 575 has to be changed to use USB HS (and internal PHY)
BTW: very cool that STM MCU has now an internal USB HS PHY! (but obviously just on U5A5). Anyway - very great and I appreciate it. Long time awaited feature, well done.
2024-01-03 11:07 PM
Hello @tjaekel
a) changing from U575 to a U5A5 on same PCB and package (LQPF64) - are PA11 and PA12 usable in the same way as USB (FS)?
Yes, when using USB_OTG_HS, PA11 will be USB_OTG_HS_DM and PA11 will be USB_OTG_HS_DP
b) if changing to U5A5 and PA11, PA12 become OTG_HS_DM, OTH_HS_DP now: does it mean I have to configure now USB HS instead of USB FS (as on U575)?
You can configure the USB HS to work as a USB FS using the internal HS physical interface.
c) how to configure ALT function of USB_HS (if not listed in table) for U5A5?
You can refer to one of the examples in the STM32Cubeu5.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-11 08:16 PM
Great, thank you.
I will give it a try: I have checked CubeMX, some of (my) demo projects (e.g. for NUCLEO-U5A5) and I have a clue now.
I will solder my board for U5A5 asap and try to create a FW for it.
Best regards
Torsten
2024-01-13 11:44 AM
I tried now STM32U5A5 in LQPF64 package - it does NOT work.
When the FW should do:
/* Reset after a PHY select */
ret = USB_CoreReset(USBx);
the ret is always HAL_TIMEOUT. And the debugger (external ST-LINK) complains with "Target is not responding, retrying..."
when the bit 0 CSRST in register OTG_HS->GRSTCTL is set. It is never "auto-cleared".
So, I assume, the USB_PLL is not locked (not running).
I tried on NUCLEO-U5A5 a similar clock config, e.g. using for USB:
/** Initializes the peripherals clock
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USBPHY;
PeriphClkInit.UsbPhyClockSelection = RCC_USBPHYCLKSOURCE_PLL1_DIV2; //RCC_USBPHYCLKSOURCE_PLL1_DIV2;
////PeriphClkInit.UsbPhyClockSelection = RCC_USBPHYCLKSOURCE_HSE; //XXXX: in NUCLEO project
/** Set the OTG PHY reference clock selection
*/
//XXXX: PLL1_P should be 32 MHz - 16 MHz selected here
HAL_SYSCFG_SetOTGPHYReferenceClockSelection(SYSCFG_OTG_HS_PHY_CLK_SELECT_1);
it works on NUCLEO board.
The only differences which remain:
I made sure to configure the SystremClock properly, e.g. the PLL1_P for 32 MHz (and using it via PLL1_DIV2)
So, it remains: NUCLEO board has real XTAL, I have CMOS OSC.
What scares me is this statement in U5A5 datasheet (page 97):
"This interface requires a precise 60 MHz clock that is generated from the internal
USB PHY PLL (the clock source must use a HSE crystal oscillator)."
OK, internal PLL - I use and works also on NUCLEO. But not a HSE crystal oscillator! (CMOS OSC instead).
Is this the reason why it does not work?
Really a need to use HSE with XTAL (and not HSE_OSC_IN without _OUT) - for STM32U5A5 internal OTH_HS_PHY to use?
2024-01-13 01:33 PM
Strange is:
a) running the NUCLEO project on my board - no TIMEOUT - but USB does not work
b) running my LQFP project on NUCLEO - also a TIMEOUT
So, potentially something missing, maybe not related to CMOS OSC (because NUCLEO project does not show the TIMEOUT, when running on 8 MHz CMOS OSC.
2024-01-13 01:50 PM
Hello @tjaekel
I advice you to close this post by choosing a best answer since the original question is answered. And create a new post for this request to give it more visibility and more chance of getting an answer from our Community users and experts.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-13 07:27 PM
"hmmm" - no clear answer for me. Anyway, I close the ticket if you want me to do.
2024-01-14 04:15 PM
close the ticked too early - it works now!
With a slightly different clock config - my NCUELO-U5A5ZJ-Q project (with small modifications due to missing UCPD) it works now!
I have to use this code in SystemClock_Config() - than it works:
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;
#ifdef NUCLEO_BOARD
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
#else
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
#endif
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMBOOST = RCC_PLLMBOOST_DIV1;
#ifdef NUCLEO_BOARD
//16 MHz XTAL, NUCLEO board
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 20;
RCC_OscInitStruct.PLL.PLLP = 10; //32 MHz needed here!
RCC_OscInitStruct.PLL.PLLQ = 2;
RCC_OscInitStruct.PLL.PLLR = 2;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_1;
#else
//8 MHz OSC, my board
RCC_OscInitStruct.PLL.PLLM = 1; //2; ==> THIS FAILS on USB
RCC_OscInitStruct.PLL.PLLN = 40; //20; ==> THIS FAILS on USB
RCC_OscInitStruct.PLL.PLLP = 10;
RCC_OscInitStruct.PLL.PLLQ = 2;
RCC_OscInitStruct.PLL.PLLR = 2;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_1;
#endif
Cool! So, U5A5 works also with an external HSE CMOS oscillator (no need for a XTAL, no need to redesign my board).
2024-07-11 12:39 AM
Hi @tjaekel
I'm facing to the same problem.
I already spent 3 days to make this OTG_HS phy working...
i'm also working with a 32MHz external oscillator.
But i can't get it to works (The CoreReset without ends in timeout...)
i tryed your PLL settings (updated for my 32MHz osc)
RCC_OscInitTypeDef xRccOscInit =
{
.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE,
.HSEState = RCC_HSE_BYPASS,
.LSEState = RCC_LSE_ON,
.PLL.PLLState = RCC_PLL_ON,
.PLL.PLLSource = RCC_PLLSOURCE_HSE,
.PLL.PLLMBOOST = RCC_PLLMBOOST_DIV4,
.PLL.PLLM = 2,
.PLL.PLLN = 20,
.PLL.PLLP = 10,
.PLL.PLLQ = 2,
.PLL.PLLR = 2,
.PLL.PLLRGE = RCC_PLLVCIRANGE_1,
.PLL.PLLFRACN = 0,
};
following i configure the PHY like this
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_EnableUSBHSTranceiverSupply();
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
__HAL_RCC_USBPHYC_CLK_ENABLE();
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USBPHY;
PeriphClkInitStruct.UsbPhyClockSelection = RCC_USBPHYCLKSOURCE_PLL1_DIV2;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
HAL_SYSCFG_SetOTGPHYReferenceClockSelection(SYSCFG_OTG_HS_PHY_CLK_SELECT_1);
HAL_SYSCFG_SetOTGPHYDisconnectThreshold(0x2);
HAL_SYSCFG_SetOTGPHYSquelchThreshold(0x0);
HAL_SYSCFG_EnableOTGPHY(SYSCFG_OTG_HS_PHY_ENABLE);
but it doesn't works..
Could you share your testing project you used ?
thanks a lot !