rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit 31b8a0f3c01e559312118174e8e75b00148de40b
parent eb40b0e9cc98390ce77b8e4b5a3c302600444f77
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Mon, 26 Feb 2024 11:59:54 +0900

I think the clock which drives periferals bacomes slower
after pushing the RUN button

Diffstat:
Mex3/boot2.s | 4----
Mex3/main.s | 24+++++++++++++++---------
2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/ex3/boot2.s b/ex3/boot2.s @@ -3,10 +3,6 @@ .section .boot2 setup_xip: - ldr r3, =0x20000000 - ldr r0, =0xdeadbeef - str r0, [r3, #0] - ldr r3, rom_base ldrh r0, [r3, #0x14] // rom_func_table diff --git a/ex3/main.s b/ex3/main.s @@ -100,14 +100,16 @@ wait_vco: // enable FIFO and set format ldr r0, =(3 << 5 | 1 << 4) // WLEN = 8, FEN = 1 str r0, [r3, #0x2c] // UART: UARTLCR_H - +/* // enable interrupt ldr r3, ppb_base // enable timer_irq_0 ldr r1, =0xe100 mov r0, #1 str r0, [r3, r1] // M0PLUS: NVIC_ISER +*/ +loop: // setup timer ldr r3, timer_base // enable alarm_0 interrupt @@ -117,15 +119,19 @@ wait_vco: ldr r0, =0x20000 // bl set_alarm - ldr r3, =0x20000000 - ldr r0, [r3, #0] - bl printh - mov r0, #0 - str r0, [r3, #0] -loop: - wfi - ldr r0, =0xcafecafe +wait: + ldr r0, [r3, #0x20] // TIMER: ARMED + mov r1, #0x1 + tst r0, r1 + bne wait + + mov r3, #0 + ldr r0, [r3, #0x4] bl printh + mov r0, #'\r' + bl putbyte + mov r0, #'\n' + bl putbyte b loop // functions