STM32L071 peripherals problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 2:41 PM
We designed a very basic circuit to test an idea. We chose STM32L071K8U6. Because, It met our needs well.
Schema
MCU Pinmap
MCU Clock config in STM32CubeIde
If you look at the clock settings, this processor does not use an external resonator. It currently provides a builtin 16mhz internal oscillator.
We can upload programs to the processor via SWD. However, we cannot use peripherals.
The program often freezes on lines like MX_USART1_UART_Init () or MX_I2C3_Init ().
It seems like a clock setting problem but we couldn't find a solution.
What are we doing wrong?
- Labels:
-
RCC
-
STM32L0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 3:23 PM
You can try to set clock above 16M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 3:43 PM
Hi, thank you for the answer.
When I set the clock to 32Mhz (max) or 24 Mhz. It gets stuck on in SystemClock_Config
Exactly below lines in generated SystemClock_Config function.
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 3:50 PM
Hi, thank you for the answer.
When I set the clock to 32Mhz (max) or 24 Mhz. It gets stuck on in SystemClock_Config
Exactly below lines in generated SystemClock_Config function.
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 5:03 PM
Are you generating code with stm32cub? Try to check conflict or make new project to test uart alone. I used this chip, if i set clock below 16M, uart can't work well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 5:34 PM
Yes, Im generating code with stm32CubMx which inside of stm32cubeide.
I've tried to create many projects with many clock options to test uart, i2c alone. No luck.
Meanwhile, inside stm32l0xx_it.c the SysTick_Handler does not get called.
Could this be the source of the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-14 5:40 PM
It's really weird. Can only work at your initial clock frequency 4.194M??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-15 9:54 AM
I also tried increase speed up to 32 Mhz.
But, unfortunately code stuck below line in SystemClock_Config()
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
I didn't write any custom code yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-04-15 10:10 AM
All very odd
FLASH_LATENCY_1 should be adequate for 32 MHz at 3.3V
Is the part Hard Faulting?
VDDIO2 is only for PA11/PA12 as I recall
Circuit looks simple enough, resolution if image is poor
I'd start with the supplies, probably add some bulk capacitance near-in
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
2021-04-15 5:26 PM
I mean,you can try to make a new project to confirm the function SystemClock_Config can only work at 4.194M? Maybe it's not the frequency of modification.
