ATTiny2313/4313 Flowcode development board

Use this section to discuss your embedded Flowcode projects.
mnfisher
Valued Contributor
Posts: 2028
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 160 times
Been thanked: 948 times

Re: ATTiny2313/4313 Flowcode development board

Post 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

mnfisher
Valued Contributor
Posts: 2028
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 160 times
Been thanked: 948 times

Re: ATTiny2313/4313 Flowcode development board

Post 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

BenR
Matrix Staff
Posts: 2214
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 608 times
Been thanked: 804 times

Re: ATTiny2313/4313 Flowcode development board

Post 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.

Post Reply