參考資訊:
https://github.com/ghidraninja/game-and-watch-backup
https://www.st.com/resource/en/datasheet/stm32h7b0vb.pdf
https://www.st.com/resource/en/reference_manual/dm00463927-stm32h7a37b3-and-stm32h7b0-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
電池充電電路
| PE8 | 0(開始充電) | 1(停止充電) |
| PA2 | 0(有效電源) | 1(無效電源) |
| PE7 | 0(充電中) | 1(充電完成) |
BQ24072RGT
main.s
.equiv PORTA_BASE, 0x58020000
.equiv PORTE_BASE, 0x58021000
.equiv GPIO_MODER, 0x0000
.equiv GPIO_PUPDR, 0x000c
.equiv GPIO_IDR, 0x0010
.equiv GPIO_ODR, 0x0014
.equiv RCC_BASE, 0x58024400
.equiv RCC_AHB4ENR, 0x0140
.thumb
.cpu cortex-m7
.syntax unified
.global _start
.text
.org 0x0000
_start:
.word 0x20020000
.word reset
.org 0x0100
.thumb_func
reset:
ldr r0, =RCC_BASE
ldr r1, [r0, #RCC_AHB4ENR]
orr r1, #0x1f
str r1, [r0, #RCC_AHB4ENR]
ldr r0, =PORTA_BASE
ldr r1, =0xa9000000 | (1 << 12) | (1 << 8)
str r1, [r0, #GPIO_MODER]
ldr r0, =PORTE_BASE
ldr r1, =(1 << 22)
str r1, [r0, #GPIO_MODER]
ldr r1, =(1 << 11)
str r1, [r0, #GPIO_ODR]
0:
ldr r0, =PORTA_BASE
ldr r1, [r0, #GPIO_IDR]
lsl r1, #4
and r1, #(1 << 6)
eor r1, #(1 << 6)
ldr r0, =PORTE_BASE
ldr r2, [r0, #GPIO_IDR]
lsr r2, #3
and r2, #(1 << 4)
eor r2, #(1 << 4)
orr r1, r2
ldr r0, =PORTA_BASE
str r1, [r0, #GPIO_ODR]
b 0b
.end
屏背光有三顆LED(PA6、PA5、PA4),PA6用來指示有效電源,PA4用來代表充電狀態

拔掉USB-TypeC後

完成充電後