This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.


关于配置Timer为PWM模式,在AM335X Technical Reference Manual的20.1.3.5 Pulse-Width Modulation中有介绍,但客户在使用时反应实际进行编程操作时,存在一些困惑,且starterware中无相关例子可参考。




# Enable Timer4's clock in CM_PER

# This allows us to access it's control regs

devmem2 0x44e00088 w 0x2


# Set the Pinmux for Timer4 (0x2 because its mode 2 of this pin)

# Using the pin mux linux driver from the SDK

echo 0x22 > /sys/kernel/debug/omap_mux/xdma_event_intr0



# Timer configurations.. Stop Timer.

# Auto-Reload

# Compare Mode Enabled

# Trigger set on overflow

# Toggle Mode

devmem2 0x48044038 w 0x1842


# Write to the CM_DPLL registers to select the clk source

# Selected the clk source for the Timer4

# This should be &= (default 0x12) (writing a 0x2 for 32kHz)

devmem2 0x44e00510 w 0x12


# Initial count value

devmem2 0x4804403C w 0xFFFFC000


# Set the re-load value

devmem2 0x48044040 w 0xFFFFC000


# Setting a duty cycle

devmem2 0x4804404C w 0xFFFFE000



# Start Timer

devmem2 0x48044038 w 0x1843