Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


I can't modifie an main.c file after first compilation

Hello, the problem was solved, to change the duty cycle in the loop “while (1)”
I have proceeded as follows:

while (1)
{
/*On commence à jouer au con
* -Cablage:
* - TIM2_CH1 : PA.5 (Arduino A4) -->REDLED
- TIM2_CH2 : PA.1 (Arduino A1) -->GREENLED
- TIM2_CH3 : PA.2 (Arduino A7) -->BLUELED
- TIM2_CH4 : PA.3 (Arduino A2) -->

* */
/*On commnce par faire varier la led rouge
* avec les #define PULSEX_VALUE
* On les remplacera par des fonctions d’ incrémentaions par la suite
* */
sConfig.Pulse = PULSE1_VALUE;
if (HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_1) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
if (HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_1) != HAL_OK)
{
/* PWM Generation Error */
Error_Handler();
}
HAL_Delay(2000);

sConfig.Pulse = PULSE2_VALUE;

if (HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_1) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
if (HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_1) != HAL_OK)
{
/* PWM Generation Error */
Error_Handler();
}
HAL_Delay(2000);

sConfig.Pulse = PULSE3_VALUE;
if (HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_1) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
if (HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_1) != HAL_OK)
{
/* PWM Generation Error */
Error_Handler();
}
HAL_Delay(2000);

sConfig.Pulse = PULSE4_VALUE;
if (HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_1) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
if (HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_1) != HAL_OK)
{
/* PWM Generation Error */
Error_Handler();
}
HAL_Delay(2000);

}

I have therefore been able to vary the intensity of my LED.

Thank Skywodd, who brought me the solution.
How to independently change the duty cycle of a PWM channel from the example TIM / TIM_PWMOut