PICcoder.co.uk Forum  


::post new topic::
can't find a problem
Date: 2007/01/31 08:45 By: Genady Status: Visitor  
 
Hello ,
I built project wich have many functions running all the time ,this functions have no relation to enc 28j60 but they detain StackTask wich i call constantly so my time between pings is 300ms , my project also have internet web pages that i keep in my flash and they also work fine ,my problem is that after some time may be a day or more all function that my project does works fine but pings stop working and of couse internet web stops too.
I don't use DHCP,i set my ip manualy to 192.168.0.100
Can somebody tell me where i have to look in my program to find when my stack is stuck in ?
my stack ver. is 3.75 Modified to work with CCS.
sorry for my english ,and thanks.
reply | quote

Re:can't find a problem
Date: 2007/02/02 09:34 By: Mat Status: Admin  
Karma: 7  
Posts: 211
graph
Hi, Sorry im only just getting start on using the ethernet stack properly, Ian is probably the man to talk to about this. Personally I've never had this problem so cant really comment on it, however I believe I have heard of this before in older stack versions or the enc setup. I may be wrong, so someone correct me if I am, but wasnt this solved in the new ethernet pics?

Mat
reply | quote

Re:can't find a problem
Date: 2007/02/02 16:30 By: asmallri Status: User  
Karma: 2  
Posts: 5
graphgraph
There are many possible causes for the problem you are seeing including hardware problems such as missing decoupling capacitors, power supply not supplying the peak current required by the ENC, missing decoupling capacitors around the ENC and the PIC, incorrect bias resistor value, incorrect SPI mode etc. There there are potential chip version specific, driver problems, and there there is the "lock step" problem where a state machine cannot transition from one state to another because it is waiting on a resource that is blocked.

The best way to think of the MCHP stack is a proof of concept learning tool. It is not bullet proof. I would not develop a commercial application with it but would be comfortable using it for proof of concept.

Assuming the problem is softwae related, one mechanism I use to isolate this type of problem is to generate an external interrupt and dump the contents of the PICs hardware stack. By examining the stack you can see what are of code was executing when the PIC was interrupted. By examining the stack you can also see the sequence of called functions that lead to the problem code. I find this technique far more powerful than using an ICD2 to find this sort of infrequent problem. You could use a switch connected to a spare interrupt pin for this purpose.

Here is an operation code segement to support this capability. In this case I did not have access to a spare interrupt pin so I used a normal digital input combined with the UART recive interrupt handler. When a serial character is received by the PIC an interrupt is generated, inside the handler the PIC tests the status of the RELEASE (dump stack) button. If the input is low the hardware stack is dumped, if not the interrupt handler processes received characters as normal.

Code:

  #pragma interruptlow serial_isr void serial_isr(void)     {     char ShadowStack[64];     char ShadowOffset 0;     char ShadowPtr;     // test for overrun error     if (RCSTAbits.OERR)         {         RCSTAbits.CREN=0;        // clear continous receive bit         RCSTAbits.CREN=1;        // set continous receive bit         }     RxBaseC[RxHeadC++]=RCREG;     RxHeadC %= RxCQsize;     #ifdef Release         ///////////////////////////////////////////////////////////////////////////         // Used by Low Priority Interrupt Routine to dump the Stack         // Used in event of System Crash or Program Loop to determine         // Where the program is looping         // test if the release switch is operated         if (Release == 0)             {             RS232Out(0x0d);             RS232Out(0x0a);             RS232Out('S');             RS232Out('t');             RS232Out('a');             RS232Out('c');             RS232Out('k');             RS232Out(0x0d);             RS232Out(0x0a);             //  copy the stack to the stack shadow memory             ShadowPtr STKPTR;             INTCONbits.GIEH 0;     // disable high priority interrupts             do                 {                 ShadowStack[ShadowOffset++] = TOSH;                 ShadowStack[ShadowOffset++] = TOSL;                 STKPTR--;                 } while ((STKPTR 0x1f) != 0);             STKPTR ShadowPtr;             INTCONbits.GIEH 1;     // enable high priority interrupts             // have the mirror, now output the image             ShadowPtr--;    // we are not interested in the first location - always 0000             ShadowOffset 0;             do                 {                 HexRS232Out(ShadowStack[ShadowOffset++]);                 HexRS232Out(ShadowStack[ShadowOffset++]);                 RS232Out(0x0d);                 RS232Out(0x0a);                 ShadowPtr--;                                 } while (ShadowPtr);                  }             #endif     }



Post edited by: asmallri, at: 2007/02/02 16:30
reply | quote

Re:can't find a problem
Date: 2007/09/26 19:17 By: sakugava Status: Visitor  
 
Genady wrote:
Hello ,
I built project wich have many functions running all the time ,this functions have no relation to enc 28j60 but they detain StackTask wich i call constantly so my time between pings is 300ms , my project also have internet web pages that i keep in my flash and they also work fine ,my problem is that after some time may be a day or more all function that my project does works fine but pings stop working and of couse internet web stops too.
I don't use DHCP,i set my ip manualy to 192.168.0.100
Can somebody tell me where i have to look in my program to find when my stack is stuck in ?
my stack ver. is 3.75 Modified to work with CCS.
sorry for my english ,and thanks.
reply | quote

Re:can't find a problem
Date: 2007/09/26 19:21 By: sakugava Status: Visitor  
 
I´m looking for a TCP/IP stack to work with CCS compiler. Could you send it to me?
Thanks

Jose Fernando Sakugava
sakugava@gmail.com
reply | quote

::post new topic::