cancel
Showing results for 
Search instead for 
Did you mean: 

Need to know capability of STM32L073RZ board for generating sinusoidal 12.5 MHz burst signal.

Dineshkumar
Associate II

Hi All ,

I want to generate the following specification of the burst signal from the STM32L073RZ board  , need to know is that possible? Or else need your valuable suggestion whether it is possible from other STM32 boards?

 Parameters

Values /Settings

Waveform

Sine

Offset

0V

Phase

0 deg

Amplitude

 2mV

Frequency

12.5MHz

Burst Cycle #

 150

Trigger

 External

Load Impedance

 50 ohm

 

 

26 REPLIES 26

@tjaekel wrote:

I have checked the STM32H745/755 and STM32H747/757 MCU (I am using); Even the MCU core runs very fast (480 MHz) - the DAC is still at 1 MSps.


Small technical note. DAC is capable up to 50Msps (AN4566), but even that is not enough.

Hi All , On trying PWM signal generation using STM32 L073RZ board, I could only maximum get the PWM signal frequency of 580 Khz , why is it so? Because  all the timers and system clock frequency was set as 32 MHz and PSC =  0 and Period : 2 , I should supposed to get 16 MHz PWM signal correct? why I cannot achieve this? Please guide me.

A) you have wrong clock configuration
B) you have wrong timer configuration

Use MCO feature and PLL instead of Timer. It will have better frequency resolution.

Hi , Please find below the clock configuration , I have used TIM2_CH1 for generating PWM signal @ PA0 pin. All timers are configured to 32 MHz only, In my clock configuration , the MCO source is not selectable ( greyed out). And the below code is what I used for the same. Please guide me  how to get the desired frequency of PWM signal( atleast 16 MHz) . FYI, I am using STM32 L073RZ board.

 

The value of htim2.Init.Period was changed many times and at max I have got only 580 Khz signal by setting this value as "55-1". 

 

Dineshkumar_0-1709090151799.png

static void MX_TIM2_Init(void)
{

/* USER CODE BEGIN TIM2_Init 0 */

/* USER CODE END TIM2_Init 0 */

TIM_ClockConfigTypeDef sClockSourceConfig = {0};
TIM_MasterConfigTypeDef sMasterConfig = {0};
TIM_OC_InitTypeDef sConfigOC = {0};

/* USER CODE BEGIN TIM2_Init 1 */

/* USER CODE END TIM2_Init 1 */
htim2.Instance = TIM2;
htim2.Init.Prescaler = 0;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 55-1;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
{
Error_Handler();
}
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 35;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM2_Init 2 */

/* USER CODE END TIM2_Init 2 */
HAL_TIM_MspPostInit(&htim2);

}

Search tutorials to use MCO ... for example:
https://community.st.com/t5/missing-articles/how-can-i-output-a-clock-signal-to-the-stm32-s-mco-pin/td-p/49583
If your timer "period" is set to 55, then its frequency will be 32MHz/55=582kHz... what is wrong with that ? :)
Looks like you need to study the basics. Take a look on series of STM32 MOOC courses
https://www.youtube.com/watch?v=sQCqVBuq-gA&list=PLnMKNibPkDnGtuIl5v0CvC81Am7SKpj02
and STM32 "hands on" courses (youtube). You can also search for some books. For example "Mastering the STM32 Microcontroller by Carmine Noviello" is good one. Also you can find good tutorials on web. for example:
https://embedded.fm/blog/embedded-wednesdays

Thanks for pointing out , using RCC and MCO and I could generate 12 MHz clock signal ( square pulse) , but it is ringing like below , kindly guide me where I am doing wrong ( or) the exact output from the MCO will be like this.

Below is the system clock configuration.

/**
* @brief System Clock Configuration
* The system Clock is configured as follows :
* System Clock source = PLL (HSI)
* SYSCLK(Hz) = 12000000
* HCLK(Hz) = 12000000
* AHB Prescaler = 1
* APB1 Prescaler = 4
* APB2 Prescaler = 2
* HSI Frequency(Hz) = 16000000
* PLL_MUL = 6
* PLL_DIV = 2
* Flash Latency(WS) = 1
* @retval None
*/

 

Dineshkumar_0-1709118343409.jpeg

 

 

Wrong probing, probably like in figure 1.9 there:
https://download.tek.com/document/02_ABCs-of-Probes-Primer.pdf