Debugging nrf52.. unexpected error

Hi there,

I suddenly got this error when I try to debug my nrf52(832) application using a black magic probe. This worked no problems when suddenly this error appeared in the debug console of VS Code. It does’nt matter if i skip pre-debug or do a clean build. Pio debug runs fine in the shell. I’m a little out of ideas here…

undefinedError: Traceback (most recent call last):
  File "c:\users\tobia\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\tobia\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\tobia\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\tobia\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\tobia\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\tobia\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\tobia\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\tobia\.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\tobia\.platformio\penv\lib\site-packages\platformio\commands\debug\command.py", line 117, in cli
    debug_options = platform.configure_debug_options(debug_options, ide_data)
  File "C:\Users\tobia\.platformio\platforms\nordicnrf52\platform.py", line 169, in configure_debug_options
    server_executable = debug_options["server"]["executable"].lower()
TypeError: 'NoneType' object is not subscriptable

============================================================

An unexpected error occurred. Further steps: 

[…]

My platformio.ini looks like this:

[base]
platform = nordicnrf52
board = generic_nrf52832
framework = arduino
extra_scripts = pre:version.py
lib_deps = 
	mikalhart/TinyGPSPlus@^1.0.2
	etherkit/Etherkit Si5351@^2.1.4
	etherkit/Etherkit JTEncode@^1.2.1
lib_ldf_mode = chain+
debug_init_cmds = 
	define pio_reset_halt_target
	monitor hard_srst
	monitor swdp_scan
	attach 1
	$INIT_BREAK
	start
	end
	
	define pio_reset_run_target
	start
	end
	
	target extended-remote $DEBUG_PORT
	monitor tpwr enable
	monitor hard_srst
	monitor swdp_scan
	attach 1
	set mem inaccessible-by-default off
	interrupt
	$INIT_BREAK
	
	$LOAD_CMDS

[balloon1]
extends = base
build_flags = -Os 
	-Wl,--gc-sections 
	-Wl,-Map,output.map 
	-DNRF52832_XXAA 
	-DARDUINO_GENERIC 
	-DRESET_PIN=21 
	-UUSE_LFXO -DUSE_LFRC 
	-DCONFIG_NFCT_PINS_AS_GPIOS 
	-DHW_BALLOON1R1
upload_protocol = blackmagic
debug_tool = blackmagic
monitor_speed = 115200

[env:mockup]
extends = base
build_flags = -Os 
	-Wl,--gc-sections 
	-Wl,-Map,output.map 
	-DNRF52832_XXAA 
	-DARDUINO_GENERIC 
	-DRESET_PIN=21 
	-UUSE_LFXO 
	-DUSE_LFRC 
	-DCONFIG_NFCT_PINS_AS_GPIOS 
	-DHW_MOCKUP
	-DRADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 
	-DRADIOLIB_HARDWARE_SERIAL_PORT="Serial" 
	-DRADIOLIB_TONE_UNSUPPORTED 
	-DRADIOLIB_DEBUG
upload_protocol = blackmagic
upload_port = \\.\COM12
debug_tool = blackmagic
debug_port = \\.\COM12
monitor_speed = 115200
monitor_port = \\.\COM13

[env:balloon1win]
extends = balloon1
upload_port = \\.\COM12
debug_port = \\.\COM12
monitor_port = \\.\COM13

[env:balloon1linux]
extends = balloon1
upload_port = /dev/ttyACM0
debug_port = /dev/ttyACM0
monitor_port = /dev/ttyACM1

The error occurs in the “mockup” and “balloon1win” environments.
Any ideas?
BTW version.py just counts builds and advances version numbers and runs in evrery build, so no problem there.

Thanks! :slight_smile: (and sorry couldn’t figure out code formatting here…)

Bug regarding BMP is known in Debugger startup crash with blackmagic probe as debug tool · Issue #3864 · platformio/platformio-core · GitHub for the STM32 platform and was fixed in this commit, but nRF52 seems to be a different story. I’ll report there and then it should be handled accordingly.

You may try and downgrade the nrf52 platform version per listed release versions and docs to find a version that is working for now?

Actually it said

Many thanks for reporting, should be fixed in all affected platforms

Can you open a CLI and do

pio platform update nordicnrf52

and re-open VSCode and retry? Is it still occurring in the latest stable platform version?

EDIT2:

If that does not help, please retest with last upstream version by replacing the platform value in the platformio.ini with

platform = https://github.com/platformio/platform-nordicnrf52.git

If that still doesn’t fix it, it’s a bug.

Hi

thanks!
I didn’t find that error previously. I did an update fairly recently but I’ll run that as soon as the spareribs are done & report :wink:

1 Like

Hi,

the

fixed it. First I did the regular pio update/upgrade which told me everything was up to date, as did the dedicated platform update as you stated above. After both procedures the problem remained but using the git as platform fixed things. So the fix in the repo didn’t make it to the release then?

Thank you man! (Trying to debug some complicated code I ported…)

There has been no release since, it will be in the next one.

I think @valeros handles the releases.

… well at least it’s building now. Wrong environment but building… :wink:
Sure they’ll release soon.