blackmagic-debug / blackmagic

In application debugger for ARM Cortex microcontrollers.
GNU General Public License v3.0
3.29k stars 774 forks source link

Cannot detect EFR32 #935

Closed ronangaillard closed 3 years ago

ronangaillard commented 3 years ago

I'm trying to flash a TYZS3 module from tuya (based on the EFR32MG13P732F512GM48), with a blackmagic probe (an official ST-LINKV2 ISOL flashed with the BM firmware).

I double checked my wiring (SWDIO, SWCLK, NRST, GND + independent 3V source).

I then connected to the BM probe using gdb but I keep having the following message :

(gdb) mon s
Target voltage: 3.40V
SW-DP scan failed!
Failed
UweBonnes commented 3 years ago

Can you see the signals with a scope at the EFR end? Does the ST-LINKV2 ISO/BMP Firmware work with other devices? Maybe the ISO module needs some direction switching handled, that the standard firmware does not handle yet. Is there some (inofficial) schematics for the ISO module so we can decipher what more is needed?

ronangaillard commented 3 years ago

Indeed I was not able to detect the Blue Pill with the ST-LINKV2 ISO/BMP.

I will try asap with another stm32 board that used to be well seen by the ST-LINKV2 ISO with original/official fw.

I can make scope screenshots also. I guess I should look at SWDIO and SWCLK lines ?

Thanks for your quick answer.

UweBonnes commented 3 years ago

There is some pin needed to switch direction for SWDIO. This pin is not documented and I do not know about anybody reverse engineering it. As long, as the F103 Pin serving this direction switching is unknown, we can not implement and so the STLINKV2/Iso is not usable with BMP/firmware. You can use it however with BMP/hosted/Stlink. Did you use Stlink-Tool to flash BMP to the Iso? Then reverting should be easy. Or did you open the Iso and relash via SWDIO? Then you could perhaps reverse enginner yourself.

ronangaillard commented 3 years ago

Ok I'll try with BMP/hosted/Stlink. The only problem is that BMP hosted does not work with MAC OS :(

bmp ❯ ./src/blackmagic                                                   master
Please implement find_debuggers for MACOS!
UweBonnes commented 3 years ago

make PROBE_HOST=hosted BMP_HOSTED_ONLY=0 clean; make PROBE_HOST=hosted BMP_HOSTED_ONLY=0 -j

And if you find time to "Please implement find_debuggers for MACOS!", that would be nice...

ronangaillard commented 3 years ago

I still have an issue after running

bmp ❯ make PROBE_HOST=hosted BMP_HOSTED_ONLY=0 clean; make PROBE_HOST=hosted BMP_HOSTED_ONLY=0 -j

bmp ❯ ./src/blackmagic                                                   master
Please implement find_debuggers for MACOS!

(Not sure if it was supposed to fix this)

Not sure to have time yet to implement find_debuggers() unfortunately

UweBonnes commented 3 years ago

Sorry, should heave been HOSTED_BMP_ONLY!

UweBonnes commented 3 years ago

BMP_HOSTED_ONLY=0

ronangaillard commented 3 years ago

It builds and runs, I'll try right now to flash EFR32.

Thanks again :)

ronangaillard commented 3 years ago

This seems promising !

BMP hosted v1.7.1-277-g7ccbdd9
 for ST-Link V2/3, CMSIS_DAP, JLINK and LIBFTDI/MPSSE
Using 0483:3748 U?cxqQS8$"g STMicroelectronics
 STM32 STLink
STLink firmware version: V2J38S7
Leaving MASS Mode
Running in Test Mode
Target voltage: 3.34V Volt
Divisor for 4.0000 MHz is 0
Speed set to  3.6000 MHz for SWD
Leaving MASS Mode
Read Core ID: 0x2ba01477
DPIDR 0x2ba01477 (v1 rev2)
RESET_SEQ failed
AP   0: IDR=24770011 CFG=00000000 BASE=e00ff003 CSW=23000040 (AHB-AP var1 rev2
Halt via DHCSR: success 00030003 after 1ms
ROM: Table BASE=0xe00ff000 SYSMEM=0x00000001, designer 673 Partno a01
0 0xe000e000: Generic IP component - Cortex-M4 SCS (System Control Space) (PIDR = 0x04000bb00c  DEVTYPE = 0x00 ARCHID = 0x0000)-> cortexm_probe
CPUID 0x410fc241 (M4 var 0 rev 1)
1 0xe0001000: Generic IP component - Cortex-M3 DWT (Data Watchpoint and Trace) (PIDR = 0x04003bb002  DEVTYPE = 0x00 ARCHID = 0x0000)
2 0xe0002000: Generic IP component - Cortex-M3 FBP (Flash Patch and Breakpoint) (PIDR = 0x04002bb003  DEVTYPE = 0x00 ARCHID = 0x0000)
3 0xe0000000: Generic IP component - Cortex-M3 ITM (Instrumentation Trace Module) (PIDR = 0x04003bb001  DEVTYPE = 0x00 ARCHID = 0x0000)
4 0xe0040000: Debug component - Cortex-M3 TPIU (Trace Port Interface Unit) (PIDR = 0x04003bb923  DEVTYPE = 0x11 ARCHID = 0x0000)
5 0xe0041000: Debug component - Cortex-M4 ETM (Embedded Trace) (PIDR = 0x04000bb925  DEVTYPE = 0x13 ARCHID = 0x0000)
ROM: Table END
***  1      EFR32MG13P 220 F512 Mighty Gecko M4
RAM   Start: 0x20000000 length = 0x10000
Flash Start: 0x00000000 length = 0x80000 blocksize 0x800
Flash Start: 0x0fe00000 length = 0x800 blocksize 0x800
Flash Start: 0x0fe10000 length = 0x4000 blocksize 0x800
lucasromeiro commented 2 years ago

@ronangaillard Hi man. How are you? I bought an EFR32BG22 and I need to program it. Could you tell me how you solved your problem? A Segger recorder is very expensive. I didn't find another alternative. Can u help me?

ronangaillard commented 2 years ago

Hi Lucas,

Nothing more than what is written in this issue thread.

Where do you struggle ?