attiny841 in tinyshield dual motor

Started by IBORE2, December 19, 2015, 10:27:00 PM

Previous topic - Next topic

Ben Rose

Administrator
*****
Hero Member
Posts: 392
Logged
Thank you, glad you're taking a look at it.

1. You'll need to build an adapter with a TinyCircuits proto board so that you can connect a programmer- or connect to the TinyDuino and use ArduinoISP software. Then you need a software build environment- there are a lot of tutorials for setting up tools like AVR-GCC, avrdude, make, etc (WinAVR if you're on Windows), especially for 'raw' coding of a standard Arduino, and they should have about the same effect. However, the avrdude config file does need an addition for the ATtiny841- let me know if you get this far, or need help getting there.

2. For a multimeter you'll probably need a resistor/capacitor filter to get a nice voltage output. I've also remembered that the default behavior of the library is to let the motor 'coast'- ie, if one pin is being driven low, the other pin alternates between driven high and undriven- not driven high or driven low, like you would want for a voltage output. Since you're looking into the library, you should be able to write your own setMotor function to use 'maxPWM' instead of zero for the non-pwm pin. ie, a line like 'writeCommand(COMMAND_MOTOR_1,0,abs(val));' becomes 'writeCommand(COMMAND_MOTOR_1,maxPWM,abs(val));'

3. DRV8837 datasheet claims 280 milliohm total(high side plus low side) on resistance at 800mA, which would be 0.224V, so that may be what's going on if your motor is drawing over 1 amp. Is that the case?

Ben

IBORE2

*
Newbie
Posts: 4
Logged
Hi Ben,

I am using following programmer, cable and attiny841 shield to program attiny841.

http://www.protostack.com/accessories/usbasp-avr-programmer
https://www.sparkfun.com/products/9215
https://www.tindie.com/products/bot_thoughts/eezeetiny841/

I install winavr and import main.c and makefile. But compilation failed and it complaint about unknown MCU 'attiny841' specified.  As you said, look like avrdude need an addition for attiny841. Can you help on how to add the addition to let winavr or avrdude to recognize and support attiny841 

Ben Rose

Administrator
*****
Hero Member
Posts: 392
Logged
Hope you are still working on this- sorry about the delay. Compilation failing means avr-gcc doesn't know about attiny841- that checks out, since winavr hasn't been updated in years. You'll need to grab the AVR 8 bit toolchain from Atmel at http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx and extract the files using 7zip or similar, then copy the folders into your winavr install, overwriting what's currently there. Make a backup :)

You'll need an updated avrdude and config as well- grab avrdude-6.1-mingw32.zip from http://download.savannah.gnu.org/releases/avrdude/ and put it in winAVR-20100110/bin. Then you need an avrdude.conf with the ATtiny841 in the same folder. I've attached mine.

After all this, you should be able to just run 'make install' from the ATtiny841FW folder.

Ben Rose

Administrator
*****
Hero Member
Posts: 392
Logged
I was able to reproduce a working toolchain using the above post- although I forgot to attach the avrdude.conf, here it is.

Let me know where more detail is needed :)

IBORE2

*
Newbie
Posts: 4
Logged
Hi Ben, just pick up the attiny841 recently again. I was able to load the firmware. what is the fuse and lock bits setting used in tinyshield dual motor?   High bits, low bits, Extended bits and LB bits 

Ben Rose

Administrator
*****
Hero Member
Posts: 392
Logged
Hi- fuse settings are in the makefile, which should be used if you do a 'make install'. It looks like we are just setting the extended bits to 0xED and leaving the rest default.

SMF spam blocked by CleanTalk