No announcement yet.

How to find source of GPF

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to find source of GPF

    I'm working on a project that sends data serially from a microcontroller to a PC. The PC interprets the data in light of various sources of information.

    On trying a radically different microcontroller the PC now GPF's. I suspect the ultimate fault is with the microcontroller code but nevertheless I want to find the source of the GPF.

    Too much code to post and anyway would be irrelvant without the associated hardware.

    Does anyone have a way to identify the location of the code that GPF'd or even a general approach to finding it?

    Click image for larger version

Name:	Image 1.jpg
Views:	5
Size:	106.2 KB
ID:	772469
    Attached Files

  • #2
    Does anyone have a way to identify the location of the code that GPF'd or even a general approach to finding it?
    Install Ollydbg.

    Try installing an Exception Handler:


    • #3
      Hi James,

      my IDE can do that! Please read more here. You must compile your code with the "Compile (GPF)" option in "Run" menu. Please read the help file to get a correct setup. If you still have questions, drop me a mail a <jk-ide at t minus online dot de>



      • #4
        Code C000005 is the most common cause of a General Protection Fault: attempt to access unowned memory.

        The bad news is, these can be hard to find.

        The good news is, the problem is definitely in your program and can be found.

        "Somewhere" in your program you are missing an error check, or a value check, or you are calling a procedure with an out-of-range option, or maybe you are ignoring an error which was caught by the PB runtime. .

        You can find errors caught by the PB runtime by using #DEBUG DISPLAY. You can only find errors on calls to externals (e.g. the WinAPI) by checking the return and/or value (about 99% of WinAPI calls offer at a minimum a "success/fail" code).

        In your case, you will probably get a failure on either Null Pointer or subscript out of range (error 9 see your help file for more info)

        Also note: the error did not necessarily occur anywhere near the last line of code which executed successfully.

        Failing code not shown.



        • #5
          Thanks to all posters, I'll print this page and download (and play with) suggested software. By some stroke of dumb luck it occured that I only checked that packets were legal (CRC, preamble, packet type and packet length) and assumed that the data in them, specifically the data address, was correct.but in this case not so much. Super board with super users.


          • #6
            I had to slow down the transfer rates on some RS232 lines where data was lost.
            You would think all these problems would of been work out years ago but I guess the frequency of subject today with a lot of equipment is not the best it should be.
            p purvis


            • #7
              Paul I'm running at 115200 and it works very well, as I said my problem was not with comms error but with the data in the legal packet.

              Just an aside for anyone using USB to/from RS232 and finding the latency is slowing everthing down too much, I notice that on the FTDI driver (can't speak for others), in BM Options (no idea what BM means) a latency timer can be can be set between 1 and 255. Set to 1 it's almost as fast as a "real" RS232 port.