OntarioTechRacing / embedded

Embedded Software Department Documentation Repository
1 stars 0 forks source link

add pwm documentation #4

Closed kunalpanda closed 4 months ago

danielljeon commented 6 months ago

Intro

"Why are PWM Timers important?"

  1. The given explanation is very vague and potentially misleading.
    • Explain it simple, PWM is Pulse Width Modulation. Its pulses of high and low signals (digital). It can be used for variable power delivery, but also many applications such as digital signals and data.
  2. Should mention basic PWM principles at least such as duty cycle.
  3. Explain more applications of PWM.

ioc Config and Code

  1. The image doesn't really show anything, just that TIM1 is selected.
  2. The code blocks should be in line with the numbered list items (indent).
  3. Clean up your formatting (use a formatted at the least).
  4. Step 7: "To set a specific frequeny for the PWM, use the following code", this is only for initialization. How would someone use PWM to send a variable signal over time?
  5. You show initialization code as shown below, you should probably explain counter mode, period and auto reload reload at the minimum.
    htim1.Init.Prescaler = 79; // Prescaler
    htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
    htim1.Init.Period = 999; // Period for 1 kHz frequency
    htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
    htim1.Init.RepetitionCounter = 0;
    htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
    if (HAL_TIM_PWM_Init(&htim1) != HAL_OK)