Bad luck. Looks like a sudden death of the internal flash.

Please don't blame the mass_erase command in OpenOCD:
the command just sets one bit (bit 0 in MDM-AP control register) to instruct
the internal flash controller to erase the device. And it was tested many times
on many devices including KV58.

Just to be sure I re-tested mass_erase and connecting to a blank device
on my custom board with KV58:

~/a/kv58blink$ openocd -f interface/cmsis-dap.cfg -f target/kx.cfg -c 'reset_config srst_only'
Open On-Chip Debugger 0.10.0+dev-00206-gc7a5991 (2017-11-29-17:10)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use '
transport select <transport>'.
Info : add flash_bank kinetis kx.pflash
adapter speed: 1000 kHz
none separate
cortex_m reset_config sysresetreq
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x5ba02477
Info : MDM: Chip is unsecured. Continuing.
Info : kx.cpu: hardware has 8 breakpoints, 4 watchpoints

> reset init
MDM: Chip is unsecured. Continuing.
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x100020d0 msp: 0x20020000
Kinetis MKV58F1M0xxx24 detected: 1 flash blocks
1 PFlash banks: 1024k total
Disabling Kinetis watchdog (initial WDOG_STCTRLH = 0x01d3)
WDOG_STCTRLH = 0x01d2
> kinetis mdm mass_erase
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
> reset
MDM: Chip is unsecured. Continuing.
Polling target kx.cpu failed, trying to reexamine
SWD DPIDR 0x5ba02477
**** Your Kinetis MCU is probably locked-up in RESET/WDOG loop. ****
**** Common reason is a blank flash (at least a reset vector). ****
**** Issue 'kinetis mdm halt' command or if SRST is connected ****
**** and configured, use 'reset halt' ****
**** If MCU cannot be halted, it is likely secured and running ****
**** in RESET/WDOG loop. Issue 'kinetis mdm mass_erase' ****
SWD DPIDR 0x5ba02477
Failed to read memory at 0xe000ef40
SWD DPIDR 0x5ba02477
Failed to read memory at 0xe000ef44
SWD DPIDR 0x5ba02477
Failed to write memory at 0xe000edfc
Examination failed, GDB will be halted. Polling again in 100ms
> reset halt
**** Your Kinetis MCU is probably locked-up in RESET/WDOG loop. ****
**** Common reason is a blank flash (at least a reset vector). ****
**** Issue 'kinetis mdm halt' command or if SRST is connected ****
**** and configured, use 'reset halt' ****
**** If MCU cannot be halted, it is likely secured and running ****
**** in RESET/WDOG loop. Issue 'kinetis mdm mass_erase' ****
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc

Following without srst_only:

~/a/kv58blink$ openocd -f interface/cmsis-dap.cfg -f target/kx.cfg
...
> reset
MDM: Chip is unsecured. Continuing.
SWD DPIDR 0x5ba02477
SWD DPIDR 0x5ba02477
Polling target kx.cpu failed, trying to reexamine
SWD DPIDR 0x5ba02477
**** Your Kinetis MCU is probably locked-up in RESET/WDOG loop. ****
**** Common reason is a blank flash (at least a reset vector). ****
**** Issue 'kinetis mdm halt' command or if SRST is connected ****
**** and configured, use 'reset halt' ****
**** If MCU cannot be halted, it is likely secured and running ****
**** in RESET/WDOG loop. Issue 'kinetis mdm mass_erase' ****
SWD DPIDR 0x5ba02477
Failed to read memory at 0xe000ed00
Examination failed, GDB will be halted. Polling again in 100ms
> reset halt
**** Your Kinetis MCU is probably locked-up in RESET/WDOG loop. ****
**** Common reason is a blank flash (at least a reset vector). ****
**** Issue 'kinetis mdm halt' command or if SRST is connected ****
**** and configured, use 'reset halt' ****
**** If MCU cannot be halted, it is likely secured and running ****
**** in RESET/WDOG loop. Issue 'kinetis mdm mass_erase' ****
AP write error, reset will not halt
SWD DPIDR 0x5ba02477
SWD DPIDR 0x5ba02477
SWD DPIDR 0x5ba02477
TARGET: kx.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'


> kinetis mdm halt
SWD DPIDR 0x5ba02477
Halt timed out, wake up GDB.
SWD DPIDR 0x5ba02477
Polling target kx.cpu failed, trying to reexamine
MDM: Chip is unsecured. Continuing.
kx.cpu: hardware has 8 breakpoints, 4 watchpoints
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
> reset init
MDM: Chip is unsecured. Continuing.
SWD DPIDR 0x5ba02477
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Kinetis MKV58F1M0xxx24 detected: 1 flash blocks
1 PFlash banks: 1024k total
Disabling Kinetis watchdog (initial WDOG_STCTRLH = 0x01d3)
WDOG_STCTRLH = 0x01d2
> program debug/blink.elf
MDM: Chip is unsecured. Continuing.
SWD DPIDR 0x5ba02477
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Disabling Kinetis watchdog (initial WDOG_STCTRLH = 0x01d3)
WDOG_STCTRLH = 0x01d2
** Programming Started **
auto erase enabled
Flash Configuration Field written.
Reset or power off the device to make settings effective.
Flash write error at 10000410
Flash write immediately after the end of Flash Config Field shows error
because the flash memory is 256 bits wide (data were written correctly).
Either change the linker script to add a gap of 16 bytes after FCF
or set 'kinetis fcf_source write'
wrote 16384 bytes from file debug/blink.elf in 1.078693s (14.833 KiB/s)
** Programming Finished **


On 04.12.2017 18:34, [email protected] wrote:
Unfortunately I tried most of the commands already, the erase worked as
the led no-longer responds  to moving the board.

--------------------------------------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
kinetis mdm halt
MDM: halt timed out

kinetis mdm halt
MDM: halt timed out

kinetis mdm mass_erase
SWD DPIDR 0x5ba02477
SWD DPIDR 0x5ba02477
SWD DPIDR 0x5ba02477
AP write error, reset will not halt
SWD DPIDR 0x5ba02477
Polling target kx.cpu failed, trying to reexamine
SWD DPIDR 0x5ba02477
**** Your Kinetis MCU is probably locked-up in RESET/WDOG loop. ****
**** Common reason is a blank flash (at least a reset vector).  ****
**** Issue 'kinetis mdm halt' command or if SRST is connected   ****
**** and configured, use 'reset halt'                           ****
**** If MCU cannot be halted, it is likely secured and running  ****
**** in RESET/WDOG loop. Issue 'kinetis mdm mass_erase'         ****
SWD DPIDR 0x5ba02477
Failed to read memory at 0xe000ed00
Examination failed, GDB will be halted. Polling again in 100ms
--------------------------------------------------------------------------------



Tomas Vanek <[email protected]> wrote:

        Try

        kinetis mdm halt

        for the case if reset is not properly connected on the board.

        And if it fails, proceed as suggested in the message:

        **** If MCU cannot be halted, it is likely secured and running  ****
        **** in RESET/WDOG loop. Issue 'kinetis mdm mass_erase'         ****

        There is no point in sending more detailed logs.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to