View previous topic :: View next topic |
Author |
Message |
kerplatz
Joined: 01 Nov 2016 Posts: 18
|
cpu reset |
Posted: Tue Dec 13, 2016 9:40 am |
|
|
I have an interesting problem with performing a reset. When I do either one of -- reset_cpu() or #asm RESET #endasm -- the processor does only part of the process which is to goto 0 and then it jumps back to the start of main(). I verified this by looking at my project .LST file. The code never starts after the reset.
I proved that by attaching the Pickit3, putting the IDE into Debug mode, and issuing the reset command again. Sure enough the debugger went from a red circle (running) to a green triangle (stop) pointing to the top of main(). Then all I did was click the green arrow and my program began again.
I assume that the code I am programming the PIC24 with is debug code. I can not for the life of me find in the IDE where I can create release code or non-debug code. I have looked in the documentation and could not find a thing about release code or debug code. I have also looked through this forum and have found that others can perform a reset, so why can't I. Thanks for your help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Dec 13, 2016 4:40 pm |
|
|
I don't use the CCS IDE, but from looking at screenshots, I don't see
the Debug/Release drop-down box that MPLAB 8.92 has.
This CCS FAQ article talks about how to create a stand-alone (release)
mode program with the CCS IDE:
https://www.ccsinfo.com/faq.php?page=standalone
This explanation seems insufficient to me, because it says to "make sure
the debugger is disabled" but it doesn't tell how to disable it in the IDE. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1349
|
|
Posted: Tue Dec 13, 2016 7:00 pm |
|
|
I've never seen the option to switch between debug/release in the CCS IDE. It's always been what I would consider "release" code and if I want debug, I have to manually add the lines to my .h file. There might be an option, but out of all of our installs at work, none of them default to a debug mode. We use PCWHD for reference. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19518
|
|
Posted: Wed Dec 14, 2016 3:02 am |
|
|
It's so 'there', that it actually becomes non-obvious!...
You have the choice of selecting 'debug', or 'program'. If debug is selected, then you have an 'enabled'/'disabled' box. If you have the window showing where you are in the program execution, then you are in the debugger. Select debug on the top menu strip, and then the toolbar left end will have a little 'bug' showing (variety of slightly odd ladybird), with 'disable' below it. Click. You are now out of debug mode.
You must then re-compile.
Then you have to select 'program' rather than letting the debugger write the code automatically.
There are some oddities. For instance several of the debugger units, though they program the chip fine for 'debugging', won't actually program the chip for normal use!...
Personally if I am using the debugger I find it easier to program using CCSLOAD and a separate programmer that I know works. I always have the code setup so that if ICD==TRUE (test in the code), it displays a warning 'code being compiled in DEBUG mode', on compile. This way I am 'sure' of the mode being used. |
|
|
kerplatz
Joined: 01 Nov 2016 Posts: 18
|
|
Posted: Wed Dec 14, 2016 8:54 am |
|
|
I now have some things to try. The first thing will be to use the Program button in PCD above the Run section on the toolbar and not the Build & Run button above the Compile section on the toolbar. I suspect that Build & Run is a debug mode, which I never really paid that much attention to being different than Program.
The second thing is to add the Fuse NODEBUG to my code if the above idea does not work.
The third thing is to do both. Hopefully one of these things will solve my problem. I will let everyone know the results. |
|
|
|