Andy
Edit: there is a newer version of the project later in this thread with a lot more details.
Cool? Ranking DIY
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamjitsirakowsk wrote:We are. I think we have `N' powered devices lying around as well so as soon as we hook it up we should be able to get something similar. In the meanwhile we are planning to use Beken's BLE profile api to get a full `transparent UART' and reverse engineer the lower level calls (setting registers, basically). We try to write about details, we found that it helps beginners ask the right questions.
Andy
xabean wrote:I got JTAG working, it's the same pins used for SPI programming, so I didn't need to rewire anything. Drop the below config into bk7321t.cfg, and run openocd -f bk7321t.cfg to start it up.
source [find interface/raspberrypi2-native.cfg] ## https://docs.microsoft.com/en-us/windows/iot-core/learn-about-hardware/pinmappings/pinmappingsrpi ## ## CEN -> (bcm)GPIO 22 / RPI3b pin 15 ## SCLK -> (bcm)GPIO 11 / RPI3b pin 23 ## CSN -> (bcm)GPIO 08 / RPI3b pin 24 ## SI -> (bcm)GPIO 10 / RPI3b pin 19 ## SO -> (bcm)GPIO 9 / RPI3b pin 21 # Each of the JTAG lines need a (bcm) gpio number set: # tck tms tdi tdo bcm2835gpio_jtag_nums 11 8 10 9 # srst bcm2835gpio_srst_num 22 # we only have CEN (aka chip enable, system reset) reset_config srst_only # CEN is normally pulled high, but sometimes it can help to force it high, not just low. reset_config srst_push_pull # on connect, deassert (reset to HIGH) the SRST pin reset_config connect_deassert_srst # we have no TRST pin, tell OpenOCD to imagine it's tied to SRST. reset_config srst_pulls_trst # use JTAG. transport select jtag # go slow. adapter speed 100 # wait 200ms after releasing srst before we send JTAG commands over TMS, # we will never reset into halt because we have no tRST pin :( adapter srst delay 200 if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME } else { set _CHIPNAME bk7321t } if { [info exists ENDIAN] } { set _ENDIAN $ENDIAN } else { # this defaults to a little endian set _ENDIAN little } if { [info exists CPUTAPID] } { set _CPUTAPID $CPUTAPID } else { set _CPUTAPID 0x15968001 } jtag newtap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME
Then you can read the flash chip ID over the OpenOCD telnet interface on port 4444,
xabean@raspberrypi:~ $ telnet localhost 4444 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger > mww 0x00803000 74 > mdw 0x00803010 1 0x00803010: 001c7015 > bk7321t.cpu arm reg System and User mode registers r0: 00000001 r1: 00000069 r2: 00090080 r3: 00100000 r4: 00408b5e r5: 00000001 r6: 00405d80 r7: 00000010 r8: 08080808 r9: 09090909 r10: 10101010 r11: 11111111 r12: 0000000a sp_usr: 00420870 lr_usr: 00016dfd pc: 00016dc2 cpsr: 6000003f FIQ mode shadow registers r8_fiq: 00000000 r9_fiq: 00000000 r10_fiq: 00000000 r11_fiq: 00000000 r12_fiq: 00000000 sp_fiq: 00400fe0 lr_fiq: b51edf9b spsr_fiq: 00000010 Supervisor mode shadow registers sp_svc: 004027a0 lr_svc: 00016dc6 spsr_svc: 6000003f Abort mode shadow registers sp_abt: 004007e0 lr_abt: df9ff7e5 spsr_abt: 00000010 IRQ mode shadow registers sp_irq: 00401fd0 lr_irq: 00059ae8 spsr_irq: 6000001f Undefined instruction mode shadow registers sp_und: 004007e0 lr_und: bb0de3bc spsr_und: 00000010
TL;DR: BK7231T’s 120 MHz ARM9E core drives this open-source BLE demo [Beken Datasheet]—“Comprehensive and well written” [Elektroda, p.kaczmarek2, post #20653668] The thread bundles a 50-page tutorial, ready-to-use JTAG config, and an updated BK7231N register map. Why it matters: These resources let you flash, debug and reverse-engineer low-cost Wi-Fi/BLE modules without vendor SDKs.
• 32-bit ARM9E @ 120 MHz, ~2 MB embedded flash [Beken Datasheet]. • WB2L footprint: 26 × 16 mm, on-board PCB antenna “WB2L Data Sheet”. • SPI pads = pins 20-23 + RESET on module back [Elektroda, jitsirakowsk, post #20654654] • OpenOCD TAPID 0x15968001; adapter speed 100 kHz [Elektroda, p.kaczmarek2, post #20654215] • Archive contains 50-page guide with exercises [Elektroda, jitsirakowsk, post #20742145]
openocd -f bk7321t.cfg, then connect GDB at :3333. Each step takes under one minute [Elektroda, p.kaczmarek2, post #20654215]