Go Down

Topic: core13: An Arduino core for the Attiny13 *testers wanted* (Read 50266 times) previous topic - next topic

smeezekitty

The problem is the servo library uses hardware specific code and thus non-portable.
It would need to be rewritten for the Attiny13 specifically.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Erni

#181
Jul 22, 2013, 04:44 pm Last Edit: Jul 22, 2013, 04:47 pm by Erni Reason: 1
I just found this servo example on Avrfreaks.net.

ATTiny13 @ 9,6MHz

Drawbacks: only 100 steps, and only one servo


Code: [Select]

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

//http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=74861&start=0
volatile unsigned int Tick;   // 100KHz pulse
volatile unsigned int sPulse;   // Servo pulse variable
volatile unsigned int Tick_20ms;   // Servo frame variable

void setup() {  

 OSCCAL=0x68;
 pinMode(4,OUTPUT);
 pinMode(3,INPUT);
 cli();
 TCNT0 = 0;
 TCCR0A=0;
 TCCR0B=0;

 TCCR0A |= (1<<WGM01); // Configure timer 1 for CTC mode
 TIMSK0 |= (1<<OCIE0A); // Enable CTC interrupt
 TCCR0B |= (1<<CS00); // No prescaler
 OCR0A = 95; // Set CTC compare value
 sei(); //  Enable global interrupts
 Tick = 0;
 sPulse = 100;
 Tick_20ms = 0;
}


void loop()
{
 //int val=analogRead(3); //use potmeter on PB3
 //sPulse=50+(val/10);

 for(int x=50;x<150;x++){

   sPulse=x;
   _delay_ms( 5 );
 }

 for(int x=149;x>=50;x--){

   sPulse=x;
   _delay_ms( 5 );
 }


}



ISR(TIM0_COMPA_vect)   // 100 KHz interrupt frequency
{
 if(Tick >= 2000)   // One servo frame (20ms) completed
 {
   Tick = 0;
   Tick_20ms = Tick_20ms + 1;
 }

 Tick = Tick + 1;
 if(Tick <= sPulse)   // Generate servo pulse
 {
   PORTB |= (1<<PB4);   // Servo pulse high
 }
 else
 {
   PORTB &= ~(1<<PB4);   // Servo pulse low
 }
}




jeka_tm

#183
Sep 06, 2013, 08:18 pm Last Edit: Sep 06, 2013, 08:20 pm by jeka_tm Reason: 1
when there will be 019 version? required internal voltage reference
also tested people with ARDUINO.RU. Analog input only works on RB3 pin attiny13. maybe we're doing something wrong?

sparkylabs

my IDE does not pick up on the new board configs, I down loaded from sourceforge.
My shop: www.sparkylabs.co.uk/shop

smeezekitty

Quote

when there will be 019 version? required internal voltage reference
also tested people with ARDUINO.RU. Analog input only works on RB3 pin attiny13. maybe we're doing something wrong?

Internal voltage reference should already work.
I will try to debug the analog input soon. It is one of the hardest part to work on.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

smeezekitty


my IDE does not pick up on the new board configs, I down loaded from sourceforge.
http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

sparkylabs

uh how complicated. can't i just download the core and put it in the hardware folder like any other ? or does it need extra files.
My shop: www.sparkylabs.co.uk/shop

smeezekitty


uh how complicated. can't i just download the core and put it in the hardware folder like any other ? or does it need extra files.

I know. The arduino boards.txt are horrendous. But that's how it works.
I have alot of trouble with it myself
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

reginr

BUMP:

I am trying to upload using USBISP.

A little help please.  Many thanks

Code: [Select]

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/regin_rodriguez/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         AVR Part                      : ATtiny13
         Chip Erase delay              : 4000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no         64    4      0  4000  4000 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6    32    0 yes      1024   32     32  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9007
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "/var/folders/98/98SOfbC9HsmpXuuVf9fn0E+++TI/-Tmp-/build3124297909485718164.tmp/BlinkATtiny13.cpp.hex"
avrdude: writing flash (378 bytes):

Writing | ################################################## | 100% 0.19s

avrdude: 378 bytes of flash written
avrdude: verifying flash memory against /var/folders/98/98SOfbC9HsmpXuuVf9fn0E+++TI/-Tmp-/build3124297909485718164.tmp/BlinkATtiny13.cpp.hex:
avrdude: load data flash data from input file /var/folders/98/98SOfbC9HsmpXuuVf9fn0E+++TI/-Tmp-/build3124297909485718164.tmp/BlinkATtiny13.cpp.hex:
avrdude: input file /var/folders/98/98SOfbC9HsmpXuuVf9fn0E+++TI/-Tmp-/build3124297909485718164.tmp/BlinkATtiny13.cpp.hex contains 378 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.12s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x09 != 0x00
avrdude: verification error; content mismatch

avrdude done.  Thank you.

smeezekitty

This usually comes down to a few problems:

* Wiring problem such as short circuit or target device not powered
* SPI clock too fast
* Wires are too long between the programmer and device
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

reginr

smeezekitty,

Thanks for the response, I really appreciate it.  I think I can verify the first and the third one you said. But I don't know how to slowdown the spi clock if that is the case.

I am using one of the cheap USBISP programmer from China.
http://www.ebay.com/itm/130682846209?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
It works OK with my arduino pro mini 3.3v

Again any additional advise about the spi clock is apprciated!




smeezekitty

avrdude: warning: cannot set sck period. please check for usbasp firmware update.


That's not good. Looks like it does not support software SCK changes.

Does your programmer happen to have a jumper anywhere on it?
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

reginr

smeezekitty,

Thanks again from your support!
To answer you question. There is a place to solder a jumper but after comparing it with the opensource schematic and actual connection on the PCB I think it is not the Slow SCK settings.

I diverted to an old Arduino Diecimila with atmega328p Installed

and upload worked like a charm! Many thanks again for sharing your library!!!

Greetings from Japan!

smeezekitty


smeezekitty,

Thanks again from your support!
To answer you question. There is a place to solder a jumper but after comparing it with the opensource schematic and actual connection on the PCB I think it is not the Slow SCK settings.

I diverted to an old Arduino Diecimila with atmega328p Installed

and upload worked like a charm! Many thanks again for sharing your library!!!

Greetings from Japan!


You might try to see if there happens to be a firmware update.
I was considering buying one of those programmers but if it does not support software SCK that is kind of a let down.

Good luck from across the pacific
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Go Up