Add USART support #1
BIN
build/final.elf
BIN
build/final.elf
Binary file not shown.
@@ -56,7 +56,7 @@ tim4_init:
|
|||||||
.loc 1 14 35
|
.loc 1 14 35
|
||||||
ldr r3, .L2+4
|
ldr r3, .L2+4
|
||||||
.loc 1 14 41
|
.loc 1 14 41
|
||||||
movw r2, #47999
|
movw r2, #30463
|
||||||
str r2, [r3, #40]
|
str r2, [r3, #40]
|
||||||
.loc 1 17 35
|
.loc 1 17 35
|
||||||
ldr r3, .L2+4
|
ldr r3, .L2+4
|
||||||
|
|||||||
@@ -2137,7 +2137,7 @@ void tim4_init(void) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
((struct timer *) (0x40000800U))->PSC = (uint16_t) 48000 - 1;
|
((struct timer *) (0x40000800U))->PSC = (uint16_t) 96000 - 1;
|
||||||
|
|
||||||
|
|
||||||
((struct timer *) (0x40000800U))->ARR = (uint16_t) 0xFFFF;
|
((struct timer *) (0x40000800U))->ARR = (uint16_t) 0xFFFF;
|
||||||
|
|||||||
BIN
build/timer.o
BIN
build/timer.o
Binary file not shown.
@@ -10,8 +10,8 @@ void tim4_init(void) {
|
|||||||
TIM4->CR2 = 0x0000;
|
TIM4->CR2 = 0x0000;
|
||||||
|
|
||||||
// Set prescaler
|
// Set prescaler
|
||||||
// f_clk = 48MHz -> /48000 = 1KHz counting frequency = 1ms
|
// f_clk = 96MHz -> 96E6/96E3 = 1E3 = 1KHz counting frequency = 1ms
|
||||||
TIM4->PSC = (uint16_t) 48000 - 1;
|
TIM4->PSC = (uint16_t) 96000 - 1;
|
||||||
|
|
||||||
// Set ARR to maximum value to get 1ms between updates
|
// Set ARR to maximum value to get 1ms between updates
|
||||||
TIM4->ARR = (uint16_t) 0xFFFF;
|
TIM4->ARR = (uint16_t) 0xFFFF;
|
||||||
|
|||||||
Reference in New Issue
Block a user