Go Down

Topic: attiny 85, any pointers?/ (Read 22596 times) previous topic - next topic

wanderson


Lol good one, and I meant mention attiny 85 not the series in broad which I don't like to assume it works as is for everything since I imagine everything from the 28pin ic to the 6pin doesn't have the same machine code


The actual machine code might be different but it isn't that likely since the AVR core was probably only implemented once.  But you aren't talking machine code but a higher level abstraction in this case C/C++ (but it could even be assembly) and the same code could compile to different machine instructions.  What might actually change between processors is the memory location of registers and such.


So if I make a library called spi85 that basically includes that code, then change the mirf library to use the spi85 instead of regular spi, it should work right? I know size of the library may cause problems but I think I can handle that


As long as the library you create implements external methods needed by the mirf library and can handle the clock frequencies that the mirf library/chips need then it should work.  I wouldn't focus on the example provided as a "go by", but rather use it in conjunction with the datasheets for the 85 (specifically the USI section) and the datasheets for the mirf chips when building your library.
New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

winner10920

Yeah I was thinking maybe instead of making spi work with the existing library it may be easier to entirely redo the existing library to better suit the attiny

mr_electric

Hi,
Did you Try installing the hardware components for Arduino 1.0? I successfully got my ATTiny85 to collect data from a ping sensor mounted on a servo (that it too controlled) and send it to my PC using a pair of XBee wireless radios...Let me know if you have any questions...

Regards,
Mr_E

winner10920

Not yet, how did you add the attiny 85 to the core?

Chagrin

Moving back a few posts I had linked the Wire libraries tailored for the ATTiny85. Isn't that what you're looking for?

winner10920

Im looking for something that uses the usi hardware for serial or spi, those are mostly what i use with peripherals

mr_electric

You can download the files from this link <http://hlt.media.mit.edu/?p=1695> I found it easier to leave the folder inside the Arduino's hardware folder, but you can use whichever method suits you best. Make sure you install the support for Arduino 1.0, for it is the one that has support for SPI, i2c, and NewSoftSerial...you will need to set the ATTiny's fuse settings to 8MHz which can be done by selecting "ATTiny85 8MHz" from the boards menu and clicking "Burn Bootloader" (it wont burn a boot loader, but set the fuses to 8MHz)..let me know if you have trouble...Ill try to get a video up


Cheers!
Mr_E

winner10920

Illdownload and try that out Monday when I get home,
That should set it to internal 8mhz right? I shouldn't need a resonator right?

mr_electric

Yup...it runs standalone..you'll only need a resonator/crystal if you set the fuses to 20MHz . I  was able to control an ultrasonic rangefinder and a servo from an ATTiny85 and transmit the servo postiton and sensor reading to my computer with a pair of XBee radios.. You'll just need to set it back to 1MHz to use the simple sketches like Blink and Fading.

Cheers,
Mr_E

winner10920

Why wouldn't simple sketches work? Does it affect millis() or something?

Coding Badly

#25
Jul 30, 2012, 09:07 am Last Edit: Jul 30, 2012, 09:08 am by Coding Badly Reason: 1
Why wouldn't simple sketches work? Does it affect millis() or something?


At 20 MHz, millis and the other time functions will be off.  It's a limitation brought over from the Standard Arduino Core.

The Tiny Core works well at the typical clock speeds: 1, 8, and 16 MHz and should work fine at 2 and 4 MHz.

Note: The ATtiny85 processor is able to run at 16 MHz with no external components.

mr_electric

Yes, exactly what Coding Badly said  :) ... The Arduino Core has limitations like that.

Cheers!
Mr_E

winner10920

Ok, so I've got the atttiny85 fuses set for 8mhz, and uploading programs work
now I just gotta work on that spi
Im gonna try and use that playground example as part of an 85spi library, if anyone knows of one already let me know lol

winner10920

Ok, I set the 85. To 16Mhz, figured it can't hurt
made myself a mirf85 and spi85 library, which at this point mesh well and compiles, however the functions I need to replicate are blanked out for now
if anyone knows these it will helpp me, im gonna try and do it myself but mybe there's a bettter way
I need
Begin()
setDataMode(SpiMode0)
sesetClockDivisor(SPI2xclockmask)
end()

winner10920

Success! Sorta
I got spi working for use with the nrf24l01 module, actually not too hard at all
now the problem lies with that I used all my I/o on it so I can't do anything lol
Guess I should've gotten the 84 for use with the nrf24l01, although I kinda like the small 8pin dip I can fit on the back of the nrf24l01 if I wanted
I think perhaps if I only use it in tx mode I can save the ce and csn pin by tieing them to a rail, tht will allow me 2 pins maybe for ds18b20 and a few buttons

Go Up