[SOLVED] Problems on ATMEGA32/16MHz
Posted: Tue Jun 02, 2009 10:37 pm
Hi,
I am still working on my HTPC controller using an ATMEGA32, Graphical LCD, IR decoding ans USB (HID-Device) along with decoding some switches and two rotary encoders. All works well except for the USB port crashing from time to time. A lot of experiments seem to indicate that usbPoll() is under some circumstances not called often enough. This seems to crash the usb stack. Most of the time only disconnecting and rebooting the controller helps. It still works but the USB connection is down.
What can I do to make this more stable? Ist there a way to avoid these crashes by using an other type of device or extending timeouts? I cannot guarantee that usbPoll is called at least once in 50 ms since some of the GLC routines and also rc5 decoding take a lot of cpu.
Thanks in advance,
Micha
UPDATES:
I recoded the rc5 to polling only, not using any other interrupt pins. USB wont work stable, if I have timer0 (or timer1/2) on 16MHz with prescaler 1024 and only very few code lines. If I leave the overflow of that timer empty, everythin ist fine. I need to go that high frequency since rc5 has pulse times of aprox. 1.8ms.
I am still working on my HTPC controller using an ATMEGA32, Graphical LCD, IR decoding ans USB (HID-Device) along with decoding some switches and two rotary encoders. All works well except for the USB port crashing from time to time. A lot of experiments seem to indicate that usbPoll() is under some circumstances not called often enough. This seems to crash the usb stack. Most of the time only disconnecting and rebooting the controller helps. It still works but the USB connection is down.
What can I do to make this more stable? Ist there a way to avoid these crashes by using an other type of device or extending timeouts? I cannot guarantee that usbPoll is called at least once in 50 ms since some of the GLC routines and also rc5 decoding take a lot of cpu.
Thanks in advance,
Micha
UPDATES:
I recoded the rc5 to polling only, not using any other interrupt pins. USB wont work stable, if I have timer0 (or timer1/2) on 16MHz with prescaler 1024 and only very few code lines. If I leave the overflow of that timer empty, everythin ist fine. I need to go that high frequency since rc5 has pulse times of aprox. 1.8ms.