Hello Everyone,
I was experimenting with clock initialization on the S32K328 MCU during early boot-up (before entering main).
Using S32 Design Studio, I generated the clock configuration code and invoked the Clock_Ip_Init() API directly in the startup sequence.
After flashing this ELF, the MCU appears to be stuck — it no longer enters the RUN state, and I’m unable to re-flash the device. I am getting below error when I try to flash some different working elf
Connection from "127.0.0.1" via 127.0.0.1. Connection from port "61375" to 6224
Connection from "127.0.0.1" via 127.0.0.1. Connection from port "61379" to 7224
Telnet server running on 127.0.0.1:51794
Command Line Parameters :
-device=NXP_S32K3xx_S32K358
-startserver
-singlesession
-serverport=7224
-gdbmiport=6224
-interface=USBMULTILINK
-speed=5000
-port=USB1
-streamingport=10224
-configfile=C:/NXP/workspace/MBCC_B0/.metadata/.plugins/com.pemicro.debug.gdbjtag.pne/config.ini
PEmicro Interface detected - Flash Version 11.52
CMD>RE
Initializing.
INFO: DAP IDCODE = 0x6BA02477
INFO: DAP successfully powered up. DP CTRL/STAT = 0xF0000000
Target has been RESET and is active.
CMD>CM C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne.expansion_6.0.9.202509241532\supportFiles_ARM\NXP\S32K3xx\nxp_s32k358_1x32x2036k_hse_disabled.arp
Initializing.
INFO: DAP IDCODE = 0x6BA02477
INFO: DAP successfully powered up. DP CTRL/STAT = 0xF0000000
Initialized.
;version 1.02, 07/25/2025, Copyright 2025 P&E Microcomputer Systems, www.pemicro.com [S32K358_hse_disabled]
;device nxp, s32k358, 1x32x2036k,desc=hse_disabled
;begin_cs device=$00400000, length=$007F4000, ram=$20400000
Loading programming algorithm ...
Error loading .ARP file : C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne.expansion_6.0.9.202509241532\supportFiles_ARM\NXP\S32K3xx\nxp_s32k358_1x32x2036k_hse_disabled.arp at address 20400000
Error loading programming algorithm - load aborted.
Error occured during Flash programming.
INFO: DAP IDCODE = 0x6BA02477
INFO: DAP successfully powered up. DP CTRL/STAT = 0xF0000000
Starting reset script (C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne.expansion_6.0.9.202509241532\supportFiles_ARM\NXP\S32K3xx\S32K358.mac) ...
REM Enable clocks for selected cores in MC_ME module
Delaying for 200mS ...
Done.
REM Initialize RAM and DMA:
REM Initialize DMA TCD:
REM Copy valid executable code to RAM for each core to be used.
REM Enable required cores in MC_ME:
Delaying for 20mS ...
Done.
Delaying for 20mS ...
Done.
Reset script (C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne.expansion_6.0.9.202509241532\supportFiles_ARM\NXP\S32K3xx\S32K358.mac) completed.
PEmicro GDB Launch Failure : Error during flash programming. Terminating debug session.
PE-ERROR: Error downloading to the device. Terminating debug session.
Disconnected from "127.0.0.1" via 127.0.0.1. Disconnection by port "61375" from 6224
PE-ERROR: Error : Attempted to send response but connection already closed.
Disconnected from "127.0.0.1" via 127.0.0.1. Disconnection by port "61379" from 7224
INFO: DAP IDCODE = 0x6BA02477
Target Disconnected.
I suspect that the clock may not have been enabled or configured correctly during initialization. However, there could be other underlying issues as well.
Could you please guide me in the right direction to debug this issue and recover the board?
Best Regards,
Sathish.