Go Down

Topic: New ATTiny Part (ATTiny841) (Read 32896 times) previous topic - next topic

bot-thoughts

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
http://www.bot-thoughts.com/

dnhkng

Hi bot-thoughts,

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

bot-thoughts

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  XD

With all the peripherals and capabilities of this chip, it would be awesome to Arduino-enable it.
http://www.bot-thoughts.com/

Coding Badly

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


Why?  Just replace the old toolset with the new.

bot-thoughts

#34
Sep 17, 2014, 11:25 pm Last Edit: Sep 17, 2014, 11:32 pm by bot-thoughts Reason: 1
Why?  Just replace the old toolset with the new.


Erm... that's exactly what I'm doing... I even said so XD

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. :(  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).
http://www.bot-thoughts.com/

sschultewolter

#35
Sep 19, 2014, 05:29 am Last Edit: Sep 19, 2014, 04:05 pm by sschultewolter Reason: 1
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: [Select]

// 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);
}
}
}
Orginal Atmel AVRISP mkII zu verkaufen. Anfrage per PN ;)

dnhkng

Great! looking forwards to testing your new core out bot-thoughts   :D


chrizztus

Hi,
did somebody try using uart0, uart1 and i2c at the same time?
I'm afraid it won't work because SCL and RX1 are using the same pin  :-\
greetings
Chris

daveyjones

I have looked at specs, but the obvious differences ellude me... What is the main differences between the 841 and 1634?  I see pre-made breakouts for 841, but not for 1634.

westfw

the 1634 has more pins and a wider package.  DrAzzy has breakout boards for both: http://drazzy.com/e/tiny841.shtml


Go Up