Encoder Death

We installed Kevin’s encoder routines per the nine-step encoder.txt file directly into the 2007 default code base.

It all seems to work great with one exception:

20 seconds after power up the processor goes belly up (red blinking light of death + disable light).

Pressing reset fixes it and we are on our way.

Any ideas what is going on?

We have started completely over 3 times with different folks doing the 9 steps just to make sure we didn’t miss anything. Still death after about 20 seconds.

Removing the Encoder code fixes the problem.

Any ideas? I’m stumped…

Question: Does everything work properly in the 20 seconds before everything goes belly up? If everything’s working, it would be odd for the watchdog timer to time out like that.

Which encoder are you using and how many?

What else is in your code? camera? gyros?

What code modifications have you made?

Does it work with the default encoder code?

You might be overloading the processor, and there might be a way to fix that.

Probably a problem with the interrupts. Can you post your workspace in .zip form?

Hi Guys,

We have literally taken the 2007 default code, added Kevin’s encoder code per the instructions.

That’s it - nothing else has been added and we still see the fault.

Wheels are still the entire time (they have the Banebots encoders on them) we don’t touch anything on the OI.

Everything works fine before the fault.

Everything works fine if we reset the fault by pressing the pushbutton.

I have another processor - I think I’ll try the software on that.
I’ll also try removing all wires and see if the problem persists.

It’s as if a watchdog timeout is wrong, and it has more time to timeout after powerup than other times so it fails.

Weird …

What happens if you just upload the pre-built .hex file included in frc_encoder.zip?


Crud … why didn’t I think of that …

Just tried it - That file works fine - which means it is not a hardware issue - it is a code issue.

Time to go through line by line and comapre the two …

The odd thing is, the death issue only occurs if the modem is plugged in. It’s like the OI says “I haven’t heard from you in a while so I’m shutting you down.”

Yet if we reset everything works fine.

Sounds like a problem with the interrupt handler in user_routines_fast.c I had some similar problems in previous years, and it was because I had problems with my handler. Make sure to carefully read all of the information in those lovely help files that Kevin includes with his code. I just recently found a perpetual bug by reading Kevin’s documentation carefully.

Good Luck!


The kids incorporated the encoder code, but didn’t incorporate the non-blocking serial code.

That would probably be ok, except they blindly copied the user_routines_fast over which confused everything and didn’t take into account the old serial driver.

We simply added the non-blocking serial port code, commented out the serial call back at the bottom of the user_routine_fast and everything is working now.

Thanks to everyone for your help (and special thanks to Kevin for his wonderful frc code base!)