CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CCS have a bug on interrupt handler?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

CCS have a bug on interrupt handler?
PostPosted: Fri Jan 27, 2017 8:20 am     Reply with quote

PIC18F67J50
PLL_ON internal OSC

CCS V.5056

OSCTUNE=0x64
OSCCON=0x12

One level interrupts.(Legacy mode)

Time to time OSCTUNE change to 0x09, so PLL is off.

I put a breakpoint on memory change and stop at the input of interrupt handler routine; that is CCS code because I'm using CCS default interrupt handler.

Also PIE1 changes get TMR2IE and CCP1IE enabled and I specifically disable those interrupts at program start.

Any idea about how to solve this?
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Fri Jan 27, 2017 9:16 am     Reply with quote

I would suspect you have a hardware problem. You can get registers being corrupted, if you have inadequate smoothing on Vddcore. Look at the diagram for recommended connections. Are yours done like they suggest?.
Are you using the on-chip Vreg or an external supply?.
The ESR specification for this capacitor is vital to stability, as is how close it needs to be to the chip.

If you build the code with 'symbolic' mode selected, and look at the LST file, you can see that there is no instruction in the handler to touch the OSCCON register. The only time it touches this is a the very start to turn the PLL on at boot.
Similarly no hidden instructions accessing the interrupt enables.

Tested with your compiler version.
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Fri Jan 27, 2017 9:45 am     Reply with quote

Thanks for your answer.
Can be a hardware problem but then Why the breakpoint always stops at the same instruction?

I have an LM2576 to get 4.3V, then an LDO to get 3.3V and then the internal LDO and every voltage with their own capacitors.
Also I put 100nF close to every VDD and AVDD and the PCB have four layers with GND mask.

I get before some troubles with BSR register being corrupted when I use two interrupt levels, that's why now I'm using only one.
_________________
Electric Blue


Last edited by E_Blue on Mon Jan 30, 2017 7:12 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Sat Jan 28, 2017 3:19 am     Reply with quote

Generally hardware things like this will often just affect a few specific cells in memory.
My suspicion actually is that it is jumping or calling the interrupt handler, possibly with the wrong flags set.
Are you _sure_ about the ESR spec of the capacitor on Vddcore?. This one causes a lot of grief.
Can you step back to a really small test program, just setting up the interrupt, and the minimum hardware to see if the problem still appears.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jan 28, 2017 5:21 pm     Reply with quote

E_Blue wrote:
Also I put 100nF close to every VDD and AVDD.


The VDDcore capacitor should be 10 uF (typical). This is in table 28.4 in
the 18F67J50 datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/39775c.pdf
The errata clarifies this to say it must have an ESR < 5 ohms:
http://ww1.microchip.com/downloads/en/DeviceDoc/80000481B.pdf
This is one of the suitable caps that Microchip recommends.
It's a ceramic smt cap, X7R, 16v, 10%, 1206 size (3216 in metric size):
http://www.digikey.com/product-detail/en/tdk-corporation/C3216X7R1C106K160AC/445-4042-1-ND/1965688
Ceramic MLCC caps like this typically have a very low ESR.

Here is a recent example in the CCS forum of using an incorrect type of
capacitor (not value, but the type and specs) for the Vddcore cap.
http://www.ccsinfo.com/forum/viewtopic.php?t=55858&start=15
In his case, he switches it to a tantalum cap. Many tantalum caps
have an ESR well below 5 ohms.
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Sun Jan 29, 2017 2:28 am     Reply with quote

Thanks PCM.

The reason I keep 'harping' back to this, is I wasted two days a little while ago. Was asked to come in and 'fix' a programming problem a company was having on a board based on the 87J50. Went in chased round the software, and after a few hours started throwing out code to try to track down what was wrong. Eventually found four bits in the Processor registers were changing without reason. Scratched my head, then started looking at the hardware. Board was one they had made 'in house', and looked fine, but eventually put a scope on the Vddcore line, and found it had a tiny oscillation at about 100MHz. Checked the cap spec and it looked OK (like the thread you point to), but had in my 'toolbox' some Murata ones the same size/value. Decided to substitute one of these, and as soon as I did, the board started behaving properly. There were only a couple of minor problems in the original code....

So I have seen a problem almost identical to the one being described here, caused by the wrong capacitor on Vddcore.

It needs to be 10uF, and needs a low ESR. I've seen 'conventional' electrolytic's be OK, if paralleled with a small ceramic, and also OSCON electrolytic ones be fine, or (honestly), use the ones that Microchip specify.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group