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.

Running micro and debugger to find problem with code?

Status
Not open for further replies.
T

treez

Guest
Hello,
Our remote software engineer wants us to run some debug code on our controlled lighting system.
There is a problem with it and he says if we use the debugger it will help us diagnose where in the software its going wrong.
The micro is PIC18F26K20.
He says we should connect up to pin 14 (TX) and gnd at the micro.

We should then run wires from these pins to the USB port of a laptop.

He says we will also need a “serial data to file” program, and he says he uses “coolterm, so i guess we have to buy/download that?

Do you know what program we need to use to capture the debug data?...is it MPLAB IPE v3.26? ...he has written us the code that we need to load for the purpose....we loaded the hex file into the micro no problem, using pickit3.

However, what do we do next?

Do we need to set up MPLAB IPE in debug mode or something?
 

K-series doesn't support realtime debugging. It is microchip, dude. Welcome to middleages.
 

Tx pin in PIC is UART pin and most probably the programmer has provided UART debugging option that is the current state of code execution is printed on UART. You can use any Serial terminal Software to view the debugging data. You will need TTL2USB adapter to connect PIC UART to PC USB port.
 

Is it under Windows or Linux ?

The info given is sketchy but i understand that your SW engr has sent you a debugging code for downloading to PIC and when it is executed it will emit all info for further analysis.

You must have a serial data reader from PIC UART which can be carried out by the PC with an USB2Serial converter.

The data read (which is the debug data ) can be saved as file and sent to the SW Engr.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
He says we will also need a “serial data to file” program, and he says he uses “coolterm, so i guess we have to buy/download that?
Most serial communication interface programs ( actually all of them, AFAIK ) supports capturing received data to file, so you could selecct anyone. The Hiperterminal - which is no longer available on Windows package - is one which has this feature, but you would be succedded just for standard ASCII characters ( alphabetical, mumerals and symbols ), not for control characters. For Windows there is the Realterm, a nice tool.

Our remote software engineer wants us to run some debug code

In the programming field, we use the term 'debug' ( the verb ) also as a general denomination to designate the process of extracting information from the system, and there are a lot of approaches. The scheme that he's using is certainly by issuing characters from within certain parts of specific routines, and this works pretty fine if used correctly.

Do we need to set up MPLAB IPE in debug mode or something?

No, just program the hex file to the target and release the Reset pin on the IDE, it's all you need.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
How to use serial data software to receive data from PIC18F26K20?

Hello,
Please could i ask how to use Realterm serial data acquisition program?
We want to load the debug output of our microcontroller to a file but we are not sure how to do this.
We have a PIC18F26K20 on a PCB , and we have connected to GND and the TX pin (pin 14) of PIC18F26K20.
The software engineer has loaded data into the PIC which will give debug data from inside the micro.
We need the data to see where the micro is going wrong in its software.

We know that we need "19200 bits/second, and 8 bits, parity , none"...we can see where to set that but not where to get the data downloading from the PIC to our PC
 

Please could i ask how to use Realterm serial data acquisition program?
We want to load the debug output of our microcontroller to a file but we are not sure how to do this.

Just select the "Capture" tab, on which you can find a lot of functionalities.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
Thanks, it was working, that is we were receiving data into realterm , but now it is not working any more....realterm is not dumoing data into our capture file....hwo can we check if the data is actually arriving at realterm?


So, Do you know how to see if the data is coming in to realterm?.........we have connected our TTL from microcontroller to USB cable, then USB isolator, then cable to USB of computer, but we are no longer getting data in to the capture file from realterm, do you know if we can check if data is coming in to realterm?.....we do have TTL data coming off our microcontroller...but is our relaterm on our PC seeing this data? And why is realterm not putting the data into our capture file?
It was working before.
 

He says we should connect up to pin 14 (TX) and gnd at the micro.

Just to check: Didn't you have made any voltage level conversion before connecting both PC and microcontroller ? You migh to be aware that PC 'talks' to serial port with RS232 levels, whereas uC do that with TTL levels.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
thanks, we used an TTL to USB converter
The problem with realterm is you cant tell if its actually receiving data or not.....and youve no way of knowig which port the data is coming in on.
Do you know this?
 

You should be able to see it as the data is captured. Turning capture on just copies everything sent to the screen to a disk files as well.

If you can't see any data from the PIC there is a hardware problem with the interface or a configuration problem on the computer. As there is no path to send data TO the PIC and only one data connection, it implies there is no handshaking so make sure it is disabled in the terminal program configuration.

Brian.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
...and youve no way of knowig which port the data is coming in on.

At the Realterm Port tab, you have to double-click at the ListBox in order to get the tool updated with some new USB serial port which has been connected while the tool were already instantiated; At least on Windows you migh to know that each USB slot has its own COMx enumeration. Anyway, it is necessary to check with the system hardware manager, which port is actually being assigned to that USB/TTL converter. Once selected and opened, this port should appear at the right corner of the status bar. By the way, do you have the correct driver installed on your PC ? Some of those converters use the usb chinese drivers of the ch340 family whereas others use the well known FTDI PL2303 driver.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
thanks, what i mean is, sometimes it works and sometimes it doesnt.......recently we spent two hours trying to get the data to save into a file...then all we did was change to a file in a different folder and it was ok again.
We only once saw data being received getting printed on the realterm screen..... do you know how to always display it on the screen.?
 

I can provide you TeamViewer support for your problem if you send the Teamviewer ID and Pass. I will be able to connect to your PC and show you how to use RealTerm to capture data. I can't explain it here.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
sometimes it works and sometimes it doesnt.......recently we spent two hours trying to get the data to save into a file...then all we did was change to a file in a different folder and it was ok again.

Does this happens even if you have not specified anything on the "End after" tab (seconds/bytes) ?
I've been using this tool for a long time, and I've never noticed any locking issue like this
 

If COM port hangs then this problem occurs. The solution is to reboot the PC.
 

If I'm unsure if a serial device is sending data and if they have correct level, baud rate and framing, I usually connect an oscilloscope.
 

thanks, but how do you scope the end of a usb cable?
We can scope the ttl output of the micro, and that is always sending data......but that comes through a ttl to usb converter, and then onto the PC.....how do you scope a USB connector.?..you cant get the probe tip into the terminal metal as its inside the flat end
 

If the TTL2USB adapter has a type A USB connector then the soldered 4 pins of the connectors are visible. You connect GND clip to GND of PIC or TTL2USB adapter and probe the D+ and D- pins of the USB connector.
 

If TTL data is there your problem is almost certainly USB driver or configuration related.

If you really want to look at it as USB, which I strongly advise against, you need to get access to the D+ and D- wires and look at the signal across them differentially using two scope probes. If you do that, you will still find it almost impossible to interpret the data unless you have a protocol analyzer that understands USB talk. USB data is not just a level shifted version of the TTL signal, it is bi-directional with lots of added headers and checksums.

There are many comms programs and Realterm is one of the better ones. The capture only saves what you see on the screen to a file, it will not store anything you can't also see. Try other programs or a different TTL/USB converter. What OS are you using?

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top