Home    Bloggers    Messages    Resources
Tw  |  Fb  |  In  |  Rss
Aubrey Kagan

Feedback Shift Register Could Help Analyze Software Activities

Aubrey Kagan
Newest First   Oldest First   Threaded View
jkvasan
jkvasan
2/26/2013 12:59:03 AM
User Rank
Blogger
Re: Sig Analysis
I recall my googling for watchdogs sometime back and reading some paper. It was mentioning a watchdog methodology called Limp-Home recovery. Is it something like a lift having just enough battery backup to the nearest floor in the event of power failure? Could it be implemented in a small mcu embedded system?

It would be great if anyone in the team could enlighten us further.

100%
0%
antedeluvian
antedeluvian
2/24/2013 9:06:10 AM
User Rank
Blogger
Re: Sig Analysis
BB

In particular if the 'calling sequence' can be retained it would hopefully make it much easier to see where the error started.

 

Wow, this is a fascinating idea! It is a direction I would never have considered. Must think abouit thiis.

50%
50%
BitBucket
BitBucket
2/23/2013 7:53:50 PM
User Rank
Blogger
Sig Analysis
Signature analysis is a very helpful technique for debugging hardware. I ahve used it a few times with great success. You can break all the hardware 'loops' (in my case all I needed to do was gate off the Program Counter from 'jumping' and it would just count sequentially thru the microcode. I could put a probe on any input or output of a device and since the signature of a working node was known it was easy to find any errors.

I think extending this to software is a great idea. In particular if the 'calling sequence' can be retained it would hopefully make it much easier to see where the error started. Maybe a runaway pointer in a calling routine trashed some data that the called routine needed. Now you can trace back to see which routine was the one that messed things up.

100%
0%
raimond
raimond
2/23/2013 1:07:40 PM
User Rank
Word wizard
Re: Home Brewn
The "classic" cooperative multitasking is very much the same like the preemptive multitasking, with the single difference that it is ...  not preemptive. Every task is responsible to yield itself and let the other tasks run. No task can interrupt other tasks. Only interrupts interrupt tasks. This is exactly like "no rtos" systems, only that the main program is organized as a cooperative multitasking.

Personally I'm not a fan of preemptive rtoses. I think it's just insane to transform every single task in an interrupt. A very hard to control (and program) system where almost every task can interrupt any task. That's why those rtoses need complex services like semaphores, message queues and the like. You need to protect every single shared variable, or need to use a semaphore or queue instead of just a bit or byte variable. 

I was forced some time ago to develop an uC/OS-II system. The hardware was not "friendly" either, having lots of multiplexed GPIO pins for many devices on board. It was just a nightmare, the firmware became full of rtos function calls, it was like somebody punished me to use the rtos :D I was almost 90% of the time focused on how to solve rtos integration with the application instead of the application itself.

My conclusion is: the preemptive rtoses are good bussines for their creators, they make the users captive.

50%
50%
Davidmicro
Davidmicro
2/23/2013 12:13:38 PM
User Rank
Program Manager
Re: Home Brewn
->The problem is that we have no check yet that the interrupts are actually running. In almost every project I have worked with the timer interrupt is asyncrconous with the round robin tasks and so using it to clock the CRC register to get predictable results makes it difficcult for me to see how it can be implemented,

Timer Control Register, Timer Flag Register can be monitored to see the status. Secondly, architecture of each MCU describes the timer interrupt process in detail. It sound like the project that you worked uses the customized RTOS.

50%
50%
antedeluvian
antedeluvian
2/23/2013 11:18:02 AM
User Rank
Blogger
Re: Home Brewn
jk

Although you could probably implement this as external hardware, it wasn't my intention. What I am aiming at is to do is to be so sure of the operation of the mircocontroller that a simple watchdog is sufficient.

JK & Curt

It appears that I hadn't made my description clear enough. Lety me try and clarify. Let us assume a simple device that measures an analog input, displays the value on an external LCD and also generates a serial output on a UART. The software can be broken up into several tasks. 1. Measure elapsed time; 2. A/D conversion; 3. display driver; 4. UART driver; 5. Housekeeping. There is of course the interrupts, but let's ignore that for the moment.

In a simple system I employ a kind of home grown round-robin approach where each task is executed in sequence. You could use a timer as part of the interrupts that ensures that each task has an equal amount of time. Another approach, which I believe is called cooperative multitasking, breaks each task into sub tasks, and controll is passed top the next task when the executing task is ready and the time spent in one task is determined by how the programmer has subdiviced it.

What I am proposing would work in either case. If the mirco goes "nuts" execution of the code can jump anywhere and so what we are trying to detect is when the tasks are not executed in sequence. At the starty of every task would be a small software routine that shifted the CRC register. Part of the housekeeping task is to ensure that the CRC is the value that is intended.

The problem is that we have no check yet that the interrupts are actually running. In almost every project I have worked with the timer interrupt is asyncrconous with the round robin tasks and so using it to clock the CRC register to get predictable results makes it difficcult for me to see how it can be implemented, but it seems to be possible since this is what windowed watchdogs do. This is kind of where I was looking for suggestions.

 

50%
50%
jkvasan
jkvasan
2/22/2013 11:37:48 PM
User Rank
Blogger
Home Brewn
AD,

At the first sight, this idea looks like a home brewn external watchdog. However, as always simple things are interesting and can come handy. This idea is novel for me as this watchdog, as I understand, is purely hardware and is independent of what happens inside the mcu. 

However, same questions that CC asked linger in my mind too. I am sure we are up for an interesting discussion as we develop this idea.

50%
50%
Curt Carpenter
Curt Carpenter
2/22/2013 10:05:41 PM
User Rank
Blogger
The Devil is in the Details
I think it's an interesting idea and worth exploring.  Three questions that spring to mind on a first reading are a) what agent reads the shift register? b) When? and c) what are the underlying assumptions that have to be made about tasks and valid task execution paths?

I'll have to think about this some more tomorrow, and will watch the discussion here with interest.

 

 

50%
50%
More Blogs from Aubrey Kagan
In part two of a four-part series on temperature sensing, Aubrey talks about getting the sensor's signal into the MCU.
First in a four-part series, Aubrey's blog sets the stage for talking about temperature measurement.
Aubrey tells a tale of customer service gone bad.
Aubrey Kagan reflects on his favorite ICs and how advancing technology has upstaged them.
Just when he thought he had things settled, Android held another surprise for Aubrey's project.
flash poll
MC on twitter
like us on facebook
Microcontroller Central    About Us     Contact Us     Help     Register     Twitter     Facebook     RSS