STM32L073 LQFP100 - Adding quartz does not work

Viewed 179

I started with a STM32L073RZT dev board. Everything works just fine. I added a MX1V-T1N 32768 kHz crystal with two capacities for ground, as described in the manual. I used the external crystal for the LSE. The LSE is the input on my LPTIM1. Now I have a STM32L073 LQFP100 chip on my own board, and I set up the same quartz in the same way, but it does not work. The LPTIM1 does not start counting, when I use LSE as external input. When I select LSI (internal clock) LPTIM1 does start to count and everything works.

In the main() I initialize the LPTIM with:

MX_LPTIM1_Init();


static void MX_LPTIM1_Init(void)
{

  /* USER CODE BEGIN LPTIM1_Init 0 */

  /* USER CODE END LPTIM1_Init 0 */

  /* USER CODE BEGIN LPTIM1_Init 1 */
  /* USER CODE END LPTIM1_Init 1 */
  hlptim1.Instance = LPTIM1;
  hlptim1.Init.Clock.Source = LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC;
  hlptim1.Init.Clock.Prescaler = LPTIM_PRESCALER_DIV1;
  hlptim1.Init.Trigger.Source = LPTIM_TRIGSOURCE_SOFTWARE;
  hlptim1.Init.OutputPolarity = LPTIM_OUTPUTPOLARITY_HIGH;
  hlptim1.Init.UpdateMode = LPTIM_UPDATE_IMMEDIATE;
  hlptim1.Init.CounterSource = LPTIM_COUNTERSOURCE_INTERNAL;
  if (HAL_LPTIM_Init(&hlptim1) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN LPTIM1_Init 2 */
  /* USER CODE END LPTIM1_Init 2 */

}

And I start the counter with:

 HAL_LPTIM_Counter_Start_IT(&hlptim1, ZYKLUS);

What can might be the problem?

  • To answer your question by editing my question: I took the two capacitors and the oscillator I used on the dev board (where they worked) and used them for testing on my board with the STM32L073 LQFP100. I connected them to the RCC_OSC32_IN and RCC_OSC32_OUT.

  • @Lundin Thanks for your answer! Yes, I use soldering pads to connect the oscillator, but I make sure that enough of the oscillator's pin is covered in tin solder. About the 'working' part: I am using an oscilloscope to check if the oscillator is working. There is no measureable wave pattern. The RCC_OSC32_OUT has a ~1V level and the RCC_OSC32_IN is 0V. When soldering the same components to the dev board's RCC_OSC32_IN and RCC_OSC32_OUT. I see the same 0V on the RCC_OSC32_IN pin and a wave pattern at a ~1V level on the RCC_OSC32_OUT pin.

  • @Max I see a wave pattern, roughly of the expected frequency. The Image below shows what I see on RCC_OSC32_OUT of the dev board. When soldered to 'my board' there is a constant level on ~1V. Supply and other Voltages are, what i would expect. enter image description here

1 Answers

I want to confirm that the current state is that you used the STM32L073RZT dev board and added an external quartz oscillator as the trigger source of LPTIM1, and it can work normally here. But you later used the STM32L073 LQFP100 chip by yourself, soldered the quartz oscillator yourself, and tried to use LPTIM1 for counting, but using the LSE trigger source did not work, but other trigger sources can work (LSI, APB, HSI16)

If this is the case, I think it might be the following problem:

  1. Is the pin of the external quartz oscillator not connected to the correct position? LQFP100: To use the external trigger signal of LPTIM1, which pin should be connected to

But according to the response from the above comment, the output voltage waveform of the quartz oscillator is also the same as that on the development board. I think this should not be the problem.

  1. Is the initial setting correct? I think hlptim1.Init.Clock.Source should be checked whether is correct or not. Do you use the same code when using the development version and your MCU? If so, maybe you can use the debug mode to check whether there is a count.

I think there is no problem with the hardware, it should be triggered, or try the interrupt function to see if it will trigger the interrupt.

  1. Is there a problem with the MCU itself?

Maybe you can change to a new MCU to see if the same situation will happen, but I think the probability of MCU failure should be relatively low. If there is a problem, there should be no way to program, but I think it is still possible Give it a try.

Please correct me if there is any misunderstanding. Thanks you :]

Related