Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/18/05 08:24
Modified:
  03/18/05 08:29

Read: times


 
#89909 - Hunting down the ghost
Responding to: ???'s previous message
You have to hunt down that beast. Horses and dogs and all.

Don't you have an emulator around? Looking into the SFRs, registers, internal registers would be handy, trace memory woudl be a bonus.

A couple of questions/ideas:

First, what combination of priorities you have tried? I assume, you tried timer0 interrupt priority low and one or both serial interrupt priorities high.

Nick Robinson said:
The timer isr stops. The timer hardware is probably still running.

Are you sure? You can probably output the timer value the same way as you output the stack pointer.

Nick Robinson said:
We have managed to speed it up to within a few hours or so by sending lots of data through the serial ports. Otherwise we would be going nuts!

Waiting for "few hours" to chack for some idea sounds like going nuts to me. I would try to speed this up further. I know that modifying the code is a risk of inducing further errors that might mask the original, but I would take that risk. I would increase serial data rate. I would add empty loops into the isrs. I would increase timer reload/interrupt rate.

Is there any data processing in the isrs? Is there any critical combination that takes too long to process? Try using only that data. Is the timer interrupt processing data? Give him as much as it can take. Try to send garbage data. If it has enhanced UART, send him data with framing errors (use 1 more bit for transmission and set it to 0). If you check parity, try sending parity errors. If you assume packets of some maximum length, try sending invalid length.

I would be not sure about the (un)corrupted stack. A runaway pointer can do strange things :-( What about monitoring the complete content of stack? Try also monitor the peak stack usage - try to establish a "maxsp" variable and in the highest priority interrupt check if sp>maxsp and if so, store sp into maxsp; then monitor maxsp. Is the 1k stack flag on? Is it still on after the stall? Are there any data above the stack (that stack could possibly run into them).

Nick Robinson said:
In the timer:
TL0 = 0xFF;
TH0 = 0xB8;
TF0=0;
ET0 = 1; //enable t0 interupt
TR0 = 1; // timer0 enabled again!!!

Why on earth are you clearing TF0??? If a higher priority interrupt longer than 20ms kicks in between reloading tl0/th0 and clearing tf0, you can loose an interrupt, the next coming after 65536 cycles. Is this OK to have a longer time between timer interrupts (e.g. if you fill a buffer by data in serial interrupt and empty it in timer interrupt, assuming the timer is often enough the buffer can be short and if ocassionally the timer interrupt takes longer, the buffer can overflow)?
Do you stop the timer during reload?
There is also no point to enable timer inerrupt and timer run in the isr, unless you don't disable them there (but it should also make no harm except the isr gets longer a bit).
Try also count the isr enters/exits (inc a variable on enter and dec on exit) and monitor this value.

Jan Waclawek


List of 38 messages in thread
TopicAuthorDate
DS5250 Lockup in ISR's With Priority            01/01/70 00:00      
   Update:            01/01/70 00:00      
      Software Bug            01/01/70 00:00      
      using what            01/01/70 00:00      
         register banks            01/01/70 00:00      
            Shared Data Problem            01/01/70 00:00      
            What stops?            01/01/70 00:00      
               timer isr stops            01/01/70 00:00      
                  Hunting down the ghost            01/01/70 00:00      
   Using different banks            01/01/70 00:00      
      Can't be            01/01/70 00:00      
         stack            01/01/70 00:00      
            more on ISRs            01/01/70 00:00      
         DS5240 has a 1k stack.            01/01/70 00:00      
            but are you using it            01/01/70 00:00      
               Stack            01/01/70 00:00      
   ISRs with Own Register Banks.            01/01/70 00:00      
      Good Questions on ISR's            01/01/70 00:00      
         Shared Data            01/01/70 00:00      
         Not a given            01/01/70 00:00      
            Variable in isr            01/01/70 00:00      
               Sometimes true            01/01/70 00:00      
                  Atomic Operations            01/01/70 00:00      
                     re explosive bytes            01/01/70 00:00      
                        Common Solutions            01/01/70 00:00      
                           Stop's the timer            01/01/70 00:00      
                              Code            01/01/70 00:00      
                        Explosions everywhere            01/01/70 00:00      
                           atomic explosions            01/01/70 00:00      
                              Unreal Time Explosions            01/01/70 00:00      
               Look at the ASM            01/01/70 00:00      
         I have had a very similar problem            01/01/70 00:00      
      ASM instructions & USING            01/01/70 00:00      
         Please do tell us....            01/01/70 00:00      
            Do I really have to?            01/01/70 00:00      
            Brian, Michael            01/01/70 00:00      
               ASM instructions & USING            01/01/70 00:00      
         probably not the case here            01/01/70 00:00      

Back to Subject List