I'm currently trying to get a mega16 to act as a bridge between USB and USART. Everything works fine, as long as I don't enable the USART Data Register Empty Interrupt (USART_UDRE_vect). As soon as I enable it the uC hangs and after a short period does a watchdog-reset, *but only* if the interrupt is declared as UTIL_INTERRUPT.
Code: Select all
#define UTIL_INTERRUPT(signame) \
void signame (void) __attribute__ ((interrupt)); \
void signame (void)
Declaring the interrupt the avrlibc-way ( ISR(USART_UDRE_vect) ) does work though. The assembler listing only differs in the sei() instruction appearing at the beginning of the vector in the UTIL_INTERRUPT-version.
Testing by sending a few bytes over USB to the device which puts those bytes in a new buffer and enables the UDRE_vect. The vector itself only disables itself again (for debugging purposes ... should do the sending of the data later on). Don't see any reason why it should reset when actually reactivating the interrupts and not when keeping them disabled
Any hints?
uC-Code (USB-stuff in main.c -> usbFunctionWrite() and main() -> close to the end, USART stuff in usart.c/h)
Java app
Java lib
LibUsbJava
Regards,
Chris