skills/baremetal/timers-pwm-baremetal/SKILL.md
Bare-metal timer and PWM skill. Use when configuring general-purpose timers for PWM, input capture, or periodic ticks without RTOS. Activates on queries about timer prescaler, PWM duty cycle, input capture, or SysTick bare-metal.
npx skillsauth add mohitmishra786/low-level-dev-skills timers-pwm-baremetalInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Configure MCU timers for PWM output, input capture, and periodic scheduling: prescaler/ARR setup, compare channels, and SysTick as a simple tick source.
millis() without FreeRTOSf_pwm = f_timer_clk / ((PSC+1) * (ARR+1))
duty = (CCR / (ARR+1)) * 100%
RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
TIM2->PSC = 83; /* 84MHz / 84 = 1 MHz tick */
TIM2->ARR = 999; /* 1 kHz PWM */
TIM2->CCR1 = 500; /* 50% duty */
TIM2->CCMR1 |= (6U << TIM_CCMR1_OC1M_Pos); /* PWM mode 1 */
TIM2->CCER |= TIM_CCER_CC1E;
TIM2->CR1 |= TIM_CR1_CEN;
GPIO: PA0 AF1 TIM2_CH1.
volatile uint32_t tick_ms;
void SysTick_Handler(void) {
tick_ms++;
}
void systick_init(uint32_t hz) {
SysTick_Config(SystemCoreClock / hz);
}
Configure channel in CCMR as input, set CCER polarity, read CCR on interrupt when edge captured.
/timers-pwm-baremetal 1 kHz 25% duty PWM on TIM2 channel 1
| Symptom | Cause | Fix | |---------|-------|-----| | Wrong frequency | APB timer clock doubling | Check RM timer clock x2 rule | | No PWM output | CCER/CCMR not enabled | Enable channel output | | Jittery tick | SysTick overridden | One owner for SysTick |
skills/baremetal/gpio-baremetal — timer pin AFskills/embedded/freertos — replace SysTick with RTOS tickskills/baremetal/adc-dac-baremetal — timer TRGO for ADC triggerdevelopment
QEMU/KVM skill for virtualization and kernel development. Use when running qemu-system-x86_64 with KVM, configuring virtio devices, VFIO passthrough, QMP monitor, libvirt, or booting custom kernels. Activates on queries about QEMU, KVM, virtio, VFIO, virsh, virt-install, or -kernel -append.
development
Hardware virtualization internals skill for Intel VT-x and AMD-V. Use when studying VMCS/VMCB, EPT/NPT page tables, VMEXIT handling, APIC virtualization, or building minimal hypervisors. Activates on queries about VMX, SVM, VMCS, EPT, NPT, VMEXIT, or type-1 hypervisor.
testing
Linux containers internals skill for namespaces, cgroups, and OCI. Use when understanding clone/unshare namespaces, cgroups v2 limits, overlayfs, runc, seccomp profiles, capabilities, or escape mitigations. Activates on queries about namespaces, cgroups, overlayfs, runc, seccomp-bpf, OCI spec, or container escape.
tools
Reverse engineering skill for binary analysis. Use when decompiling with Ghidra, analyzing with radare2, scripting RE tools, triaging with strings/file/xxd, or diffing binaries. Activates on queries about Ghidra, radare2, r2, decompiler, Binary Ninja, Diaphora, or stripped binary analysis.