2023-11-22 05:36 AM
Dear STM Support Team,
I am currently working on a project using the STM32H747I-Discovery Kit and have encountered an issue during system initialization. After integrating code from the STemWin_HelloWorld example and successfully compiling, the HAL_Init() function returns HAL_ERROR.
Upon debugging, I have found that the common_system_clock variable is being set to zero when returning from the following block of code:
#if defined(RCC_D1CFGR_D1CPRE)
common_system_clock = HAL_RCC_GetSysClockFreq() >> ((D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_D1CPRE)>> RCC_D1CFGR_D1CPRE_Pos]) & 0x1FU);
#else
// Other conditionals or relevant code
#endif
HAL_RCC_GetSysClockFreq() correctly returns a value that corresponds to 64MHz, so the issue seems to arise during the prescaler application. This leads to a situation where common_system_clock becomes zero, which should not be the case.
I have double-checked the clock configurations, prescaler settings, and the relevant RCC registers but have not found any discrepancies that could lead to this issue.
Could you please advise on what might be causing this behavior or provide any additional steps to troubleshoot this problem? I am using the latest HAL library version recommended for STM32H747I-Discovery.
Thank you in advance for your support.
Solved! Go to Solution.
2023-11-24 12:57 PM
Issue identified and fixed. Thank you for the suggestions and support. Issue was in the linker script. Accidentally I changed the .rodata assigned to RAM.
2023-11-22 06:02 AM
RCC->D1CFGR contains What?
What about DBGMCU->IDCODE ?
I suspect D1CorePrescTable isn't deep enough
2023-11-22 07:14 AM - edited 2023-11-22 07:18 AM
I noticed a weird thing, with my application in debug mode, I can't see the register values instead it shows(Debug Current Instruction Pointer). But I could see the current value of D1CorePrescTable.
Name : D1CorePrescTable
Details:"Þ\0 `ßßP\032\thI\aúúúú"
Default:0x24000020 <D1CorePrescTable>
Decimal:603979808
Hex:0x24000020
Binary:100100000000000000000000100000
Octal:04400000040
But for the STemWin_HelloWorld Example, the same IDE gives a different result for the same line.
Debug Output for the same line looks as below.
Name : D1CorePrescTable
Details:"\0\0\0\0\001\002\003\004\001\002\003\004\006\a\b\t"
Default:0x801377c <D1CorePrescTable>
Decimal:134297468
Hex:0x801377c
Binary:1000000000010011011101111100
Octal:01000233574
Name : RCC_D1CFGR_D1CPRE_Pos
Details:8
Default:8
Decimal:8
Hex:0x8
Binary:1000
Octal:010
Name : RCC->D1CFGR
Details:0
Default:0
Decimal:0
Hex:0x0
Binary:0
Octal:0
Name : RCC_D1CFGR_D1CPRE_Pos
Details:8
Default:8
Decimal:8
Hex:0x8
Binary:1000
Octal:010
If you need more info please let me know. Looking forward to get some clue from given info.
2023-11-22 07:28 AM
Hello @Das
Thank you for you feedback I will check it and get back to you soon.
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.
2023-11-23 12:24 AM
Thanks @FBL.
One more noted thing between the above mentioned two application(STemWin HelloWorld and my application) is that one is STM32 Project(makefile) and my application is manually created project(CMAKE). Let me if this kind of approach is wrong or not.
Thanks.
2023-11-23 05:18 AM
Hello @Das
Are you generating the main clock using internal RC oscillator? It is possible when removing resistor R73, the system cannot run from the internal HSI while executing HAL_Init().
In my eval board, it is working without issues.
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.
2023-11-23 05:59 AM
Hi @FBL ,
I didn't make any change in my hardware. Let me tell you one thing, I have simply used STM provided Hello World Example for STM32H747I-Discovery Kit to my project. Hello World Example works fine if I import as STM project. But with the same code on my project created as Cmake based project having the above mentioned issue.
I don't understand about the R73 resistor. Where should I check for RC Oscillator?
2023-11-23 06:25 AM
Check defines pushed into the compilers command line.
2023-11-23 08:00 AM
Hello @Das
Which IDE/toolchain are you using? Could you try building the project using a different one to see if that resolves the issue? Note that default clock after Reset is HSI.
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.
2023-11-23 12:18 PM - edited 2023-11-23 12:56 PM
IDE : STM32CubeIDE
Toolchain: GNU Tools for STM32(11.3.rel1)
As I mentioned earlier, the project is not created in a standard way as I wanted to make my project as cmake based. I had a feeling that because of that only Tool settings looks different. Is that creates this issue? Is there any way I can make a proper cmake project in STM32CubeIDE. I understood that if I enable Makefile generation as selected in STM32CubeIDE projects(make based), it enables additional options. I don't know whether that has something to do with my issue. Please take a look at my project structure and guide me to run some simple example in cmake way.