Well I’m back again on the quest for some help with the Black Arts forbidden fruit known as an ATtiny861.
I have some source code for a soundclip player in C which may as well be in Japanese or Martian and a HEX file but after that I don’t know where to go.
Common sense or probably the lack of it is telling me that my PicKit 2 or 3 will not look at an Atmeg device and my GCB IDE will probably not compile my C file so it looks like I'm stuck with the HEX file.
Can anyone please point me in the most practical approach to get this thing up and running. What I need, etc.
Once again Many thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again Evan, (Still making mini bombs with supercaps!)
This is the C code that I have found on the net. It is a basic one chip riff /wav 256 voice player. I have the hex file so I don't really need to compile this but I would like a little insight into what is going on.
As I said before I'm completely in the dark with Atmeg stuff - Kent has given me a clue as to what programmer to use which program to speak to it with.
Pity, I couldn't transfer this to a PIC I half know what I'm doing there. (okay, less than half, !!)
/----------------------------------------------------------------------------/
/ 8-pin SD audio player R0.05d (C)ChaN, 2011 /
/-----------------------------------------------------------------------------/
/ This project, program codes and circuit diagrams, is opened under license
/ policy of following trems.
/
/ Copyright (C) 2010, ChaN, all right reserved.
/
/ * This project is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.
/
/----------------------------------------------------------------------------/
#ifndef MODE
#error Wrong make file.
#endif
#if MODE == 0 / Single output /
FUSES = {0xE1, 0xDD, 0xFF}; / Fuse bytes for mono: Low, High and Extended /
#else / Dual output /
FUSES = {0xE1, 0x7D, 0xFF}; / Fuse bytes for stereo and mono-HR: Low, High and Extended (HVS mode only) /
#endif
/ This is the fuse settings of this project. The fuse data will be included
in the output hex file with program code. However some old flash programmers
cannot load the fuse bits from hex file. If it is the case, remove this line
and use these values to program the fuse bits. /
TCCR0B = 0; TCCR0A = 0; /* Stop TC0 */if (TCCR1) { /* Stop TC1 if enabled */ ramp(0); TCCR1 = 0; GTCCR = 0;}WDTCR = _BV(WDE) | _BV(WDIE) | 0b101; /* Set WDT to interrupt mode in timeout of 0.5s */set_sleep_mode(SLEEP_MODE_PWR_DOWN); /* Enter power down mode */sleep_mode();wdt_reset();WDTCR = _BV(WDE) | 0b110; /* Set WDT to reset mode in timeout of 1s */
}
EMPTY_INTERRUPT(WDT_vect);
/-----------------------------------------------------------------------/
/ Main /
int main (void)
{
FRESULT res;
char *dir;
BYTE org_osc = OSCCAL;
MCUSR=0;WDTCR=_BV(WDE)|0b110;/* Enable WDT reset in timeout of 1s */PORTB=0b101001;/* Initialize port: - - H L H L L P */DDRB=0b111110;sei();for(;;){if(pf_mount(&Fs)==FR_OK){/* Initialize FS */wdt_reset();Buff[0]=0;if(!pf_open("osccal"))pf_read(Buff,1,&rb);/* Adjust frequency */OSCCAL=org_osc+Buff[0];res=pf_opendir(&Dir,dir="wav");/* Open sound file directory */if(res==FR_NO_PATH)res=pf_opendir(&Dir,dir="");/* Open root directory */while(res==FR_OK){/* Repeat in the dir */res=pf_readdir(&Dir,0);/* Rewind dir */while(res==FR_OK){/* Play all wav files in the dir */wdt_reset();res=pf_readdir(&Dir,&Fno);/* Get a dir entry */if(res||!Fno.fname[0])break;/* Break on error or end of dir */if(!(Fno.fattrib&(AM_DIR|AM_HID))&&strstr(Fno.fname,".WAV"))res=play(dir,Fno.fname);/* Play file */}}}delay500();/* Delay 500ms in low power sleep mode */}
}
Last edit: Keith 2016-08-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Kent... Wow Atmel Studio, that is one hell of a program. I have downloaded and installed ver 7. it looks at the hex file and the C file - don't know what do with it as yet and the chances are I never will but I;m on the road to my goal.
The Authur of the projuct has put a comment on the schematic, 'This Project requires an HVSP Programmer'. I don't seem to be able to find anything on an HVSP Programmer. Does it mean aything to you guys?
Last edit: Keith 2016-08-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Low pin count Atmel AVR devices do not have enough IO pins to support the full Parallel Programming interface. These devices instead use HVSP programming, which is a serial version of the Parallel Programming interface."
So basicaly it is the equivelent of ICSP in the PIC world.
Any of the curent generation of AVR programers such as the AVR Dragon should be fine.
Cheers
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I don't personally have one, I am a PIC person, don't even like the Arduino :) But from what I have heard the AVR Dragon is a good programer that also doubles as a Development board, so should be good bang for the buck.
Talking of Arduino, if you have one, there is an Arduino Sketch that allows it to work as a programer for some AVR devices. You may be able to use that rather than buy a dedicated programer.
Last edit: Chris Roper 2016-08-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Arduino - not likley - PIC through and through, bit like Blackpool Rock, still very much a newbie with PIC's though but I am getting there my programming skills are growing day by day.
Arduino I thought that was what we called the Ice Cream Man!!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well Microchip now own ATMEL so we may all end up being Arduino Users :) but seriously, although I have at least 4 Arduinoes sitting on my desk, I prefer the PIC devices. They are a lot more rugged and reliable. The Arduino may be a nice toy, but if you want a device that is economical and reliable in a realworld control situation the PIC wins hands down.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the deal, someone can check me on this. The AVRISP mkII will not do HVSP, the Dragon will. I presume most all ATMEL devices use LVSP unless the RST pin (i.e. MCLR in PIC terms) needs to be used as a digital input pin, just like the PIC. Lucky for us the pk2 and pk3 normaly does PIC HVSP by default.
My only complaint against the Dragon is all the wires, and of course if a different device is loaded then new wiring diagram needs to be consulted again.
If the RST fuse doesn't need to be burned, or a device that's been bricked doesn't need rescuing then I prefer the AVRISP mkII.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well you should find it a usful tool and a reasonable development board.
You will then, combined with Great Coaw Basic, have the ability to program and test ideas on both PIC and AVR. So I dont think your investment will be a waist of money but you may have so much fun with it that it becomes too time consuming :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm back again looking for a pointer as to how to progam a hex file into a ATtiny45 using a Dragon programmer Atmel Studio in ISP Mode.
Atmel Studio can see the device, I can set the fuses, but for the life of me I cannot see how or where to load my .hex file and write it to the device.....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think I have done it ... Under the Memories section it allows my load in my .hex and lo and behold the program tab is visible. Jings... Thank heaveans for MicroChip and PicKit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Still struggling with my ATtiny 861A. The author of the code and the HEX file says the fuse settings are combined in the .HEX file which says to me that I don't need to set any fuses which in a nutshell is a blessing as the fuse section in the device programming is an absolute nightmare.
However, what I have found is that if I load the .HEX file into Atmel Studio7 it does not amend the fuse settings in the fuse programming section - very confusing.
Am I right in saying that it is not necessary to do anything with the fuses when it is written into the .HEX file.
Thank God for GCG and MicroChip as this stuff looks like the work of the Devil or the ramblings of those Italian Ice Cream Men – Just one Arduino !!!
Last edit: Keith 2016-08-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a link to this project, blog, or? So you know what the high and low fuses are supposed to be? And reading back the fuses doesn't match what they are supposed to be?
If you have those fuse values, have you tried to separately enter them into their respective boxes in the fuse window? They can be programed there in the High 0x00 and Low 0x00 boxes, as opposed to checking the boxes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Kent and thank you for replying. here is a link to the project. His/Her English is pretty good for an Oriental, but I'm sure you will get the jist of what is being described.
Once again I am truelly right out of my comfort zone with this but I really want to get this up and running. I have been diddling about with the fuse patterns in the High and Low boxes and 'bricked' all but the last of my 861A's.
Thanks once again.
Keith
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well it is good thing that you got the Dragon, as it can unbrick your tiny's to live another day :). They describe how to do the HV (high voltage or parallel) programming hookup in Studio /HELP /AVR Dragon. Use that now.
I would remove the two fuse setting lines from the hex file as described on the web page. Also comment the fuse line of main.c "if you decide to rebuild or alter the original program". So the hex file is now ready to go less the fuses. The fuses need to be programmed first, copy the settings from the main.c file. By the looks of things they will be:
Go ahead and program those fuses after entering. Then go to the memories window and load the hex file up (i.e. the one with the fuses that were removed earlier). Hit the Program button, and you should be good to go?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well Kent, after spending about 14 hours on this, I write with an enormous smile of sweet success on my face. nearly 3 hours of that was taken up making jumpers and configuring the Dragon HVSP programmer. Now I know what you meant about jumpers but it was all worthwhile as I managed to Un-Brick several tiny's.
What I did find was that although the fuses were being set in High Mid and Low boxes, it was still necessary to remove the Brown Out option and set the Oscillator to PLL as leaving these as they were would not let the code run.
I now have the project up and running on the breadboard and I'm really chuffed. Next task is some binary addressing to operate the sound files - This bit is going on a trusty PIC 16F616 with the aid of some GCB coding. Very basic and simplified but something I can understand.
Many Thanks for all your help and encouragement, it is really appreciated.
Last edit: Keith 2016-08-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Kent. Hello again, can you please help. I have 'Bricked' my ATtiny85's whilst playing around with the fuse settings and I cannot remember exactly what I did when I 'De-Bricked' the ATtiny861's.
I have re-read your post on the 28/8/16 and tried to re-locate the information from the Help/AVR Dragon but for the life of me I cannot find the information I need to rejuvenate these little beasts.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Atmel Studio/Help/AVR Dragon/Device Connection Sheets. Then find out which one holds the ATtiny85 and use parallel/high voltage serial programming wiring diagram.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well I’m back again on the quest for some help with the Black Arts forbidden fruit known as an ATtiny861.
I have some source code for a soundclip player in C which may as well be in Japanese or Martian and a HEX file but after that I don’t know where to go.
Common sense or probably the lack of it is telling me that my PicKit 2 or 3 will not look at an Atmeg device and my GCB IDE will probably not compile my C file so it looks like I'm stuck with the HEX file.
Can anyone please point me in the most practical approach to get this thing up and running. What I need, etc.
Once again Many thanks in advance.
Post the C source - that is a start. :-)
I've used the AVRISP mkII programmer along side Atmel Studio to program hex files into ATTiny's and Mega's.
Hello again Evan, (Still making mini bombs with supercaps!)
This is the C code that I have found on the net. It is a basic one chip riff /wav 256 voice player. I have the hex file so I don't really need to compile this but I would like a little insight into what is going on.
As I said before I'm completely in the dark with Atmeg stuff - Kent has given me a clue as to what programmer to use which program to speak to it with.
Pity, I couldn't transfer this to a PIC I half know what I'm doing there. (okay, less than half, !!)
/----------------------------------------------------------------------------/
/ 8-pin SD audio player R0.05d (C)ChaN, 2011 /
/-----------------------------------------------------------------------------/
/ This project, program codes and circuit diagrams, is opened under license
/ policy of following trems.
/
/ Copyright (C) 2010, ChaN, all right reserved.
/
/ * This project is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.
/
/----------------------------------------------------------------------------/
~ #include <avr io.h="">
#include <avr interrupt.h="">
#include <avr sleep.h="">
#include <avr wdt.h="">
#include <string.h>
#include "pff.h"
#include "xitoa.h"</string.h></avr></avr></avr></avr>
#ifndef MODE
#error Wrong make file.
#endif
#if MODE == 0 / Single output /
FUSES = {0xE1, 0xDD, 0xFF}; / Fuse bytes for mono: Low, High and Extended /
#else / Dual output /
FUSES = {0xE1, 0x7D, 0xFF}; / Fuse bytes for stereo and mono-HR: Low, High and Extended (HVS mode only) /
#endif
/ This is the fuse settings of this project. The fuse data will be included
in the output hex file with program code. However some old flash programmers
cannot load the fuse bits from hex file. If it is the case, remove this line
and use these values to program the fuse bits. /
#define FCC(c1,c2,c3,c4) (((DWORD)c4<<24)+((DWORD)c3<<16)+((WORD)c2<<8)+(BYTE)c1) / FourCC /
void delay_us (WORD); / Defined in asmfunc.S /
/---------------------------------------------------------/
/ Work Area /
/---------------------------------------------------------/
volatile BYTE FifoRi, FifoWi, FifoCt; / FIFO controls /
BYTE Buff[256]; / Wave output FIFO /
FATFS Fs; / File system object /
DIR Dir; / Directory object /
FILINFO Fno; / File information /
WORD rb; / Return value. Put this here to avoid avr-gcc's bug /
/---------------------------------------------------------/
static
DWORD load_header (void) / 0:Invalid format, 1:I/O error, >=1024:Number of samples /
{
DWORD sz, f;
BYTE b, al = 0;
}
static
void ramp (
int dir / 0:Ramp-down, 1:Ramp-up /
)
{
#if MODE != 3
BYTE v, d, n;
#else
dir = dir ? 128 : 0;
OCR1A = (BYTE)dir; OCR1B = (BYTE)dir;
#endif
}
static
FRESULT play (
const char dir, / Directory /
const char fn / File /
)
{
DWORD sz;
FRESULT res;
BYTE sw;
WORD btr;
}
static
void delay500 (void)
{
wdt_reset();
}
EMPTY_INTERRUPT(WDT_vect);
/-----------------------------------------------------------------------/
/ Main /
int main (void)
{
FRESULT res;
char *dir;
BYTE org_osc = OSCCAL;
}
Last edit: Keith 2016-08-28
@Kent... Wow Atmel Studio, that is one hell of a program. I have downloaded and installed ver 7. it looks at the hex file and the C file - don't know what do with it as yet and the chances are I never will but I;m on the road to my goal.
The Authur of the projuct has put a comment on the schematic, 'This Project requires an HVSP Programmer'. I don't seem to be able to find anything on an HVSP Programmer. Does it mean aything to you guys?
Last edit: Keith 2016-08-28
From http://www.atmel.com/webdoc/avrdragon/avrdragon.hvsp_description.html
"Low pin count Atmel AVR devices do not have enough IO pins to support the full Parallel Programming interface. These devices instead use HVSP programming, which is a serial version of the Parallel Programming interface."
So basicaly it is the equivelent of ICSP in the PIC world.
Any of the curent generation of AVR programers such as the AVR Dragon should be fine.
Cheers
Chris
Im looking at an AVR Dragon programmer. Any good ?? don't want to wast 40 quid if I can help it.
Just seen your post Chris, Thank you. so for you its a thumbs up for the Dragon....
Well, I don't personally have one, I am a PIC person, don't even like the Arduino :) But from what I have heard the AVR Dragon is a good programer that also doubles as a Development board, so should be good bang for the buck.
Talking of Arduino, if you have one, there is an Arduino Sketch that allows it to work as a programer for some AVR devices. You may be able to use that rather than buy a dedicated programer.
Last edit: Chris Roper 2016-08-20
Arduino - not likley - PIC through and through, bit like Blackpool Rock, still very much a newbie with PIC's though but I am getting there my programming skills are growing day by day.
Arduino I thought that was what we called the Ice Cream Man!!!
Well Microchip now own ATMEL so we may all end up being Arduino Users :) but seriously, although I have at least 4 Arduinoes sitting on my desk, I prefer the PIC devices. They are a lot more rugged and reliable. The Arduino may be a nice toy, but if you want a device that is economical and reliable in a realworld control situation the PIC wins hands down.
Here is the deal, someone can check me on this. The AVRISP mkII will not do HVSP, the Dragon will. I presume most all ATMEL devices use LVSP unless the RST pin (i.e. MCLR in PIC terms) needs to be used as a digital input pin, just like the PIC. Lucky for us the pk2 and pk3 normaly does PIC HVSP by default.
My only complaint against the Dragon is all the wires, and of course if a different device is loaded then new wiring diagram needs to be consulted again.
If the RST fuse doesn't need to be burned, or a device that's been bricked doesn't need rescuing then I prefer the AVRISP mkII.
if you have a PICKit 2 this link may be of intrest:
https://hackaday.io/project/7061-microchips-pickit-2-as-an-atmel-stk500-programmer
Oh... That is way, way above my level of comprehension !!!
Jings Chris... I'm putting my money with the Dragon and put up with all the wiring configs.
Well you should find it a usful tool and a reasonable development board.
You will then, combined with Great Coaw Basic, have the ability to program and test ideas on both PIC and AVR. So I dont think your investment will be a waist of money but you may have so much fun with it that it becomes too time consuming :)
I'm back again looking for a pointer as to how to progam a hex file into a ATtiny45 using a Dragon programmer Atmel Studio in ISP Mode.
Atmel Studio can see the device, I can set the fuses, but for the life of me I cannot see how or where to load my .hex file and write it to the device.....
I think I have done it ... Under the Memories section it allows my load in my .hex and lo and behold the program tab is visible. Jings... Thank heaveans for MicroChip and PicKit
Still struggling with my ATtiny 861A. The author of the code and the HEX file says the fuse settings are combined in the .HEX file which says to me that I don't need to set any fuses which in a nutshell is a blessing as the fuse section in the device programming is an absolute nightmare.
However, what I have found is that if I load the .HEX file into Atmel Studio7 it does not amend the fuse settings in the fuse programming section - very confusing.
Am I right in saying that it is not necessary to do anything with the fuses when it is written into the .HEX file.
Thank God for GCG and MicroChip as this stuff looks like the work of the Devil or the ramblings of those Italian Ice Cream Men – Just one Arduino !!!
Last edit: Keith 2016-08-28
Is there a link to this project, blog, or? So you know what the high and low fuses are supposed to be? And reading back the fuses doesn't match what they are supposed to be?
If you have those fuse values, have you tried to separately enter them into their respective boxes in the fuse window? They can be programed there in the High 0x00 and Low 0x00 boxes, as opposed to checking the boxes.
Hello Kent and thank you for replying. here is a link to the project. His/Her English is pretty good for an Oriental, but I'm sure you will get the jist of what is being described.
http://elm-chan.org/works/sd20p/report.html
Once again I am truelly right out of my comfort zone with this but I really want to get this up and running. I have been diddling about with the fuse patterns in the High and Low boxes and 'bricked' all but the last of my 861A's.
Thanks once again.
Keith
Well it is good thing that you got the Dragon, as it can unbrick your tiny's to live another day :). They describe how to do the HV (high voltage or parallel) programming hookup in Studio /HELP /AVR Dragon. Use that now.
I would remove the two fuse setting lines from the hex file as described on the web page. Also comment the fuse line of main.c "if you decide to rebuild or alter the original program". So the hex file is now ready to go less the fuses. The fuses need to be programmed first, copy the settings from the main.c file. By the looks of things they will be:
Go ahead and program those fuses after entering. Then go to the memories window and load the hex file up (i.e. the one with the fuses that were removed earlier). Hit the Program button, and you should be good to go?
Thanks Kent. I will have a look in the morning, my old lamps are starting to dim a bit and my bed is beckoning me.
I'll get back to you with my results, hopefully with jubilant success.
Keith
Well Kent, after spending about 14 hours on this, I write with an enormous smile of sweet success on my face. nearly 3 hours of that was taken up making jumpers and configuring the Dragon HVSP programmer. Now I know what you meant about jumpers but it was all worthwhile as I managed to Un-Brick several tiny's.
What I did find was that although the fuses were being set in High Mid and Low boxes, it was still necessary to remove the Brown Out option and set the Oscillator to PLL as leaving these as they were would not let the code run.
I now have the project up and running on the breadboard and I'm really chuffed. Next task is some binary addressing to operate the sound files - This bit is going on a trusty PIC 16F616 with the aid of some GCB coding. Very basic and simplified but something I can understand.
Many Thanks for all your help and encouragement, it is really appreciated.
Last edit: Keith 2016-08-29
@Kent. Hello again, can you please help. I have 'Bricked' my ATtiny85's whilst playing around with the fuse settings and I cannot remember exactly what I did when I 'De-Bricked' the ATtiny861's.
I have re-read your post on the 28/8/16 and tried to re-locate the information from the Help/AVR Dragon but for the life of me I cannot find the information I need to rejuvenate these little beasts.
Atmel Studio/Help/AVR Dragon/Device Connection Sheets. Then find out which one holds the ATtiny85 and use parallel/high voltage serial programming wiring diagram.