Hi,
I disabled reset pin in FTFA_FOPT register (RESET_PIN_CFG = 0) a then I accidentally initialized PTA0 pin (SWD_CLK) as GPIO pin quite early in MCU initialization.
Is there anything I can do to connect/erase the MCU? MCU disables SWD_CLK approx. 1200 us after POR.
I use Segger J-Link.
Solved! Go to Solution.
I was able to perform mass erase using this commands:
ReadDp(IDCODE);
WriteDp(ABORT, 0x0000001E);
WriteDp(CTRL_STAT, 0x50000000);
ReadDp(CTRL_STAT);
WriteDp(SELECT, 0x01000000);
WriteAp(0x04, 0x00000015); // mass erase & system reset
ReadAp(0x00);
Hi Martin, I hope you're doing well!
Is it possible to enter bootloader mode by holding the reset button when connecting the device? If you can, could try re-flashing the OpenSDA bin file?
To enter bootloader mode, you can follow the instructions in section 2 of the OpenSDA user guide, which can be found here.
If it is not entering bootloader mode, could you try connecting to the device using your device using JTAG?
After doing that, could you try to connect to the device with Jlink commander and running the "unlock kinetis" command?
Please let me know if it works for you.
Best regards,
Sebastian
Hi Sebastian,
thank you for your reply, but I'm afraid, I can't enter bootloader as it is disabled in FTFA_FOPT (boot options set). Also, my MCU doesn't have JTAG.
I managed to implement basic SWD code in C and load it into another board. As reset of the target board is disabled, I reset it by turning target's power on and off. I have success in reading IDCODE (the target MCU returns 0x0BC11477).
Can you please instruct me how to implement halting MCU or perform mass erase using SWD (exact commands to be sent via SWD needed)? I'm trying reading/writing SW-DP CTRL/STAT and writing SW-DP SELECT register without any success. Is there also any special timing needed? This is what I implemented:
Read DP register 0x00 (IDCODE) - target returns 0x0BC11477
Read DP register 0x04 (CTRL_STAT) - target returns 0x000000C0
Write DP register 0x04 (CTRL_STAT) with value 0x50000000 - the request is acknowledged with 0x4 (FAULT)
Write DP register 0x08 (SELECT) with value 0x01000000 (select MDM-AP, bank 0) - the request is acknowledged with 0x4 (FAULT)
I was able to perform mass erase using this commands:
ReadDp(IDCODE);
WriteDp(ABORT, 0x0000001E);
WriteDp(CTRL_STAT, 0x50000000);
ReadDp(CTRL_STAT);
WriteDp(SELECT, 0x01000000);
WriteAp(0x04, 0x00000015); // mass erase & system reset
ReadAp(0x00);