+ Post New Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 28
  1. #1
    Advanced Member level 5
    Points: 25,847, Level: 39
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    5,442
    Helped
    417 / 417
    Points
    25,847
    Level
    39

    Running micro and debugger to find problem with code?

    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?

  2. #2
    Advanced Member level 4
    Points: 7,706, Level: 20
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,376
    Helped
    321 / 321
    Points
    7,706
    Level
    20

    Re: Running micro and debugger to find problem with code?

    K-series doesn't support realtime debugging. It is microchip, dude. Welcome to middleages.
    Love me or hate me. All infractions will be ignored.



  3. #3
    Banned
    Points: 5,417, Level: 17

    Join Date
    Jun 2016
    Posts
    1,159
    Helped
    122 / 122
    Points
    5,417
    Level
    17

    Re: Running micro and debugger to find problem with code?

    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.



  4. #4
    Advanced Member level 5
    Points: 11,459, Level: 25
    Achievements:
    7 years registered

    Join Date
    Apr 2010
    Posts
    1,754
    Helped
    383 / 383
    Points
    11,459
    Level
    25

    Re: Running micro and debugger to find problem with code?

    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.


    1 members found this post helpful.

    •   Alt21st April 2017, 12:26

      advertising

        
       

  5. #5
    Super Moderator
    Points: 23,566, Level: 37
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Portugal
    Posts
    7,132
    Helped
    878 / 878
    Points
    23,566
    Level
    37
    Blog Entries
    5

    Re: Running micro and debugger to find problem with code?

    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.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

  6. #6
    Advanced Member level 5
    Points: 25,847, Level: 39
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    5,442
    Helped
    417 / 417
    Points
    25,847
    Level
    39

    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



  7. #7
    Super Moderator
    Points: 23,566, Level: 37
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Portugal
    Posts
    7,132
    Helped
    878 / 878
    Points
    23,566
    Level
    37
    Blog Entries
    5

    Re: Running micro and debugger to find problem with code?

    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.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

  8. #8
    Advanced Member level 5
    Points: 25,847, Level: 39
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    5,442
    Helped
    417 / 417
    Points
    25,847
    Level
    39

    Re: Running micro and debugger to find problem with code?

    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.



  9. #9
    Super Moderator
    Points: 23,566, Level: 37
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Portugal
    Posts
    7,132
    Helped
    878 / 878
    Points
    23,566
    Level
    37
    Blog Entries
    5

    Re: Running micro and debugger to find problem with code?

    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.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

  10. #10
    Advanced Member level 5
    Points: 25,847, Level: 39
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    5,442
    Helped
    417 / 417
    Points
    25,847
    Level
    39

    Re: Running micro and debugger to find problem with code?

    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?



    •   Alt6th May 2017, 14:00

      advertising

        
       

  11. #11
    Super Moderator
    Points: 65,645, Level: 62
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    10,781
    Helped
    3511 / 3511
    Points
    65,645
    Level
    62

    Re: Running micro and debugger to find problem with code?

    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.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.


    1 members found this post helpful.

  12. #12
    Super Moderator
    Points: 23,566, Level: 37
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Portugal
    Posts
    7,132
    Helped
    878 / 878
    Points
    23,566
    Level
    37
    Blog Entries
    5

    Re: Running micro and debugger to find problem with code?

    Quote Originally Posted by treez View Post
    ...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.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

  13. #13
    Advanced Member level 5
    Points: 25,847, Level: 39
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    5,442
    Helped
    417 / 417
    Points
    25,847
    Level
    39

    Re: Running micro and debugger to find problem with code?

    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.?



  14. #14
    Banned
    Points: 5,417, Level: 17

    Join Date
    Jun 2016
    Posts
    1,159
    Helped
    122 / 122
    Points
    5,417
    Level
    17

    Re: Running micro and debugger to find problem with code?

    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.


    1 members found this post helpful.

  15. #15
    Super Moderator
    Points: 23,566, Level: 37
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Portugal
    Posts
    7,132
    Helped
    878 / 878
    Points
    23,566
    Level
    37
    Blog Entries
    5

    Re: Running micro and debugger to find problem with code?

    Quote Originally Posted by treez View Post
    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
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  16. #16
    Banned
    Points: 5,417, Level: 17

    Join Date
    Jun 2016
    Posts
    1,159
    Helped
    122 / 122
    Points
    5,417
    Level
    17

    Re: Running micro and debugger to find problem with code?

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



  17. #17
    Super Moderator
    Points: 232,370, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    40,133
    Helped
    12257 / 12257
    Points
    232,370
    Level
    100

    Re: Running micro and debugger to find problem with code?

    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.



  18. #18
    Advanced Member level 5
    Points: 25,847, Level: 39
    Achievements:
    7 years registered

    Join Date
    Sep 2008
    Location
    cambridge
    Posts
    5,442
    Helped
    417 / 417
    Points
    25,847
    Level
    39

    Re: Running micro and debugger to find problem with code?

    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



    •   Alt6th May 2017, 19:44

      advertising

        
       

  19. #19
    Banned
    Points: 5,417, Level: 17

    Join Date
    Jun 2016
    Posts
    1,159
    Helped
    122 / 122
    Points
    5,417
    Level
    17

    Re: Running micro and debugger to find problem with code?

    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.



  20. #20
    Super Moderator
    Points: 65,645, Level: 62
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    10,781
    Helped
    3511 / 3511
    Points
    65,645
    Level
    62

    Re: Running micro and debugger to find problem with code?

    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.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



--[[ ]]--