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

Pic not running - SOLVED
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

Pic not running - SOLVED
PostPosted: Sat Oct 12, 2013 11:52 am     Reply with quote

Hi All,

My PIC seems to be a nice little red Brick.

It does not run code... or seems to not run the code...

Ive tried to simulate/Debug with my Pickit 3 and seems to run fine... but even the led toggles ive included don't seem to have any effect...

Printing to the LCD does nothing...

so... What are the possible reasons for this behavior?

it does not happen on any of my other projects...

When simulating the #use delay(41666667) takes an awful long time... so much that if i don't click on run (instead of simulate) i start to grow a beard...

MPLAB is set as RELEASE... the chip is NOT in reset... and ... it does not work with the programmer connected or not...

... any suggestions?

Oscillator and fuses:

Code:
#elif STACK_USE_OLIMEX_PIC_MAXI_WEB
 #include <18F97J60.h>
 #device PASS_STRINGS=IN_RAM
 #reserve 0xE80:0xEFF   //SFR
 #reserve 0xF00:0xFFF   //SFR
 #use delay(clock=41666667)
 #fuses NOWDT, NODEBUG, H4_SW, NOIESO, NOFCMEN, PRIMARY, ETHLED
#else


Code:
  #if STACK_USE_CCS_PICEEC||STACK_USE_CCS_EWL3V||STACK_USE_OLIMEX_PIC_MAXI_WEB
   setup_oscillator(OSC_PLL_5_DIV_3 | OSC_NORMAL);
   restart_wdt();
   delay_ms(144);
   restart_wdt();
  #endif


Thanks

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093


Last edited by Gabriel on Tue Oct 15, 2013 2:20 pm; edited 1 time in total
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Sat Oct 12, 2013 2:02 pm     Reply with quote

Additional Info...

the 25M onboard crystal is oscillating... i checked with my scope...

no blinky leds yet...


any other project i run on the board runs fine...
_________________
CCS PCM 5.078 & CCS PCH 5.093
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Sat Oct 12, 2013 2:36 pm     Reply with quote

Nobody can tell, without seeing the #if corresponding to the #elif, and without knowing what the #defines tested in the #if and #elif, are set for.

The first section will only get used, if whatever is in the first #if, is 'FALSE', and that STACK_USE_OLIMEX_PIC_MAXI_WEB is TRUE....
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Sat Oct 12, 2013 2:56 pm     Reply with quote

Ive set the defines to make my hardware the only one set to TRUE.


Code:
#define STACK_USE_CCS_PICENS            0 //18f4620 + enc28j60
#define STACK_USE_CCS_PICNET            0 //18f6722 + realtek
#define STACK_USE_CCS_PICNET_OLD       0
#define STACK_USE_CCS_PICEEC            0 //18f67j60
#define STACK_USE_CCS_EWL3V             0 //ezWebLynx 3V
#define STACK_USE_CCS_EWL5V             0 //ezWebLynx 5V
#define STACK_USE_CCS_EWL5V_REV2       0 //ezWebLynx 5V (REV2)
#define STACK_USE_OLIMEX_PIC_MAXI_WEB    1 //18f97j60



Obviously.
_________________
CCS PCM 5.078 & CCS PCH 5.093
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sat Oct 12, 2013 7:18 pm     Reply with quote

One of the things I do when this happens is verify the PIC is not hanging someplace.

using spare pins I set them all low right at the very start of the code then
set them high one after the other 5-10 lines apart to see how far the
code is getting until I narrow down where the problem lies.
_________________
Google and Forum Search are some of your best tools!!!!
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Sat Oct 12, 2013 8:01 pm     Reply with quote

dyeatman wrote:
One of the things I do when this happens is verify the PIC is not hanging someplace.

using spare pins I set them all low right at the very start of the code then
set them high one after the other 5-10 lines apart to see how far the
code is getting until I narrow down where the problem lies.


A man after my own heart - what better use for spare pins that telling us something useful about what is going on in there (since it almost never runs as expected the first time anyway). Helps find that "duh" moment in your code Rolling Eyes

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Sun Oct 13, 2013 1:10 am     Reply with quote

Step back.

Forget the full code.

Take the fuses, and combine these with a simple 'flash an LED' program.

Run this. Verify how fast the LED flashes. Does it work?.

If so, then compare the fuses programmed to the chip, with those from the full code. End of the .lst files. Does it match?.

If not, then the problem is something in the logic tests leading to the wrong fuses being actually loaded.
If it does, then your clock should be correct.

If the flashing program doesn't work, or the rate is wrong, then again look at the lst file fuses and verify with the data sheet that these are what you expect. Loading the code into MPLAB, and looking at what it shows for the configuration, is an easy way of checking what would go into the chip.

There are several settings on quite a few chips that don't default to what may be expected, which can cause problems, but the first step is always to forget the main code, and get the chip working, and working at the required rate, _before_ working on more complex code.

Best Wishes
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 9:07 am     Reply with quote

Thanks for the suggestions... ill go over that tonight.

i tried placing output toggle statments on my onboard LEDs throughout the code.... that only proved somthing is wrong.

I checked the crystal with my scope and its running at 25Mhz...

so the clock is running but it seems like its not stepping through code..

Ill check all fuses and report..

Thanks.
G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 7:34 pm     Reply with quote

Code:
Code:
 #include <18F97J60.h>
 #device PASS_STRINGS=IN_RAM
 #reserve 0xE80:0xEFF   //SFR
 #reserve 0xF00:0xFFF   //SFR
 #use delay(clock=41666667)
 #fuses NOWDT, NODEBUG, H4_SW, NOIESO, NOFCMEN, PRIMARY, ETHLED


LST:
Quote:
Word 1: F4A0 NOWDT STVREN NOXINST NODEBUG NOPROTECT
Word 2: FF05 H4_SW PRIMARY NOFCMEN NOIESO WDT32768
Word 3: F7F8 EASHFT MCU BW16 NOWAIT CCP2C1 ECCPE ETHLED


I tried the fuses above on a small test program and it ran fine..

now, when i run the modbus code... which does not run... the pic gets hot....not burning... just hot.. i program it and its an immediate temperature increase... press reset, fast cool down... release reset.. back to cooking...

load a different program no temperature difference...

i doubt is just processor load making it hot... the board is Known good hardware.....and i have no idea what is going on.

man this gets weirder every day.

G.


G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 7:46 pm     Reply with quote

If you need to research a PIC-specific issue (as opposed to a CCS issue)
then use Google to search the Microchip forums:
Quote:
site:microchip.com/forums 18F97J60 hot -"hot topic"

Also search:
Quote:
site:microchip.com/forums 18F97J60 OR PIC18F97J60 hot -"hot topic"

In other words, this CCS-specific forum is not the whole world.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 7:58 pm     Reply with quote

yeah thanks for that.... i should have tried that search on my own...
sorry... I'm pretty frustrated by now and got tunnel vision.

I'm glad to know that the ethernet causes the heat... it means its getting turned on....

i guess I'm on a witch hunt now...

i tested the clock with a LED program and its spot on... no problem there..

g.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 8:17 pm     Reply with quote

so... The PIC gets hot because the ethernet module is on...
i then proceed to find said "turn on Ethernet" statement
continue to place LED triggers prior and after said statement
and as of this moment i see no blinky...

...cursing ensues.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue Oct 15, 2013 1:25 pm     Reply with quote

Errr.... yeah... by manually enabling the tris settings on the ports it started working....

now the LCD does not seem to recognize the direction change but i now know how to look...

modbus example works good... its triggering my relays and my LEDS... got the internal registers working too...


Thank you all for your help....

I was getting a little dense at the end there... i appologize..

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

Results
PostPosted: Wed Oct 16, 2013 11:08 am     Reply with quote

Just a late update:

I've gotten the Modbus TCP server to work properly on the OLIMEX PIC MAXI WEB board, with all basic features.

Relay control
Opto-Inputs
Buttons
Analogue(trim pot) readings
LCD


The system seems stable although I have yet** to run a 24 hour test... will report.

**Mostly because I'm worried about the "normal" temperature increase... I'm putting a heat sink on the thing and a fan... i don't care what anyone says.

I'm going to write a little time splicing routine tonight for the "user" routines and that should be it.

thanks again,

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Wed Oct 16, 2013 1:52 pm     Reply with quote

Some chips take more cooling than others. For us old geezers, this was a favorite - check out the cooling requirements on the Signetics Write Only Memory data sheet. It may apply in your case Twisted Evil
http://www.repeater-builder.com/humor/signetics-wom.pdf

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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