微處理器 - Microchip AT91SAM7S64 - Assembly - Phase Locked Loop(PLL)



參考資訊:
https://www.keil.com/dd/vtr/3815/6673.htm
https://github.com/dwelch67/sam7s_samples
https://ww1.microchip.com/downloads/en/DeviceDoc/6175s.pdf
https://ww1.microchip.com/downloads/en/DeviceDoc/doc6175.pdf

MOSCEN


MUL、DIV


PLL


Example


main.s

    .equ PMC_PCER,  0xfffffc10
    .equ CKGR_MOR,  0xfffffc20
    .equ CKGR_PLLR, 0xfffffc2c
    .equ PMC_MCKR,  0xfffffc30
    .equ PIO_PER,   0xfffff400
    .equ PIO_OER,   0xfffff410
    .equ PIO_SODR,  0xfffff430
    .equ PIO_CODR,  0xfffff434
  
    .text
    .align 2
    .global _start
_start:    b reset
_undef:    b .
_swi:      b .
_pabort:   b .
_dabort:   b .
_reserved: b .
_irq:      b .
_fiq:      b .
 
reset:
    ldr r0, =CKGR_MOR
    ldr r1, =0x601
    str r1, [r0]

    ldr r0, =CKGR_PLLR
    ldr r1, =0x191c05
    str r1, [r0]

    ldr r0, =PMC_MCKR
    ldr r1, =7
    str r1, [r0]

    ldr r0, =PMC_PCER
    ldr r1, =4
    str r1, [r0]

    ldr r0, =PIO_PER
    ldr r1, =0x40000
    str r1, [r0]

    ldr r0, =PIO_OER
    ldr r1, =0x40000
    str r1, [r0]
  
loop:
    ldr r0, =PIO_SODR
    ldr r1, =0x40000
    str r1, [r0]
    ldr r4, =0x500000
1:
    subs r4, #1
    bne 1b
  
    ldr r0, =PIO_CODR
    ldr r1, =0x40000
    str r1, [r0]
    ldr r4, =0x500000
1:
    subs r4, #1
    bne 1b
    b loop
    .end

完成