Page 3 of 3

Re: ATTiny2313/4313 Flowcode development board

Posted: Wed Jun 03, 2026 9:18 pm
by mnfisher
I mentioned that UART doesn't compile in hardware mode.

Looking at the CAL file - I wasn't sure why:

Code: Select all

#ifndef MX_XMEGA   // It's not an XMEGA
 #ifndef UDR0  // Not defined - compilation fails
    #ifdef UDR
  		#define UDR0	UDR
// UDR is defined...

As a 'crude' fix I added before this block:

#define UDR0 UDR

And the code compiles (and runs) correctly - I did the usual "hello world" and this is correctly sent.

I'm not sure why the current CAL code doesn't work though - and my 'fix' will surely break things for other AVR MCUs?

Martin

Re: ATTiny2313/4313 Flowcode development board

Posted: Wed Jun 03, 2026 10:04 pm
by mnfisher
Looking at the fcdx files - an XMEGA device has:
</device>

<inline>

<defines code="#define MX_XMEGA\n\n#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;math.h&gt;\n#include &lt;avr\io.h&gt;\n#include &lt;avr\interrupt.h&gt;\n#include &lt;avr\eeprom.h&gt;\n#include &lt;avr\wdt.h&gt;\n\n" />
Whereas the ATTINY has:
</device>

<inline>

<defines code="#define MX_USI\n\n#define MX_UART_UCSRC\n\n#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;math.h&gt;\n#include &lt;avr\io.h&gt;\n#include &lt;avr\interrupt.h&gt;\n#include &lt;avr\eeprom.h&gt;\n#include &lt;avr\wdt.h&gt;\n\n" />
Should this define MX_ATTINY (or somesuch?)

But - doesn't explain why the #ifndef MX_XMEGA doesn't set a value for UDR0

Martin

Re: ATTiny2313/4313 Flowcode development board

Posted: Thu Jun 04, 2026 9:55 am
by BenR
Thanks Martin, I'll see if I can make any headway on this. As you say strange it isn't just working? Also very glad you have a workaround for now.

The XMEGA have a totally different way of doing things to the other AVR devices which is why they have their own define. The ATMEGA and ATTINY are both fairly similar. The MX_USI define declares a certain type of UART and I'll start by checking this define is correct.