2025-11-17 12:57 AM - last edited on 2025-11-17 1:28 AM by Andrew Neil
Hi @all @stforum @stforum2 @stforum.tormod9 @stforum23 @jkn_stforum
I’m using STM32U535CBTx MCU, using STM32Cube IDE.
Peripherals in use:
I2C1
UART4
LPUART1
SPI2
GPIO PB8, PB9, PB10 for LEDs
Issue:
SPI2 works fine when TRNG is disabled.
After enabling TRNG, SPI2 stops working.
I’ve attached both .ioc files (with TRNG enabled and disabled). Could someone please review them and suggest a solution?
Could anyone please:
Review my .ioc files
Explain why this happens and how to fix this issue?
Suggest how to use TRNG and SPI2 together
I have attached two .ioc files for reference:
sensor nodewith TRNG.ioc – this version has the TRNG peripheral enabled.
sensor node without TRNG.ioc – this version does not use TRNG and SPI2 works correctly.
Please review and help identify why SPI2 stops working when TRNG is enabled.”
Thanks in advance!
2025-11-17 1:48 AM
Hello @Badrinathan
I'm currently checking this behavior. I will get back to you asap.
THX
Ghofrane
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.
2025-11-17 1:57 AM
Hi @Ghofrane GSOURI
Thanks, Ghofrane. I’ll wait for your update.
Thank you
Badrinathan J
2025-11-17 2:53 AM - edited 2025-11-17 2:56 AM
Hello @Badrinathan
I compared the two provided IOC files and identified the key differences in the clock configuration:
Without RNG:
The PLL is enabled and used as the system clock (SYSCLK).
MSI is selected as the PLL source.
SYSCLK is derived from the PLL, resulting in a higher system frequency.
Voltage scaling is set to SCALE1, providing the highest performance.
With RNG:
HSI48 (the 48 MHz internal oscillator, required for TRNG) is enabled.
The PLL is disabled (PLLState = RCC_PLL_NONE).
SYSCLK is sourced directly from MSI, not the PLL, leading to a much lower system frequency.
Voltage scaling is set to SCALE3, which is the lowest performance setting.
Recommendation:
To ensure both RNG and SPI2 function correctly, enable HSI48 for the RNG peripheral while maintaining your original PLL-based system clock and high-performance voltage scaling. This configuration will allow both peripherals to operate at their required speeds.
Please try this adjustment, and let me know the results.
PS: I used the latest version of CubeMX6.16.0 , you can download it from the following LINK
THX
Ghofrane
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.
2025-11-17 5:12 AM - edited 2025-11-17 5:18 AM
Hello @Ghofrane GSOURI
Thank you for your prompt response.
I would like to clarify that I am not using CubeMX .
I am configuring everything directly in STM32CubeIDE (latest version) using the .ioc file inside the Cube IDE. I am not manually changing the voltage scaling, but as soon as I enable the RNG, CubeIDE may be automatically switches the Voltage Scaling from SCALE1 to SCALE3.
Could you please explain step-by-step how to correctly keep:
PLL enabled
SYSCLK sourced from PLL
Voltage Scaling = SCALE1
HSI48 enabled only for RNG
specifically inside STM32CubeIDE?
In this Cube IDE, I am not sure where to set the voltage scaling back to SCALE1 or how to prevent CubeIDE from changing it automatically.
A detailed sequence of steps (menu paths, tabs, and settings) would really help me solve this using STM32 CubeIDE.
Thank you,
Badrinathan
2025-11-17 5:28 AM - edited 2025-11-17 5:34 AM
Hello @Badrinathan
Here are the steps I followed: I used CubeMX 6.16.0 standalone and loaded your IOC file (sensor node without TRNG.ioc). I kept your original configuration, then activated the RNG and ensured that HSI48 is selected as the input for the RNG multiplexer. Afterward, I generated the code and chose STM32CubeIDE as the toolchain.
I will review this in STM32CubeIDE and get back to you.
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.
2025-11-17 5:44 AM
Hello @Badrinathan
Inside STM32CubeIDE, import the attached IOC
Then generate code
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.