swiftgeek / hykker-re Goto Github PK
View Code? Open in Web Editor NEWHykker X Range 2017 (RE-K70-BYK800) Reverse Engineering notes, schematics and boardviews
Hykker X Range 2017 (RE-K70-BYK800) Reverse Engineering notes, schematics and boardviews
Should be not related to firmware it's running (BYK801)
Normally LQFP64 package would have "SH68F881Q" marking (when chip package marking is not customized - like it is the case for BYK801)
INSCON.BKS0
(SFR 0x86, bit6) is utilized in SH68F881
uVar1 = read_volatile_1(0x86);
write_volatile_1(0x86, uVar1 | 0x40);
92h
93h
95h
A2h
AAh
ABh
ACh
ADh
BANK0_SFR__BANK1_SFR
and BANK0_SFR__BANK1_SFR.BANK0_BIT__BANK1_BIT
for bit addressable registersORL INSCON,#0x40
ANL INSCON,#0x3f
(Bank selection field is 2 bit wide)ISP is a firmware block typically at end of (flash/otp/mask) ROM memory space - last 1KiB sector. May use different storage technology to main code area depending on particular chip. There are also some logic features associated with it, allowing for:
ISPLO
/ISPCON
register write sequence.
0x7C00
AUXC
and INSCON
(MUL/DIV)DPTR
and DPTR1
, selected via INSCON.DPS
Contained in one of SH51.CDB
μVision Device Databases:
8051 based Full Static CMOS controller with two-Level Program Memory Lock
72 I/O lines, 3 Timers/Counters, 13 Interrupts sources, 1 BaseTimer, 3 PWM, UART,
WDT, LVR, Regulator, SPI, Full Speed USB,
32K Flash Memory, 2560 Bytes On-chip RAM, 2048 Byte EEPROM
IRAM(0 - 0xFF) IROM(0-0x7FFF) XRAM(0-0x8FF) CLOCK(24000000)
strings SH51.CDB | grep '^SH68F881$' -A13
Though sinowealth's *.CDB
files don't match datasheets perfectly, so take it with a grain of salt, especially on interrupt sources count
P4.7
having R̅E̅S̅E̅T̅
alt function.
P4.0
- TDO
P4.1
- TMS
P4.2
- TDI
P4.3
- TCK
P4.7
- R̅E̅S̅E̅T̅
P3.5
- SCRLOCK
P3.6
- CAPSLOCK
P3.7
- NUMLOCK
Likely 0A00H - 0AAFH
, since XRAM
and USB RAM
ranges seem to be paired together. But that's just a guess for now
0A00H - 0AAFH
- Confirmed with BYK801 firmware
Dangerous pins connected to straight into some rail, that could be fried very easily when misconfigured:
WTF1
signal) - 0Ω link to GND!
Since SH68F88 headers mention PxPCR
registers, we have a true GPIO here (like SH68F90)!
Safe pins:
Describes build I'm using in particular. Different build/fw revision may manifest different behavior
Most likely Keil uVision2, since at the time of this board being shipped sinowealth didn't provide packages for newer uVision. JET51A_Keil_V1.8.10.3.zip
is the last available sinowealth package for UV2.
0x7C00
-0x7FFF
) defined by MCU, to cover last 4KiB of flash (0x7000
-0x7FFF
). BYK916 similarly has 4KiB bootloader at end of flash.0x00
) seems to immediately jump to ISP FW (0x7000
), so with default firmware looking for ISP pin straps (MCU defined, OP_ISPPIN
/OP_ISP
) OP_ISPPIN
, 0x7C00
) doesn't even appear to be functional in BYK801, as it lands us in the middle of random USB routine!
0x6FFB-0x6FFD
into 0x0000-0x0002
, then filled 0x6FFB-0x6FFD
with 0x00
. This changed reset vector from 02 70 00
to 02 3b cc
LJMP
to 0x7F00
is nowhere to be found.0x7F00
entrypoint appears to be functional. 0x7F00
offset is firmware defined (BYK916 has similar entrypoint at 0xFF00
)0603:1020
P0.2
and P0.3
pins, which is likely to correspond to USB D+
and D-
pins. Likely follows "USB ISP Boot Circuit" from SH61F83.P0.2
P0.3
condition is not detected, ISP FW will jump to 0x3BCC
entrypoint (defined by ISP FW) in main FW. But when the condition is met, it will first erase 1KiB sector starting from 0x3B00
, which would include main FW entrypoint.RETI
use:
IRQ0
IRQ3
IRQ5
- TIMER2 perhaps?IRQ8
IRQ9
IRQ10
IRQ11
- USB/EUSBI do not have board with BYK916, but I still noticed some things, that would be good to follow/reference.
Some features/pins/polarity might be configurable in firmware.
I'm also prone to making loads of typos, so really please check with the board
Also this only covers BYK916-specific details, see #1 for general ones.
BYK916 pinout (this refers mostly to BYKxxx firmware, and not actual MCU - which is reported to be SH68F90A):
BYK916 kicad symbol (incomplete)
Read SH68F90 CV2.0.pdf for actual MCU pins
BYK916 charge features:
CH
- connects to a charge controller, netname after a resistor CHARGE
.
USB-CH
- simply detects voltage being applied to USB connector
BYK916 connection to BT MCU - Beken BK3632
CSNA
/ CLKA
/ MOSIA
/ MISOA
- SPI/JTAG interface for BK3632, could be used for ICP/ISP of flash in BK3632.
P42A
(BK3632 GPIO P11
) - Unknown, function implemented in BK3632 firmwareMOTA
(BK3632 GPIO P31
) - Unknown, function implemented in BK3632 firmwareBYK916 RGB LED driving pins
Row0:
Red: VR0 -> P4_1
Green: VG0 -> P6_0
Blue: VB0 -> P4_0
Row1:
Red: VR1 -> P0_4
Green: VG1 -> P6_1
Blue: VB1 -> P0_3
Row2:
Red: VR2 -> P6_7
Green: VG2 -> P6_2
Blue: VB2 -> P6_6
Row3:
Red: VR3 -> P0_2
Green: VG3 -> P6_3
Blue: VB3 -> P5_7
Row4:
Red: VR4 -> P4_5
Green: VG4 -> P6_4
Blue: VB4 -> P4_6
Row5:
Red: VR5 -> P4_3
Green: VG5 -> P6_5
Blue: VB5 -> P4_4
Conventions (as on RE-K70-BYK800 board)
SW0
(ESC) - SW15
SW36
- SW20
SW37
- SW53
SW97-1
instead of SW50
SW73
- SW62
, SW98-1
last
SW98-1
instead of SW61
SW74
- SW86
SW103
- SW93
SW97
, SW98
exist in this row despite those extra switches with -1 suffixRx
and other to D_Cx
(custom netname, check customizations section)LEDx
(derived from VDD5V
) and other to VDRx
(derived from GND
)
GND
pad is actually a very short trace to nearby long traceDRx
- Rows for LED diodes muxing DR0
.. DR5
DR4
-> RR4
/ QR4
/ R4
DR5
-> RR5
/ QR5
/ R5
QR5
(collector) has netname VDR5
QR5
(emitter) is connected to GND
Rx
- Rows for switches muxing - R0
.. R5
. Connected directly to switch contacts.Cx
- Columns for both switch (through diode) and LED muxing (through QCx
transistors)
C17
-> RC17
-> QC17
QC17
(collector) has netname LED17
QC17
(emitter) is connected to VDD5V
QC17
(base) is connected to RC17
and has netname R_C17
(customized netname)C17
-> SW14
/ SW21
/ SW52
/ SW52
/ SW86
/ SW94
(connection to switch contact through a diode)Customizations (deviations from BYKxxx conventions) in this repo:
D_Cx
to make it easier to highlight with OpenBoardView using prefix search feature. This way both D_C
and C
prefixes can be highlighted as regex is not yet supported - usual way would be to have _R/_D/etc suffix.QCxx
) base will be called R_Cx
for similar reasons as aboveA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.