Servo timer corruption?

Hi,

I've been working on a project that uses the servo.h library. Everything was working ok, but the project has recently stopped working (i.e. the servo won't move.) I have worked with servos a lot in the past, so am reasonably confident that I've avoided most of the most basic issues.

The hardware (arduino pro mini and futaba servo) seem to be working correctly - I can upload some of my earlier servo projects and everything works fine. My code all compiles and uploads as expected, and I know that servo.writeMicroseconds() function is being executed with the correct values, the problem is that the servo just won't move.

Here's my theory (and my question to the forum). I know that the servo.h library uses one of the timers, and I know that these timers require the use of registers. Are these registers part of 'normal' dynamic memory, or are they in some way protected? Can they be corrupted like normal memory can be?

My current best guess is that somewhere in my code I have managed to corrupt one or more of the registers that the servo.h timer uses. (I have never knowingly changed any of the registers). If my theory is plausible, is there any way of checking it?

Thanks

The most common cause of a timer problem is two libraries using the same timer. Did you add any libraries about the time your servo stopped moving?

With out code who can tell!

Mark

PS the AVRs do NOT have any "dynamic memory".

Mark

Fulliautomatix: Everything was working ok, but the project has recently stopped working (i.e. the servo won't move.)

That sounds like you changed something. What did you change?

As you have not posted your code it is impossible to guess what the solution might be.

...R

A lose wire or power supply issue is often suspect when something works and then later doesn't work when one thinks nothing has changed.

Thanks for the contributions guys.

Did you add any libraries about the time your servo stopped moving?

No, just the servo library and my own code - and my own code doesn't directly use any timers.

you have not posted your code

True, but I wan't asking anyone to debug anything for me, I was asking if the timer registers are 'protected' in any way, or is it possible to corrupt them like other objects in memory.

PS the AVRs do NOT have any "dynamic memory".

ok, maybe I got the terminology wrong, what do you call the memory that can be changed as the programs run? RAM? SRAM? Dynamic RAM? volatile?

I have fixed the issue, it appears it is possible to corrupt timer registers. I was squeezing an unsigned long into a byte, I guess it must have overflowed into one of the timer control registers.

Thanks

I was squeezing an unsigned long into a byte, I guess it must have overflowed into I was squeezing an unsigned long into a byte, I guess it must have overflowed into one of the timer control registers…

I am glad that you fixed it but your explanation of the problem sounds wrong. Trampling on memory that you don’t own, yes, but corrupting one of the timer control registers, not so likely.

If only you had posted your code…