Out of the box STM Nucleo board fails when running the most basic program: Blinky

Fire up Mbed Studio on an M1 Mac Mini, plug in ‘out of the box’ Nucleo-L433RC-P, attempt to run Blinky.
When ‘running’ the code it exits promptly (no more than a second for two) with a fault.
When ‘debugging’, same result and it never gets as far as activating any debug window or functions.
Seems to be a fault in gdbserver as in so many of the threads I see here.
Doesn’t inspire confidence in developing my own code on this platform if the basic example doesn’t work.
Debug output as follows:

File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py”, line 473, in halt
self.write_memory(CortexM.DHCSR, CortexM.DBGKEY | CortexM.C_DEBUGEN | CortexM.C_HALT)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py”, line 430, in write_memory
self.ap.write_memory(addr, value, transfer_size)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink_probe.py”, line 241, in write_memory
self._link.write_mem32(addr, conversion.u32le_list_to_byte_list([data]), self._apsel)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py”, line 389, in write_mem32
self._write_mem(addr, data, Commands.JTAG_WRITEMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py”, line 377, in _write_mem
raise exc
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (write) @ 0xe000edf0-0xe000edf7
“0001324:ERROR:gdbserver:Unexpected exception: Memory transfer fault (write) @ 0xe000edf0-0xe000edf7”
0001324:ERROR:gdbserver:Unexpected exception: Memory transfer fault (write) @ 0xe000edf0-0xe000edf7
Traceback (most recent call last):
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/gdbserver/gdbserver.py”, line 336, in run
self.target.halt()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py”, line 473, in halt
self.write_memory(CortexM.DHCSR, CortexM.DBGKEY | CortexM.C_DEBUGEN | CortexM.C_HALT)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py”, line 430, in write_memory
self.ap.write_memory(addr, value, transfer_size)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink_probe.py”, line 241, in write_memory
self._link.write_mem32(addr, conversion.u32le_list_to_byte_list([data]), self._apsel)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py”, line 389, in write_mem32
self._write_mem(addr, data, Commands.JTAG_WRITEMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py”, line 377, in _write_mem
raise exc
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (write) @ 0xe000edf0-0xe000edf7
Exception in thread gdb-packet-thread-port50001:
Traceback (most recent call last):
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/threading.py”, line 926, in _bootstrap_inner
self.run()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/gdbserver/packet_io.py”, line 109, in run
data = self._abstract_socket.read()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/utility/sockets.py”, line 55, in read
return self.conn.recv(packet_size)
AttributeError: ‘NoneType’ object has no attribute ‘recv’
"0001324:ERROR:gdbserver:Unexpected exception: Memory transfer fa

Hi
Be sure to get the latest STLink FW:

Regards,

Thanks for the link, I’m giving it a try.
All other web info suggests that it can only be done on Windows so this is a plus.
Sadly there’s all sorts of fun and games making anything Java run on the Mac, especially the M1.
Any hints on making this painless?
Still working on getting a functioning Java system set up!

Well I’m snookered for now.
Double-click the .jar and nothing happens.
Enter suggested command on CLI in Terminal and the best I’ve managed so far is:
“Architecture not supported (aarch64), please install JRE x86 64bit”.

I’ve installed at least three versions of Java and none of them do any better than that.

I could wrestle with this for hours but maybe the quickest route would be to update the drivers on a Windows machine then revert to the Mac to see whether it works any better.
Shame it can’t be simpler for non-Windows users.

So, I’ve updated the STLink firmware on a Windows machine, apparently successfully.
Switch back to the Mac and there are still issues.
It does get to the debug panel at least but Blinky still doesn’t run successfully.

When simply ‘run’ this happens:
������������������������������������������
++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R 0: 00000000
R 1: 2000FC00
R 2: 2000FC00
R 3: 0000001C
R 4: 20001524
R 5: 00000000
R 6: 00000000
R 7: 00000000
R 8: 00000000
R 9: 00000000
R 10: 00000000
R 11: 00000000
R 12: 08008951
SP : 20001518
LR : 080067B7
PC : 08005C50
xPSR : 61000000
PSP : 200014B0
MSP : 2000FFD0
CPUID: 410FC241
HFSR : 80000000
MMFSR: 00000000
BFSR : 00000000
UFSR : 00000000
DFSR : 0000000A
AFSR : 00000000
Mode : Thread
Priv : Privileged
Stack: PSP

– MbedOS Fault Handler –

++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8005C50
Error Value: 0x20001774
Current Thread: main Id: 0x20001B18 Entry: 0x800679D StackSize: 0x1000 StackMem: 0x20000548 SP: 0x20001518
For more info, visit: mbedos-error
– MbedOS Error Info –

When run under the debugger this happens:
raise self._ERROR_CLASSESstatus
pyocd.core.exceptions.TransferTimeoutError: STLink error (20): DP wait
Exception in thread gdb-packet-thread-port50002:
Traceback (most recent call last):
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/threading.py”, line 926, in _bootstrap_inner
self.run()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/gdbserver/packet_io.py”, line 109, in run
data = self._abstract_socket.read()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/utility/sockets.py”, line 55, in read
return self.conn.recv(packet_size)
AttributeError: ‘NoneType’ object has no attribute ‘recv’
“0001412:ERROR:gdbserver:Unexpected exception: STLink error (20): DP wait”
0001412:ERROR:gdbserver:Unexpected exception: STLink error (20): DP wait
Traceback (most recent call last):
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/gdbserver/gdbserver.py”, line 336, in run
self.target.halt()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py”, line 473, in halt
self.write_memory(CortexM.DHCSR, CortexM.DBGKEY | CortexM.C_DEBUGEN | CortexM.C_HALT)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py”, line 430, in write_memory
self.ap.write_memory(addr, value, transfer_size)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink_probe.py”, line 241, in write_memory
self._link.write_mem32(addr, conversion.u32le_list_to_byte_list([data]), self._apsel)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py”, line 389, in write_mem32
self._write_mem(addr, data, Commands.JTAG_WRITEMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py”, line 379, in _write_mem
raise self._ERROR_CLASSESstatus
pyocd.core.exceptions.TransferTimeoutError: STLink error (20): DP wait
Exception in thread gdb-packet-thread-port50002:
Traceback (most recent call last):
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/threading.py”, line 926, in _bootstrap_inner
self.run()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/gdbserver/packet_io.py”, line 109, in run
data = self._abstract_socket.read()
File “/Library/Application Support/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/utility/sockets.py”, line 55, in read
return self.conn.recv(packet_size)
AttributeError: ‘NoneType’ object has no attribute ‘recv’
“0001412:ERROR:gdbserver:Unexpected exception: STLink error (20): DP wait”

Still doesn’t seem to function properly on the Mac, any ideas where to go from here?

Curious, finally got it replicated on a Windows machine with similar results.
Blinky doesn’t seem to work on the Windows system either…
Debug output from that test as follows:

vals = self._context.read_core_registers_raw(self._full_reg_num_list)

File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\rtos\rtx5.py”, line 196, in read_core_registers_raw
reg_vals.append(self._parent.read_core_register_raw(reg))
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\context.py”, line 111, in read_core_register_raw
vals = self.read_core_registers_raw([reg])
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\cache.py”, line 48, in read_core_registers_raw
return self._regcache.read_core_registers_raw(reg_list)
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\cache\register.py”, line 96, in read_core_registers_raw
if self._check_cache():
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\cache\register.py”, line 77, in _check_cache
if self._core.is_running():
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py”, line 862, in is_running
return self.get_state() == Target.State.RUNNING
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py”, line 831, in get_state
dhcsr = self.read_memory(CortexM.DHCSR)
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py”, line 436, in read_memory
result = self.ap.read_memory(addr, transfer_size, now)
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py”, line 255, in read_memory
result = conversion.byte_list_to_u32le_list(self._link.read_mem32(addr, 4, self._apsel))[0]
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py”, line 385, in read_mem32
return self._read_mem(addr, size, Commands.JTAG_READMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py”, line 343, in _read_mem
raise exc
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (read) @ 0xe000edf0-0xe000edf7
“0022258:ERROR:gdbserver:Unhandled exception in handle_message: Memory transfer fault (read) @ 0xe000ed30-0xe000ed37”
Remote failure reply: E01

If it’s of any use to people following the path I’ve taken, the ST Link updater seems to be included in the STM32Cube IDE that will run on the Mac (after a bit of messing with security issues as documented by ST).
I can therefore verify that the ST Link firmware is up-to-date and that teh debugger in MBED Studio still fails.
I’d like to use MBED Studio but I may have to abandon it in favour of STM Cube unless anyone on the ARM MBED team can tell me how to make the debugger work with my NUCELO0L433RC-P?

Hello,

you can try https://studio.keil.arm.com/
Login is same as for your Mbed account.

Also info from this can help - Add NUCLEO-L433RC-P board support · Issue #1093 · pyocd/pyOCD · GitHub

BR, Jan

Thanks JohnnyK, I’ll give it a try.