using stm32f401rct6, two question, (1) system clock configured with a external 16Mhz crystal can work if it is set to 42Mhz but not at 84Mhz and (2) even if working will stuck at HAL_GetTick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-02 1:30 AM
(1) cannot run at 84Mhz, it will stuck at Error Handler
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 16;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV8;
RCC_OscInitStruct.PLL.PLLQ = 4;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
(2) can run at 42Mhz but will keep looping inside the loop forever and cannot timeout
/* Wait till HSE is ready */
while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET)
{
if((HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
else
- Labels:
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-02 1:47 AM
What is your hardware? Is there a crystal connected to HSE pins?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-02 3:42 AM
@JTse.1​
- show us your pcb(detail on the XTAL)
- are you using cubeMX? , attach your cubeMX ".ioc" file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-04 10:05 PM
Yes, I have a 16Mhz crystal connected
Part number: CRYSTAL, SMD, 16MHz, 2.5X2.0 CX2520SB27120D0FLJZZ
See attached
Noticed that in the circuits is a 1M resistor in series
This resistor was indicated in the generic design document , but it was not
Indicated in the reference manual. Could it be the problem?
The crystal used has been proven working in several board but using NXP ARM
The circuit there has the resistor in parallel with values from 33R to 10M
And some boards do not even have it installed
I am in the process of converting all my NXP boards to using ST CPU
I have another ST board with the same resistor but using only 33R and it worked
I suspect this 1M resistor value is too high, I am going to change to 33R since my other ST board is working.
I was mistaken, with HSE on, the code got stuck because the HSE rdy never got set
With only the internal 16Mhz, I can run the code
Still, I have some strange problems
But no matter what setting I did in stmcudeidse, I can turn on the PLL but the PLL rdy bit do not lock
The good news is that I can run the board using the default low speed setting but will need to get the HSE working in order to do
Mass production soon
john
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-04 10:13 PM
I am using stmcubeide
I have a 16Mhz crystal connected
Part number: CRYSTAL, SMD, 16MHz, 2.5X2.0 CX2520SB27120D0FLJZZ
See attached
Noticed that in the circuits is a 1M resistor in series
This resistor was indicated in the generic design document , but it was not
Indicated in the reference manual. Could it be the problem?
The crystal used has been proven working in several board but using NXP ARM
The circuit there has the resistor in parallel with values from 33R to 10M
And some boards do not even have it installed
I am in the process of converting all my NXP boards to using ST CPU
I have another ST board with the same resistor but using only 33R and it worked
I suspect this 1M resistor value is too high, I am going to change to 33R since my other ST board is working.
I was mistaken, with HSE on, the code got stuck because the HSE rdy never got set
With only the internal 16Mhz, I can run the code
Still, I have some strange problems
But no matter what setting I did in stmcudeidse, I can turn on the PLL but the PLL rdy bit do not lock
The good news is that I can run the board using the default low speed setting but will need to get the HSE working in order to do
Mass production soon
john
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-04 10:40 PM
your osc circuit should look like this:
show your circuit, if you expect any useful help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-04 11:32 PM
I am using stmcubeide
I have a 16Mhz crystal connected
Part number: CRYSTAL, SMD, 16MHz, 2.5X2.0 CX2520SB27120D0FLJZZ
See attached
Noticed that in the circuits is a 1M resistor in series
This resistor was indicated in the generic design document , but it was not
Indicated in the reference manual. Could it be the problem?
The crystal used has been proven working in several board but using NXP ARM
The circuit there has the resistor in parallel with values from 33R to 10M
And some boards do not even have it installed
I am in the process of converting all my NXP boards to using ST CPU
I have another ST board with the same resistor but using only 33R and it worked
I suspect this 1M resistor value is too high, I am going to change to 33R since my other ST board is working.
I was mistaken, with HSE on, the code got stuck because the HSE rdy never got set
With only the internal 16Mhz, I can run the code
Still, I have some strange problems
But no matter what setting I did in stmcudeidse, I can turn on the PLL but the PLL rdy bit do not lock
The good news is that I can run the board using the default low speed setting but will need to get the HSE working in order to do
Mass production soon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-05 12:50 PM
You posted the same post 3 times, each sentence is on a separate line and the space between lines consists of 3 empty lines. It's worse than spam! Edit those posts so that the topic is readable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-05 2:33 PM
Please don't repetitively post the same material, post it once, everyone can see it.
Here's the App Note https://www.st.com/resource/en/application_note/cd00221665-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf
Show your circuit as constructed.
The HAL Tick requires SysTick to be up and running.
The crystal has to start. The output can be probed if you enable it's output on PA8/MCO pin.
The MCU can crash if the PLL and FLASH wait states are wrong.
Make sure HSE_VALUE define in stm32f4xx_hal_conf.h reflects the speed of your external crystal.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-05 9:04 PM
I do not understand where I posted 3 times?
I was just answering different people
I remember posting it once initially
And as for space and lines, it looks normal on my side
Even your reply shows my post looks normal
Pls help me to understand where did I go wrong?
john
