pic32 USB Program..issues

Discussion in 'Programmer's Corner' started by chrisw1990, Mar 17, 2012.

  1. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    Hi,
    so its been a while since iv posted here, hope all's ok.
    been programming on my little pic32 starter kit (DM320004) if anyones interested, i posted here a while back about having issues with usb host. well iv managed to find some time, and im back on it, having sorted out directories etc, iv started writing and playing with my own code.. however, problem is, when i load the board, and its all compiled for debugging etc, i click play, but it instantly stops it.
    no idea why.. i tried copying all the demo code over and it does the same.. so very confused!! please help..
    any questions, any required help.. the demo code is fine, yet i compile and program the board of my code (a direct copy due to this issue) and it still does the same?
    :(
     
  2. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    USB needs a lot to be right before it will work.
    I used a pic184550 project from www.waitingforfriday.com and it just worked.
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Hard to guess what the problem may be. Do you get any code to run at all? When you say "it instantly stops it" what is "it"? What code are you running? Will it run in release mode? Did you build the code in debug more to debug it? Is the correct debugger selected?

    If this is your first P32 code then post something simple, like get a LED to light.
     
  4. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    Hi ErnieM,
    i have this afternoon fixed it..? it was a problem with the project settings, though which im not entirely sure, im just playing with the code itself at the moment, but i intend to go through and sort it out, seems a stupid problem to have had!
     
  5. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    i hadn't got a "heap size" in, corrected it to what the demo code had (8192) and bingo, not sure what that does though?
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The "heap" is a place in RAM for C to pull out bits of memory at run time on an as-needed basis. It is where "malloc" gets the space for it's memory. It can be reserved then later released for other uses.

    Similarly there is the "stack" area where the pushed data goes used in function calls and dynamic function memory (static variables go elsewhere).

    If either memory area is overrun the PIC32 is sophisticated enough to raise an exception (like an interrupt), and the default handler just stalls the program execution.
     
Loading...