Go Down

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

smeezekitty

Isn't it possible to minimize the footprint of this core even more? a "blank" sketch (empty setup() and loop() ) takes up 172 bytes. Thats 17% of the memory without doing anything!
172 bytes isn't a lot. The memory on the Tiny13 is just very small.
It might be possible with an optimized rewrite in assembly. But in C while remaining Arduino compatible, I doubt it.

Quote
Wouldn't it be possible to instead have to start things like millis and micros manually, using #define? This would make this core a little more "manual", but the footprint would be much smaller.
For fixed delays. For variable delays, probably not.
Quote
(This core should also be hosted on Github rather than SourceForge, for obvious reasons)
To be quite honest, they are both bad
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!

bartgee

Arduino IDE 1.6.4
USBasp programmer
Got my ATtiny13A working with your changes, aleksey_ua. Great job! Before I could even burn the bootloder, I had to set proper fuse bits with:

avrdude -p attiny13 -P usb -c usbasp -b 9600 -q -U lfuse:w:0x7a:m -U hfuse:w:0xff:m

If you don't mind - I've just put your changes to my github repo:
https://github.com/bartgee/at13
with a note, that these changes were made by you.

glassgiant

I'm having some trouble with core13, using in internal pullup resistor.  I have a led/resistor on pin 6 (PB1) which fades in and out.  I want to ground pin 5 (PB0) to toggle fast/slow fading, but it doesn't seem to be working with an attiny13a.  In the following code, the LED flashes fast when pin 5 is open.  When pin 5 is grounded, the LED does not light at all.  I see your INPUT_PULLUP workaround, and think I'm accounting for it in the code below.  For the life of me, I can't see the problem.  Any ideas?

int led = 1;           // the pin that the LED is attached to
int tswitch = 0;       // user selectable switch
int brightness = 0;    // how bright the LED is
int fadeAmount = 1;    // how many points to fade the LED by
int dtime = 100;

void setup() {
  pinMode(led, OUTPUT);
  pinMode(tswitch, INPUT);
  digitalWrite(tswitch, 1);
}

void loop() {
  if (digitalRead(tswitch)) {
    dtime = 10;
  } else {
    dtime = 100;
  }
  // set the brightness
  analogWrite(led, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }
  // wait to see the dimming effect
  delay(dtime);
}

uxomm

This sketch works on my setup with ATtiny13a.
You should check your hardware.

By the way: the changes are  v e r y  slow when the button is pressed, so i have changed the dtimes to
Code: [Select]

if (digitalRead(tswitch)) {
    dtime = 1;     // original: 10
  } else {
    dtime = 10;   // original: 100
  }

so you can see the changes (button not pressed / button pressed) much better.
Always decouple electronic circuitry.

mcnobby

Hi SmeezeKitty,
I'm just about to test my ATTiny13a hardware for some software I have written, I am using 1.6.3 and the code is written in assembler within a main() loop. Hopefully all will go well and I can report back soonish
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

smeezekitty

Hi SmeezeKitty,
I'm just about to test my ATTiny13a hardware for some software I have written, I am using 1.6.3 and the code is written in assembler within a main() loop. Hopefully all will go well and I can report back soonish
Any news?
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!

mcnobby

Hi SK, no news as yet, I was having a bit of trouble with a few things in 1.6.3/t13 combination, so I ended up using an older stable IDE

I WILL be getting back to this as I have projects that need attention

Thanks, as always :)
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

hansibull

What seems to be the problem with IDE 1.6? Per1234 helped me out porting my Arduino cores over to 1.6, so I (or him) might be able to help you out ;)
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

hansibull

I had some spare time, and created a fork of this core, called MicroCore. I've added some additional core settings where changes can be done to reduce the flash usage.

The code compiles just fine, and I'm able to set fuses and upload the sketch to the microcontroller. Stil I'm having some weird issues. I've tried other forks that works out of the box as well, and they got the same issues as well. I'm running Arduino IDE 1.6.9, but I've also tried with the older 1.6.5 as well.

Have a look at the AVR code:

Code: [Select]

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

int main(void)
{
  DDRB |= _BV(PB2);
 
  while(1)
  {
    PORTB ^= _BV(PB2);
  }
}


PB2 is set as an output, and will toggle every time the while loop runs. Easy right? I'm running this at 9.6MHz, even though I can reproduce this problem on all clock frequencies.

After uploading the code this is what the screen on my scope says:
(open in new window for higher resolution)






The _really fast_ square wave runs for about 16.4 ms, with a period of about 82.8 ms. Here's a picture of the square wave itself (ignore the long  yellow line, the signal is hard to trigger):



.. And this is a picture of my setup:



How is this even possible? The low level code should work just fine, shouldn't it?  :(  Have you experienced this before smeezekitty?
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

swe-dude

I have used this core a lot with low level stuff with no problem so i tried your code with your MicroCore and with this core. No problem with either no pauses at all.(9.6mhz no bod)

I ran it on breadboard with only power and salea clone connected.

On the picture you have the programmer plugged in can that cause this??


hansibull

Oh this is embarrassing! :smiley-confuse: I unplugged the programmer, and everything works just fine! I was using an avrispmkII when I took the pictures. The USBtinyISP does not interfere like that :)

I've not been able to get the other ones put there running without having to do some modifications, so I decided to create my own fork :)
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

swe-dude

hehe soo easy to mess up like that i have done something similar that is why i thought of it....

Good luck with the core, Make a post when its time for testing and i will give it a test spin.

caiopoit

What is the current final version of the aTTiny13 core today? Can I use on ide 1.0.5 r2 ? Where can I download it? I have tried so many cores by now... None of them worked properly (usually clock and timer problems). I'd be very glad if anyone could help. Thanks.

hansibull

I just did a large rewrite, but it works only with Arduino 1.6+, thus without having to do any modifications to make it work :) ---> MicroCore - Github
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

caiopoit

I did all as this tutorial says (https://github.com/MCUdude/MicroCore#supported-clock-frequencies) even burned the bootloader but it doesn't blink at the defined time...

Go Up