Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programming a Microcontroller - JTAG and SWD

Status
Not open for further replies.

FreshmanNewbie

Advanced Member level 1
Advanced Member level 1
Joined
May 10, 2020
Messages
435
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
4,318
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?
 
Last edited:

1) maybe you need to change your file extension from S28 to srec...
2) but it sounds like you’ve got a hardware issue. The fact you can’t connect to the target has nothing to do with the file type. You should address this problem first.
3) the “cant download” message might also be due hardware/signal integrity problems.
4) I don’t think the state of the reset pin matters.
 

1) maybe you need to change your file extension from S28 to srec...
2) but it sounds like you’ve got a hardware issue. The fact you can’t connect to the target has nothing to do with the file type. You should address this problem first.
3) the “cant download” message might also be due hardware/signal integrity problems.
4) I don’t think the state of the reset pin matters.
Thank you for your simple and compact answer. But I have some doubts from your answer.

1. From the 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?
2. Signal integrity problems in the sense, like incompatible logic level threshold values between the debugger and the microcontroller? Do I need to change the debugger?

3. Should the RESET pin be high or low during the programming of the microcontroller? Will the debugger pull the RESET pin low while programming?
 

2) Signal integrity problems can be reflections due to improper termination.
3). I don’t think the reset pin matters. Read the data sheet or app notes for your device.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top