Pages: 1 2 [3]   Go Down
Author Topic: New ATTiny Part (ATTiny841)  (Read 12570 times)
0 Members and 1 Guest are viewing this topic.
Centennial, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 35
It should work...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I have 4 available at the moment. I'll build more. I've enabled backorders in case I run out.

https://www.tindie.com/products/bot_thoughts/eezeetiny841/



Thanks!
Michael
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi bot-thoughts,

Can I use your eezeetiny841 with arduino software somehow? Or is it AVR-c only?
Logged

Centennial, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 35
It should work...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been investigating Arduino for ATtiny841.

Two problems

1. Modify arduino-tiny to support the ATtiny841.

I worked on this last night and got much of it done but will have to test.

2. Modify the Arduino IDE itself to use a newer gcc toolchain supporting attiny841.

I fiddled with this and got all the compile stuff working, but not linking. That's just by hacking on the 1.0.5 IDE, replacing the 4.3.2 avr-gcc toolchain files with Atmel's version that supports the chip.

I think a more productive route will be to git clone the Arduino IDE, do some web research, and try to understand how the IDE "knows where to look" for the toolchain bits. They're all in semi-odd locations versus the stock avr-gcc install.

I wouldn't turn down any help  smiley-lol

With all the peripherals and capabilities of this chip, it would be awesome to Arduino-enable it.
Logged


Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13072
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

2. Modify the Arduino IDE itself to use a newer gcc toolchain supporting attiny841.

Why?  Just replace the old toolset with the new.
Logged

Centennial, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 35
It should work...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why?  Just replace the old toolset with the new.

Erm... that's exactly what I'm doing... I even said so smiley-lol

Quote from: bot_thoughts
... replacing the 4.3.2 avr-gcc toolchain files with Atmel's version that supports the chip.

I see where the confusion originated. Arduino, of course, comes with the toolchain, so I was using the term "Arduino IDE" to refer to all the crap you get when you install Arduino... java app (processing), toolchain, etc.

I wished it was a simple matter of tar zxvf but instead, the directory structure for Arduino avr-gcc (on Linux, at least) and a standard avr-gcc install aren't the same. For example, libexec is where cc1, cc1plus, and collect2 live in a standard avr-gcc. Well, they live in lib within hardware/tools/avr/lib/ within Arduino (1.0.5 is what I happen to be working with).

Also, avr-g++, avr-gcc, and avr-cpp are scripts that call files out of hardware/tools/avr/bin.gcc so that LD_LIBRARY_PATH can be set.  Considerably more pain comes with the lib directories. You've got to find and deal with libgmp, libmpfr in different spots, libgcc, libgcov, in different spots, startup object code in different spots, and on and on. And then there's linker scripts in one place versus another, etc. I got to the point of linking, and had to quit last night.

If only I'd had a chance to poke around inside gcc more in the last 25 years. smiley-sad  It's always just been ./configure  && make install and it's done after awhile (actually it was more painful and the compile took ages longer back in the day on old Dynix/PTX systems, Solaris 2.x, or even the club's salvaged VAX-11/750 running 4.3BSD... but I digress).
« Last Edit: September 17, 2014, 04:32:08 pm by bot-thoughts » Logged


Münsterland
Online Online
Faraday Member
**
Karma: 51
Posts: 2955
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I ordered 100 peace of ATtiny841 a few days ago.

Does anybody try uart0? uart1 works fine.

Greets Stefan


EDIT: Problem solved. I choose the incorrect Pins. UART0 is available on PORTA & B!

Code:
// tiny841_uart_test.c
// ----------------
//  Created: 19.09.2014
//   Author: sschultewolter
// Hardware: ATtiny841 5V 8MHz(internal Oscillator)

#include <avr/io.h>
#include <avr/interrupt.h>

// UART0
#define UART0_BAUD 9600UL
#define UART0_UBRR_VAL ((F_CPU+UART0_BAUD*8)/(UART0_BAUD*16)-1)
#define UART0_BAUD_REAL (F_CPU/(16*(UART0_UBRR_VAL+1)))
#define UART0_BAUD_ERROR ((UART0_BAUD_REAL*1000)/UART0_BAUD)

#if ((UART0_BAUD_ERROR<990) || (UART0_BAUD_ERROR>1010))
#error UART0_BAUD_ERROR > 1%
#endif

void uart0_init(void)
{
UBRR0 = UART0_UBRR_VAL;
UCSR0B |= (1 << TXEN0);
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);
}

int uart0_putc(uint8_t c)
{
while(!(UCSR0A & (1<<UDRE0))) { }
UDR0 = c;
return 0;
}

void uart0_puts (char *s)
{
while (*s)
{
uart0_putc(*s);
s++;
}
}

// UART1
#define UART1_BAUD 9600UL
#define UART1_UBRR_VAL ((F_CPU+UART1_BAUD*8)/(UART1_BAUD*16)-1)
#define UART1_BAUD_REAL (F_CPU/(16*(UART1_UBRR_VAL+1)))
#define UART1_BAUD_ERROR ((UART1_BAUD_REAL*1000)/UART1_BAUD)

#if ((UART1_BAUD_ERROR<990) || (UART1_BAUD_ERROR>1010))
#error UART0_BAUD_ERROR > 1%
#endif

void uart1_init(void)
{
UBRR1 = UART1_UBRR_VAL;
UCSR1B |= (1 << TXEN1);
UCSR1C = (1 << UCSZ11) | (1 << UCSZ10);
}

int uart1_putc(uint8_t c)
{
while(!(UCSR1A & (1<<UDRE1))) { }
UDR1 = c;
return 0;
}

void uart1_puts (char *s)
{
while (*s)
{
uart1_putc(*s);
s++;
}
}


volatile uint32_t millis;

ISR(TIMER0_COMPA_vect)
{
millis++;
}


int main(void)
{
// UART
uart0_init();
uart1_init();

// millis
TCCR0A = (1 << WGM01); // CTC Mode
TCCR0B |= (1 << CS01) | (1 << CS00); // Prescaler 64
OCR0A = 124; // (F_CPU/PRESCALER)/1000-1
TIMSK0 |= (1 << OCIE0A); // Compare Interrupt
sei();

while(1)
{
static uint16_t last_second;
uint16_t second = millis / 1000;
if(second != last_second)
{
last_second = second;

char str[10];
itoa(second, str, 10);

uart0_puts("\n\r");
uart0_puts("UART0 >> ");
uart0_puts(str);

uart1_puts("\n\r");
uart1_puts("UART1 >> ");

uart1_puts(str);
}
}
}
« Last Edit: September 19, 2014, 09:05:58 am by sschultewolter » Logged

Gruß Stefan

Keine Code-Anfrage über die Persönlichen Nachrichten.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great! looking forwards to testing your new core out bot-thoughts   smiley-grin

Logged

Pages: 1 2 [3]   Go Up
Jump to: