Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RESET: //[Memory mapping control]
- ldr r0,=MEMMAP ;[User Flash Mode. Interrupt vectors are not re-mapped and reside in Flash.]
- mov r1,#0x01
- strb r1,[r0]
- //[Memory accelerating module control]
- ldr r0,=MAMTIM
- mov r1,#0x04 ;[MAM Module: #0x01-#0x07 system clock divider]
- strb r1,[r0]
- ldr r0,=MAMCR
- mov r1,#0x02 ;[MAM Mode: #0x00 - Off, #0x01 - half, #0x02 - full]
- strb r1,[r0]
- //[VPB clock control]
- ldr r0,=VPBDIV
- mov r1,#0x00 ;[Peripheral Devices Clock: #0x00 - 1/4]
- strb r1,[r0]
- //[PLL control]
- ldr r0,=PLLCFG
- mov r1,#0x44 ;[M = 5, P = 2]]
- strb r1,[r0]
- ldr r0,=PLLCON
- mov r1,#0x01 ;[PLL enable]
- strb r1,[r0]
- ldr r0,=PLLFEED
- mov r1,#0xAA
- mov r2,#0x55
- strb r1,[r0] ;[Accepting..]
- strb r2,[r0] ;[..changes]
- plock_check: ;[Checking PLOCK bit for PLLSTAT register]
- ldr r0,=PLLSTAT
- ands r0,r0,#0x400
- bne plock_check
- ldr r0,=PLLCON
- mov r1,#0x03 ;[PLL enable and connect]
- strb r1,[r0]
- ldr r0,=PLLFEED
- mov r1,#0xAA
- mov r2,#0x55
- strb r1,[r0] ;[Accepting..]
- strb r2,[r0] ;[..changes]
- //[Power control]
- ldr r0,=PCONP
- ldr r1,=0x00000228 ;[1bit - TIM0, 2bit - TIM1, 3bit - UART0, 4bit - UART1, 5bit - PWM0, 7bit - I2C0, 8bit - SPI0, 9bit - RTC, 10bit - SPI1, 12bit - AD0, 19bit - I2C1]
- str r1,[r0]
- //[RTC control]
- ldr r0,=CCR
- mov r1,#0x12 ;[CTC Reset; External 32 kHz Oscillator]
- strb r1,[r0]
- ldr r0,=AMR
- mov r1,#0xFF ;[Turn off all alarm]
- strb r1,[r0]
- //[IO ports control]
- ldr r0,=PINSEL0
- ldr r1,=0x000A0005 ;[PWM4,PWM6]
- str r1,[r0]
- ldr r0,=PINSEL1
- ldr r1,=0x00000000
- str r1,[r0]
- ldr r0,=IO0DIR
- ldr r1,=0x80000000
- str r1,[r0]
- ldr r0,=IO0PIN
- ldr r1,=0x00000000
- str r1,[r0]
- //[PWM control]
- ldr r0,=PWMPR
- ldr r1,=0x00000001 ;[PWM Clock = 1/2 Peripheral Clock]
- str r1,[r0]
- ldr r0,=PWMMCR
- ldr r1,=0x00000002 ;[Reset on PWMMR0: the PWMTC will be reset if PWMMR0 matches it]
- str r1,[r0]
- ldr r0,=PWMMR0
- ldr r1,=0x000000FF
- str r1,[r0]
- ldr r0,=PWMMR4
- ldr r1,=0x00000000
- str r1,[r0]
- ldr r0,=PWMMR6
- ldr r1,=0x00000000
- str r1,[r0]
- ldr r0,=PWMLER
- ldr r1,=0x00000051 ;[Allow update values for 0,4,6]
- str r1,[r0]
- ldr r0,=PWMPCR
- ldr r1,=0x00005000 ;[Single edge controlled mode, PWM4 and PWM6 enabled]
- str r1,[r0]
- ldr r0,=PWMTCR
- ldr r1,=0x00000009 ;[PWM enable]
- str r1,[r0]
- //[UARTs control]
- ldr r0,=U0LCR
- ldr r1,=0x80 ;[Enable access to Divisor Latches]
- str r1,[r0]
- ldr r0,=U0DLL
- ldr r1,=0x74 ;[Low byte of speed]
- str r1,[r0]
- ldr r0,=U0DLM
- ldr r1,=0x00 ;[High byte of speed]
- str r1,[r0]
- ldr r0,=U0LCR
- ldr r1,=0x03 ;[Disable access to Divisor Latches, 8-bit, 1 stop bit]
- str r1,[r0]
- //[PWM: Set Value]
- ldr r0,=PWMMR4
- ldr r1,=0x000000F0
- str r1,[r0]
- ldr r0,=PWMMR6
- ldr r1,=0x000000F0
- str r1,[r0]
- ldr r0,=PWMLER
- ldr r1,=0x00000050
- str r1,[r0]
- //[Testing some shit]
- ;ldr r0,=PCON
- ;mov r1,#0x02 ;[#0x01 for Idle mode, #0x02 for PowerDown mode]
- ;strb r1,[r0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement