I have this Microcontroller - S32K118 64 pins.

I want to load my software datafile into the microcontroller using the debugger mentioned below.

I am using this J-LINK Segger BASE debugger model to program my microcontroller.

I have a Windows OS and the software datafile which I'd like to download to the microcontroller has an extension - ".s28"

I have the JTAG Interface Lines on my PCB which is connected to the microcontroller. And I have connected the JTAG Lines from the debugger to the PCB. There is no mismatch like TDI to TDO (like in UART protocol). I have connected like TDI line on debugger to TDI Line on PCB. Like that for all JTAG Connections.

(P.S. Actually, I have 2 Microcontrollers on the PCB. But they are not daisy chained. Each Microcontroller has separate set of JTAG Interface lines)

Please bear with my below questions as I am not that well versed in Software.

My questions :

  1. The Debugger also has the option to program the microcontroller using the SWD Interface. I read the manual which says that this debugger can also use the SWD interface using just the TMS and TCK lines.

But how is the JTAG or the SWD interface to program the microcontroller selected? Will this selection of the programming interface will be mentioned on the software code or should the hardware person select it? If the hardware person has to select it, then how should he do it?

Basic question - How is the programming interface determined between JTAG and SWD? Is it mentioned in the software code or how is it?

  1. In the J-Link Segger Debugger Manual, on page 279, chapter 13.3.3 Menu Structure, it is given as

enter image description here

it is mentioned as the software data file should be .hex, .mot,.srec or .bin format.

But my software datafile extension is .s28

So, will the debugger accept this file? Upon a simple google search, I found that the .s28 and .srec files are Motorola S-record is a file format, created by Motorola, that conveys binary information as hex values in ASCII text form. This file format may also be known as SRECORD, SREC, S19, S28, S37. It mentions that .srec and .s28 are the same?

So, I can load this .s28 file onto the Microcontroller with this debugger?

I received 2 types of errors as shown below

Error 1 :

enter image description here

In the above image, you can see that I have selected my correct microcontroller part number and selected the required software data file (don't know whether this extension .s28 will be supported by the microcontroller). But I got the error like, COULD NOT CONNECT TO TARGET.

Why is this error coming? I checked the hardware connection, it is perfect.

I tried to change the Interface from SWD to JTAG (as highlighted in the above image. But I didn't change the speed. Both were at 4000kHz). Still, same result I got. No change

Error 2 : After sometime, In the same window, I started getting the error like - "ERROR : Could not download the file"

I didn't do any change in my hardware setup or anything at all. But the error was different.

I researched on the debugger manual, I couldn't find any solution for these errors. I also also in the Segger forums and the NXP community forums. But still no results.

Can someone please help me with these errors and how to resolve them?

Question 3 :

Suppose the debugger programs the microcontroller. At the moment or the instant while the debugger is loading the software datafile on the microcontroller, what should be the voltage level on the RESET pin? Should the RESET be high or Should the RESET be low? And if it should be LOW, does the Debugger Pull-down the RESET?


Schematic : Microcontroller - S32K118 64 Pin.

The reset signal on the base of the transistor shown below is on Always high state. So, it will not be a problem. For the JTAG Reset connection, I have taken the RESET signal from the C0103 Capacitor top end.

enter image description here

  • 1
    \$\begingroup\$ Could you add the schematic? It can help someone to give you an answer. \$\endgroup\$ Commented Jul 18, 2020 at 7:44
  • \$\begingroup\$ Yes, added the schematic. \$\endgroup\$
    – user220456
    Commented Jul 18, 2020 at 9:44
  • \$\begingroup\$ An s28 file is an srec file. If the Segger software can load it then the file is fine - the micro doesn't know or care if it was an srec, a bin, a hex or something else. \$\endgroup\$
    – brhans
    Commented Jul 18, 2020 at 15:47
  • \$\begingroup\$ Have you connected 'RESET' or 'RESET_MC1' to the J-Link (along with all the other 'JTAG_xxx' lines? \$\endgroup\$
    – brhans
    Commented Jul 18, 2020 at 15:48
  • 2
    \$\begingroup\$ Incidentally, multi-point questions are not allowed \$\endgroup\$ Commented Jul 23, 2020 at 5:44

2 Answers 2


I will try to answer the questions.

Question 1: Per Default the Controller will initialize the Debugging Port (after reset) into JTAG Mode. If you want to use SWD you will have to apply the command Sequence mentioned in the Reference Manual Ch. 56.3.1 on p. 1968. So the Selection is neither done in HW nor in the programming file. You (maybe) should be able to select the programming mode in your flashing tool.

Question 2: J-Flash supports the following Motorola S file formats: .mot, .srec, .s, .s19, .s28, .s37 Therefor you should be able to flash your firmware generated by your toolchain.

Question 3: Debugging is disabled when the Controller is in low power mode or "Security" is enabled (see Ch. 56.15 on p. 1978). So make sure both is not the case. For flashing you will have to keep RESET low for a certain time. More information can be found in the following Application mode: https://www.nxp.com/docs/en/application-note/AN12130.pdf But you do not need to do this manually. This will be done by the J-LINK/J-Flash application. But you will need to make sure that your J-Link has control over the Reset line (connect the Reset Pin to the appropriate Pin on the JTAG/SWD Connector).

The Pinout for the SWD/JTAG Connector should look like the following: enter image description here

Connection on the Controller should look like the following. I have highlighted the relevant Pins on the shematic for 32K118: enter image description here

In the example above only the SWD lines are connected to the 32K118. But you can of course also attach the other 2 lines for JTAG. The important thing which maybe are missing is the Reset line for the J-Link. Or is RESET_MC1 connected to the Debug Connector? Maybe you could post the shematic for the Debug Connector.

  • \$\begingroup\$ Thank you for the answer. I have a doubt. Regarding the Question 3, I am not clear. So, before the flashing actually happens, the microcontroller RESET line is in Active High State. When I connect it to the debegger, the debugger should only Pull the Active high reset to active low, right? The contents of the firmware will get transferred when the reset is in Low state or high state? Could you please tell me the level of reset during the content transfer from the debugger to Micro ? And should the debugger only pull the reset line Low for flashing? \$\endgroup\$
    – user220456
    Commented Jul 29, 2020 at 5:06
  • \$\begingroup\$ You do not need to interact with the reset Pin on your own. This should all be done by the J-FLash application/J-Link. What you need to do is to connect the Reset line to the appropriate Pin on the JTAG/SWD Connector on your PCB. See my updated answer. \$\endgroup\$
    – A.K.
    Commented Jul 29, 2020 at 6:29

Regarding the .s28 format specifically:

Your binaries here are the good old Motorola S-record format, which is a file format expressing binaries using text representation - you can open it up in notepad.exe and read it. (Another popular and very similar one is Intel Hex.)

S-records consist of various entries. A line starting with S1, S2 or S3 means that it contains an address of 16, 24 or 32 bits respectively. A line starting with S7, S8 or S9 means that it contains the program's start address of either 16, 24 or 32 bits.

Apparently your binary is generated with 24 bit addresses, so your file will contain S2 and S8 lines. Hence the format .s28 - which can be regarded as a subset of .srec. Any tool claiming to support .srec will also support .s19, .s28 and .s37 since it is really all the same file format.

.mot probably refers to S-records too, though I can't say I've seen it used much.

And yes, all of these are supported just fine by Segger.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.