Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Minimum System of ATmega128

Status
Not open for further replies.

satria02

Junior Member level 2
Joined
Apr 22, 2011
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Bandung
Activity points
1,467
Hi......
I'm new for using ATmega128 and I have a problem with the minimum system of ATmega128.

I was design the schematic of minimum system of ATmega128 from some literature (data sheet and from internet).....I think the minimum system that i designed was right, but when i try to access the I/O port (using C --> AVR GCC), i was failed....And i don't know why this happen....

when i test the I/O port using multimeter, the multimeter show less than 1 Volt...It's mean that I/O port which i accessed was failed....

This is the schematic that i designed...
MCU.pdf
MCU.SchDoc

can you help me why this problem happen.....??
thanks before....

best regards...
 

I can see the mosi, miso and rst connected but I can't see the sck connection, there is only the SCK which goes to the SDcard but no sck.
Check if it is connected, everything else seems to be fine

Alex

---------- Post added at 14:06 ---------- Previous post was at 13:54 ----------

Another obvious note would be to check if the chip is soldered correctly and there aren't any bridges between pins.

Alex
 

Thanks for replay...

Beside connect to SD Card, sck also connect to ISP (programming)....
I have been tried to load program from PC to this minimum system and it doesn't matter.....the load process was success, but the program doesn't work (I/O port access was failed)....
 

So you program it correctly and you also verify the written checksum and it is correct?

Alex
 

Actually i don't know what is the problem..... the circuit or the programs

#include <avr/io.h>
#include <avr/iom128.h>

int main(void)
{
PORTA = 0xFF;
DDRA = 0xFF;

PORTC = 0xFF;
DDRC = 0xFF;

PORTD = 0xFF;
DDRD = 0xFF;

PORTE = 0xFF;
DDRE = 0xFF;


PORTA= 0xFF;
PORTC= 0xFF;
PORTD= 0xFF;
PORTE= 0xFF;

while(1);
}

Anything wrong with my program....?
 

I assume you are using avrgcc,
#include <avr/iom128.h> is not needed, #include <avr/io.h> will point to the right library.

Do you use AVRstudio with winavr?

Alex
 

yup.... i using AVRstudio 4 and winavr....
 

Have you set the correct device in the project options (atmega128) and also the frequency (only makes a difference when delays are involved but fill it anyway).
Your code has no problem, if you want instead of turning everything on try to blink a pin or port


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <avr/io.h>
#include <util/delay.h>
 
int main(void)
{
PORTA = 0xFF;
DDRA = 0xFF;
 
 
    while(1){
        _delay_ms(1000); // delay 1 sec
        PORTA^=0xff;  // invert PORTA outputs 
        // PORTA^=0x01;  // or invert PORTA.0 output only 
 
 
    }
}



Alex
 
can you tell me how to setting frequency clock in this compiler?
 

The frequency is set in the project menu -> configuration options
that is where you set the mcu model too.
The frequency should match the core speed of maga128 device, it can't change it just calculates correct the delays.
Have you changed the armega128 fuses to work with the external crystal at 16MHz?
If so then use 16000000 as frequency of the project

In m128 I think there is also a clock divider that can change the clock frequency , that one is controlled with a register value but you don't need to use it for now.

Alex
 
How to changed the atmega128 fuse?

external crystal that i used was 16MHz
 

Your programmer application should have a screen to change the fuses,
I use USBasp ( fischl.de - USBasp - USB programmer for Atmel AVR controllers ) programmer (can't work from AVRstudio interface)
with AVRdude and AVR BURN-O-Mat front end ( AVR8 Burn-O-Mat avrdude GUI ) , it is very easy to change fuse with this application.

The default setting for m128 is internal RC clock with a frequency of 1 MHz and your code should work fine with that,
this is not the cause of your problem so maybe you should see why it doesn't work first before changing fuses.

What application do you use to program the device?

Alex

---------- Post added at 21:08 ---------- Previous post was at 20:32 ----------

Actually according to the datasheet , when the internal RC is used the XTAL pins should be left unconnected,
it is not the same as mega8 that I use in which the xtal pins turn into I/O when the internal RC is used.
In mega 8 you can have internal RC clock and also a crystal connected in XTAL and it doesn't matter,
in m128 the XTAL has dedicated pins and maybe things are different.

On the other hand if the clock wasn't working you wouldn't be able to program the device and you say that you did.

Alex
 
I use Khazama as loader and use USBasp as downloader....

thanks for your assist, i will try it again....
 

When you upload the program to the mcu there should be a function to verify and compare your hex file with the content of the chip, is the content of the chip verified?
Have you changed the fuses?

Alex
 

I can read fuses and lock from mcu, but i haven't change anything....

the download process from PC to mcu was successful....

Is it possible that mcu that i used was damage?
 

Your code was correct, if the mcu is also set correctly in the avrstudio properties then this part is fine.
You say that you can read the chip fuses and you can transfer the hex to the mcu and verify that it was transferred so the chip clock works (internal RC).
If the pin output of the mcu is not correct (you said 1v instead of 5) then it has nothing to do with the program, also the power supply must be correct and the mcu works because it can be programmed.

It is very strange, have you tried my blinking code to see if portA (or use any port) blinks?

Alex

---------- Post added at 11:58 ---------- Previous post was at 11:54 ----------

in your first post you said
but when i try to access the I/O port (using C --> AVR GCC), i was failed....And i don't know why this happen....
so you where not able to connect at all but now you say that you can transfer and verify the program.
What have you changed and what is the pin voltage now?

Alex

---------- Post added at 12:11 ---------- Previous post was at 11:58 ----------

Is anything connected to the pins of the mcu , for example LCD, or MMC etc?
If you have connected peripherals to the pins and you have turned every pin of the mcu to an output with high hevel (5V) then maybe this is the cause of your problem and some pin creates a "shortcut" or even worse something has been damaged.
It should probably be visible in the 5v power supply too, in the measured voltage.

Alex
 

I have tried your blinking code.....
not only in port A, but also in the other port.....

hmm....may be the problem is fuse bits.....but i don't know how to setting the fuse bits....
when i read the fuse bits from mcu.....there are Lock Bits, H Fuse, and checklist box on H-Fuse, L-Fuse,E-Fuse, and Lock (like link that you shown),
and i don't know which box should be on the check list....
 

My suggestion would be to download AVR BURN-O-Mat front end ( AVR8 Burn-O-Mat avrdude GUI )

It will be very easy to set the fuses from there but the fusebits can't stop your code from working.

You haven't answered to my question if anything is connected to the mcu pins.

Alex
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top