programming ATtiny micro-controllers
bnikkel
Posts: 104
in Propeller 1
Does anyone have experience programming these??
currently i have a propeller controlling a lb1909mc connected to the stepper motor. 3 control wires from the prop.
my goal is to control a micro stepper motor from a RC PWM signal 1-2ms.
propeller sends out PWM to ATTINY402-SSN which then controls the lb1909mc conected to the stepper motor.
physical size is the greatest limiting factor in all this hence the small 8 lead ATTINY402-SSN.
currently i have a propeller controlling a lb1909mc connected to the stepper motor. 3 control wires from the prop.
my goal is to control a micro stepper motor from a RC PWM signal 1-2ms.
propeller sends out PWM to ATTINY402-SSN which then controls the lb1909mc conected to the stepper motor.
physical size is the greatest limiting factor in all this hence the small 8 lead ATTINY402-SSN.
Comments
If you insist on doing it the hard way, you can use the Schmarschmino ecosystem to program the ATtiny (that's what I do when I want stand-alone ATtiny projects). I have a "chip clip" for programming the ATtiny in place so that I don't have to add a programming header to the board.
I used a "Dragon" programing device which forum member Leon suggested. There are likely better ways of doing it now.
I have a feeling we're missing some detail. Like Jon, I initially wondered why you didn't just control the lb1909mc directly with the Propeller. I'm guessing you have your reasons.
Edit: I just did a quick web search and found the AVR Dragon has been discontinued. I'll watch this thread with interest to see what's recommended.
my receiver prop controls 8 servos and 16 on/off functions. i want to be able to quickly swap a sevo for a stepper.
ive seen a couple things about using an arduino as a type of go between for compiling to the attiny.
In the Arduino IDE, go to menu: Settings, Additional board managers and use one of the unofficial boards support URLs that mention ATtiny. I use this one:
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Then in menu: Tools, Boards: Boards manager you can type ATtiny into the "Filter your search..." box and install support for the chip - if you used the URL above then it will be attiny by David A. Mellis.
Once you've done that just select the chip type and frequency you want. The 'burn bootloader' function doesn't really burn a bootloader to the chip, but does set it to run at the frequency and clock source you selected - with the ATtiny85, I normally use internal clock at 16MHz. You upload your sketches to the chip using the Upload using Programmer function in the Sketch menu.
I doubt it; the Propeller makes complex timing functions very easy; you'll probably have to do cycle counting in the AVR (I could be wrong). Again, the AVR forums should be able to help you with the interface chip.
The Arduino IDE uses C++. You can ignore the ++ and write in ordinary C most of the time. To make it simple for beginners, the IDE has built-in startup code, so you don't normally have to write your own main() function (though you can if you wish). Normally, you just write a setup() function which is called once at startup to configure I/O etc. and a loop() function which is then called repeatedly. There are lots of built-in functions you can call such as millis() which returns the number of milliseconds since power up, and Serial.print() which sends messages over the serial port, and so on... There are a multitude of available libraries for driving most anything you could think of connecting - displays, servos, SD cards, gyros, ... the list is endless.
I recommend buying an Arduino Uno or Nano to get started - you can get one for about $5 on eBay. Just connect to a PC USB port, download the Arduino IDE (available for Windows, Mac, and Linux) and away you go... Most people start with a simple 'blink' sketch to blink an LED on and off (the Uno and Nano have an on-board LED so you don't have to connect anything). There are lots of examples built-in to the IDE, including 'blink'. There's also a much bigger user-base than the propeller has, so you'll find loads of projects documented on-line.
Once you've got a few things working on the Uno or Nano (those two are the same electrically - just a different board shape) then you're ready to move on to ATtiny and other supported chips. Some of these are slightly trickier than the Uno/Nano, because they don't have an on-board programmer - you normally use the so-called USBasp to program them (a USBasp also costs about $5).
The Arduino IDE supports programming lots of chips in the C / C++ programming language - for example, many people use the ESP8266 and ESP32 chip families which have on-board WiFi and can act as web servers or clients. Unfortunately, the propeller isn't currently supported.