View previous topic :: View next topic |
Author |
Message |
Axel
Joined: 18 Sep 2008 Posts: 9 Location: Gothenburg
|
Application hangs |
Posted: Sun Jan 31, 2010 6:51 am |
|
|
I have recently been experiencing the PIC to hang in to boot sequence. More specifically, it hangs when setting up the I2C-bus. It has done so a few times in the past but I never gave it much thought since it happened so rarely. Now it hangs about 9 times out of 10 and its a real nuisance!
I'm using MPLAB 8.30, PCW 4.064 and an ICD3 programmer. If I press pause on the program the execution is located here (disassembly listing):
Code: | 16: #use I2C(master, scl=PIN_C3, sda=PIN_C4, force_hw, fast=400000, stream=I2CBUS)
00004 9EC6 BCF 0xfc6, 0x7, ACCESS
00006 969E BCF 0xf9e, 0x3, ACCESS
00008 C09B MOVFF 0x9b, 0xfc9
0000C 0E02 MOVLW 0x2
0000E BEC6 BTFSC 0xfc6, 0x7, ACCESS // Execution halts on this instruction!
00010 D005 BRA 0x1c
00012 A69E BTFSS 0xf9e, 0x3, ACCESS
00014 D7FE BRA 0x12
00016 0E00 MOVLW 0 |
Does anyone have a clue about what is going on here?
Oh, whats being marked as [spam] by phpbb is actiually B R A-instructions.
Best regards,
Axel Lindholm |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Jan 31, 2010 7:03 am |
|
|
Post the processor you are using and also the silicon revision ID.
Have you tried reducing the program to a bare minimum? If it hangs 9 times out of 10 it should be easy to create a small compilable program demonstrating the problem. |
|
|
Axel
Joined: 18 Sep 2008 Posts: 9 Location: Gothenburg
|
|
Posted: Sun Jan 31, 2010 10:29 am |
|
|
I've overcome the problem I had but faced an even stranger one. It all worked fine if instead of using multiple compilation units and linking them together I included all source files directly in main.c. The few times I got it to run with separately compiled modules and linking MPLAB seemed to miss about 2/3 of my breakpoints and when it finally did halt on a breakpoint the contents of the watch table was complete jibberish.
Is this a known problem? Is there some kind of setting I forgot to enable / disable / change to make this work?
The MCU I'm working with is PIC18F67J10. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Jan 31, 2010 1:50 pm |
|
|
I can't help with your problem, but multiple compilation units are a new feature of the v4.0 compiler and it took CCS a long time to make this a stable version. V4.064 is old and known to have lots of problems. To me the v4.0xx compilers became more or less usable around v4.074, 10 releases after your version. Currently we are at v4.104, another 30 more bug fixing releases later...
You might find a way to make it working in v4.064, but I'd try with a newer compiler version instead of wasting time wrestling with since long fixed bugs. |
|
|
|