| Author |
Message |
|
|
Posted: Feb 16, 2012 - 11:25 AM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
Got too many choises,
AVRISP MKII
AVR DRAGON
AVR STK500
AVRISP/ASP CLONES
AVR STK500 CLONES
ALL THEESE OTHER ONES PARALLEL AND SERIAL Bit banging etc
AVRJTAGICE CLONES
A COUPLE AVRISP MKII CLONES
my only concern is will they work atleast with the official product you know it will work with the 1284p
its driving me nuts |
|
|
| |
|
|
|
|
|
Posted: Feb 16, 2012 - 11:29 AM |
|


Joined: Jul 18, 2005
Posts: 62209
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
If you have $5 buy a USBAsp
If you have $35 buy an AVRISPmkII
If you have $50 buy a Dragon
If you have $80 buy an STK500
Simple as that. (IMAO). |
_________________
|
| |
|
|
|
|
|
Posted: Feb 16, 2012 - 11:56 AM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
As an impecunious student, it is really two choices:
1. USBasp @ $3.99 is hardly going to break the bank.
2. Dragon + some jumper wires is the cheapest way to debug ALL chips.
The USBasp can be added as a 'Tool' but is not directly integrated into Studio. No real inconvenience.
The Dragon is fully supported by Studio and every third party software ever invented.
Of course if you are rich, the choices are more varied. e.g. A reliable dev board.
If you buy from abroad, it can be cheaper but you wait a few days.
Beware carriage and customs charges.
David. |
|
|
| |
|
|
|
|
|
Posted: Feb 18, 2012 - 08:28 AM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
Hi David, Will the usbasb you will lend come with the isp cable and is it six pin or 10 pin interface?
I will probably try to setup part of the system this week.
The isp header for the target board should be male right. |
|
|
| |
|
|
|
|
|
Posted: Feb 18, 2012 - 09:01 AM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
All usbasp boards use a 10-pin male header, and a 10-way ribbon cable.
You download the pin-out and USB driver from www.fischl.de/usbasp
I suggest that you wire a matching male header on your pcb (you can leave pins 4, 6, 8, 3 as n/c). Mark a RED dot for pin#1 with a permanent marker. Then you have a reliable connection with your ribbon cable.
Pin #2 will supply 5V power from the usbasp. So you must not supply power to your board in any other way.
Alternatively, leave #2 as n/c if you already have power on your pcb.
David. |
|
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 11:16 PM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
Hi,
Is this the right pinout?
I thought I might as well build a connector from the usbasp to uC.
Still haven't recieved the microcontroller, so little time so much to do  |
|
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 11:42 PM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
Where are you buying your microcontroller from?
Farnell deliver next day.
RS might take 2 days.
I always reckon that an Arduino is a very convenient and useful dev board.
It should be easy to get your University project up and running with an Arduino.
If you spend your time on good documentation of your project, you will get good marks.
A 'clever' design with bad or absent documentation is no good to anyone.
David. |
|
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 12:03 AM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
Yh, it was ment to have arrived last week but some complication happened and now they need to place order again.
Arduino was a choice but isn't it very simple and you would learn less about the hardware side of it. It is still a backup plan in case everything goes wrong, hopefully it wont. At first I was thinking of 8051, the avr was a big step up without going as far as arduino. |
|
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 09:30 AM |
|


Joined: Jul 18, 2005
Posts: 62209
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
Arduino was a choice but isn't it very simple and you would learn less about the hardware side of it.
Au contraire - it's almost undoubtedly the simplest AVR development board there is - they couldn't have made it easier to use.
And while you are right that if you use library code you don't learn so much about the hardware - but you only do that to get started. When you are confident about overall program structure you can then switch to direct hardware access for each peripheral in turn and learn about that. |
_________________
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 10:15 AM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
A project starts with an idea, and then you design the solution.
The coding is the last step and fairly trivial.
Why not use the coding system that is easiest?
e.g.
Code:
Serial.begin(9600);
Serial.println("Hello World");
You can always write the equivalent in C or ASM. More work, but it does the same thing.
They all run on the same Arduino hardware. You need no extra wires for the UART.
The Arduino board already has headers that can connect to extra hardware.
David. |
|
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 11:50 AM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
If I was to use arduino instead which model would be similar to a atmega1284p.
The prime reason I chose the 1284p was because it had built in adc, 4k eeprom to store data. I want to be able to log information from several sensors onto the eeprom and then periodicly extract it via serial interface to the pc which then converts it to an appropiate format and the send it off to a website.
I have a very little understanding of arduino, I know two things, it is easy to use and it uses atmega chips. |
|
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 12:05 PM |
|


Joined: Jul 18, 2005
Posts: 62209
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
The "big" Arduinos are based on the mega1280 and mega2560. They have ADC and they have 4K of EEPROM. The main deficiency compared to the 1284 is they only have 8K of SRAM while the 1284 is the only mega AVR that has 16KB.
From boards.txt in the Arduino software:
mega2560.name=Arduino Mega 2560 or Mega ADK
mega.name=Arduino Mega (ATmega1280) |
_________________
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 01:03 PM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
I seriously advise a regular Arduino with a mega328P.
95% of all accessories are designed for the standard Arduino.
If you want some local storage, add a 24C512 or 23C256 (3.3V) on a shield or breadboard.
It is surprising how much you can 'log' to ordinary SRAM or external eeprom.
The internal eeprom is ok for occasional use but is VERY slow for logging purposes. e.g. 320ms for 64 bytes when a 24C512 takes 4ms. Or a 23C256 takes microseconds.
The Arduino has libraries to handle pretty well any hardware ever invented.
They may not all work with the mega2560 boards.
David. |
|
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 10:05 PM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
Hi, I got the uC and usbasp setup, I am just wondering will I brick the uC if I flash without changing fusebits or lockbits on avrdude. |
|
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 10:59 PM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
Do not touch the fuses yet.
Just practice uploading program to flash.
Your chip will run at 1MHz.
You can make it run at 8MHz by adding these two lines to the start of your program.
Code:
// Crystal Oscillator division factor: 1
CLKPR = 0x80;
CLKPR = 0x00;
or with avr-gcc:
Code:
#include <avr/power.h>
...
clock_prescale_set(0);
...
David. |
|
|
| |
|
|
|
|
|
Posted: Mar 02, 2012 - 02:06 AM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
| is there any advantage to using the code instead of disabling the divide by 8 fuse, to let it run at 8mhz? |
|
|
| |
|
|
|
|
|
Posted: Mar 02, 2012 - 10:21 AM |
|


Joined: Jul 18, 2005
Posts: 62209
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
is there any advantage to using the code instead of disabling the divide by 8 fuse, to let it run at 8mhz?
Yes you don't risk crewing the chip by making a wrong fuse setting!
The downside of the code solution is that if you do it as:
Code:
int main(void) {
// Crystal Oscillator division factor: 1
CLKPR = 0x80;
CLKPR = 0x00;
then there could be several thousand instructions executed before main() that will run at the slow 1MHz rather than the new, fast 8MHz speed.
If using avr-gcc you can mitigate this by putting the lines in a separate function:
Code:
__attribute__((naked,section(".init3"))) void setclk(void) {
// Crystal Oscillator division factor: 1
CLKPR = 0x80;
CLKPR = 0x00;
}
That will then be done before any "long" work in the pre-main code. |
_________________
|
| |
|
|
|
|
|
Posted: Mar 03, 2012 - 01:41 PM |
|

Joined: Feb 14, 2012
Posts: 60
|
|
Hey, I got the 1284p with internal clk and a arduino both setup to blink led every second.
They are not running at the same speed. I had lots of problems with the _delay function in avr toolchain so I am currently using delay_x.h from here.
What could be the problem? |
|
|
| |
|
|
|
|
|
Posted: Mar 03, 2012 - 01:53 PM |
|

Joined: Feb 12, 2005
Posts: 16254
Location: Wormshill, England
|
|
How different ?
Unless you specifically set the CLKPR in software (or remove the CKDIV8 fuse) your chip will run at 1MHz.
The Arduino will run at 16MHz. i.e. 16x faster.
If your Toolchain is recent, you should have a working _delay_ms(). Of course you have to tell Studio 5 that you are running at 8MHz or whatever.
David. |
|
|
| |
|
|
|
|
|
Posted: Mar 03, 2012 - 02:16 PM |
|


Joined: Jul 18, 2005
Posts: 62209
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
Unless you specifically set the CLKPR in software (or remove the CKDIV8 fuse) your chip will run at 1MHz.
The Arduino will run at 16MHz. i.e. 16x faster.
Just to say that this alone should not affect the LED blink rate AS LONG AS you specify F_CPU correctly for each program. The _delay() routines use F_CPU to determine how many loops they should do and therefore need to be told accurately how fast the CPU is running at - this is done when you #define F_CPU. So the error is likely that the value you specify for F_CPU does not match reality. If you get it right then:
Code:
LED_on();
for(i=0; i<10; i++) {
_delay_ms(1000);
}
LED_off();
should light up an LED for exactly 10 seconds as shown on the sweep second hand of your wristwatch. If not F_CPU is not set to the actual CPU speed. |
_________________
|
| |
|
|
|
|
|