Page 1 of 1

CompilerError UART-Interrupt solved (AVR)

Posted: Wed May 29, 2013 4:19 pm
by Niro
Hi all,

there's a compiler error using 'RXINT0' in FC V5 AVR.
If you want to use this interrupt you have to build it with the custom option, the already inlcuded 'RXINT0' does not work because of the
wrong handler-code:
ISR(USART0_RX_vect)
{
FCM_ISR_UART();
}

The right code need to be:
ISR(USART_RX_vect)
{
FCM_ISR_UART();
}

So you need to simply build your custom Interrupt:
Enable Code:
sei();
UCSR0B |= (1 << RXCIE0);

Handler Code:

//Handler code for [RXINT]
#ifndef MX_UART0_RX_HANDLER
#define MX_UART0_RX_HANDLER
ISR(USART_RX_vect)
{
FCM_ISR_UART();
}
#else
#warning The <UART0 RX> interrupt has previously been enabled, so the macro <ISR_UART> may never get called.
#endif

Now assign it to the requird ISR (macro) and than it will work.

Maybe this hopefully will get fixed with the next update.

Have fun,
Niro


PS: this solution is related to my former post 'Problem with UART, porting V4 to V5' http://wwww.matrixmultimedia.com/mmforu ... 46&t=12170

Re: CompilerError UART-Interrupt solved (AVR)

Posted: Wed May 29, 2013 4:48 pm
by Benj
Hi Niro,

Thanks for the workaround. Do you know what device(s) this problem effects and I will fix the FCD files? I did recently provide a load of FCD fixes for this very issue so I will attach them here (ATMEGA48, 88, 168, 328).
AVR_FCD_Mods.zip
(11.34 KiB) Downloaded 396 times
Plus if we don't head off the issue now then it is likely to continue on into the v6 code.

Re: CompilerError UART-Interrupt solved (AVR)

Posted: Wed May 29, 2013 7:20 pm
by Niro
Hi Ben,

mainly I'm using the attached AVR-types you correctd. Actually a QFP version of the ATMEGA328. It has different I/O pinout and additional ADC ports compared to the 328.
Thererfore I modified the ATMEGA328 FCD-file.
Attached you'll find the version with the corrected UART-interrupt.

regards,
Niro