Changing to an Atmega 128

Need some advice? Trying out a new idea? Fancy a beer?
Join us for some general banter and good times.
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Changing to an Atmega 128

Post by MikeB »

Reading program memory can be a problem. The LPM instruction uses R31 and R30 to provide a 16 bit flash address. To acces all 128K of the M128, you need to use the RAMPZ register for the extra bit of the address and use the ELPM instruction.
I think there is also a problem in that the RAMPZ register is no incremented if you use ELPM with Z+ and Z wraps past 0xFFFF.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Changing to an Atmega 128

Post by bertrand35 »

MikeB wrote:Reading program memory can be a problem. The LPM instruction uses R31 and R30 to provide a 16 bit flash address. To acces all 128K of the M128, you need to use the RAMPZ register for the extra bit of the address and use the ELPM instruction.
I think there is also a problem in that the RAMPZ register is no incremented if you use ELPM with Z+ and Z wraps past 0xFFFF.

Mike.
The compiler should take care of it (as it does on the 2560 from gruvin9x for all PSTR), no?
Bertrand.
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Changing to an Atmega 128

Post by MikeB »

Yes it should. I was responding to an earlier question on compatibility. Using ELPM may take more execution cycles to set up the RAMPZ register. With any luck, the compiler will put all the program memory data in the first 64K anyway.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Changing to an Atmega 128

Post by bertrand35 »

Perfect then! I will check the lss file. I have compiled with -O2 instead of -Os optimization mode (as I do for gruvin9x / sky9x boards). It will save some execution cycles. I didn't test -O3 for now.
Bertrand.
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Changing to an Atmega 128

Post by gohsthb »

It has been awhile. Any updates on if the '128 is working on not?
-Gohst

User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Changing to an Atmega 128

Post by Kilrah »

I just received mine this morning. Will try to give news later.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Changing to an Atmega 128

Post by jhsa »

fixe.. (means cool in Fortuguese) :mrgreen:
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
derFrickler
Posts: 46
Joined: Mon Jan 09, 2012 9:54 am
Country: -

Re: Changing to an Atmega 128

Post by derFrickler »

mine are still on the way...
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Changing to an Atmega 128

Post by jhsa »

My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Changing to an Atmega 128

Post by bertrand35 »

In your place I would wait for Kilrah's first problems solved!
Bertrand.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Changing to an Atmega 128

Post by jhsa »

Thanks Bertrand, well, I've odered them just in case.. were not too expensive.. If not will use them in other projects.. just wanted to know if they were the right ones..
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Changing to an Atmega 128

Post by Kilrah »

Image

Image

Image

Image

:)
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Changing to an Atmega 128

Post by MikeB »

Very nice, I expect some people would like to know how you removed the Mega64, if they want to do it themselves.

The problem I have is how many different Txs do I need to be able to test all the different possible hardware versions?

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
Rob Thomson
Site Admin
Posts: 4543
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Re: Changing to an Atmega 128

Post by Rob Thomson »

MikeB wrote:Very nice, I expect some people would like to know how you removed the Mega64, if they want to do it themselves.

The problem I have is how many different Txs do I need to be able to test all the different possible hardware versions?

Mike.
I am sure I have an old main board somewhere if you want it for dev work?
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Changing to an Atmega 128

Post by MikeB »

It's more having the case and sticks than having a board, thanks.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
Rob Thomson
Site Admin
Posts: 4543
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Re: Changing to an Atmega 128

Post by Rob Thomson »

If you don't mind what it looks like... I can probably gather you the bits :)

Will check tomorrow.
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Changing to an Atmega 128

Post by bertrand35 »

My wife will not like either the 4th 9x at home :)
So open9x seems to run and use the whole EEPROM? I see 3593 octets libres :)
Bertrand.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Changing to an Atmega 128

Post by jhsa »

yeah, with the 128 it rocks then..
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
tedbmoss
Posts: 121
Joined: Sun Jul 15, 2012 10:42 pm
Country: -
Location: Peoria, AZ

Re: Changing to an Atmega 128

Post by tedbmoss »

Has anyone run across this problem?
I changed to an atmega128a and I can read and write flash and eeprom but the board has no output and osc seems to be stopped, the board worked before mod. There is no PPM. no sound and no screen output but the scope does show some output on ppm about 40 millivolts, I don't know what it should be though.
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Changing to an Atmega 128

Post by Kilrah »

You need to set the fuses with companion9x's relevant menu option.

Sent via mobile
tedbmoss
Posts: 121
Joined: Sun Jul 15, 2012 10:42 pm
Country: -
Location: Peoria, AZ

Re: Changing to an Atmega 128

Post by tedbmoss »

Thanks for the fast reply, I am slower than you are. I tried using the companion 9x and it is confusing at first, it sets the fuses to 3f 81 ff and the osc takes off running about 1.2v pp on scope, but no other change seems to have taken place. There is still no output from the cpu, no sound, no screen, and no ppm. So since the fuse setting fixed the osc what is next to trouble shoot the problem?

Interestingly, the stock atmega64 reads half of the peak voltage on the osc (.6v pp).
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Changing to an Atmega 128

Post by jhsa »

check that you don't have any shorts between pins or even components around the atmega.. once I found a short on mine after I replaced the original atmega with the 128. A little bit of solder was shorting both sides of an SMD capacitor.. good that I inspected it with a magnifier and a multimeter before powering the board, or it could have been a headache :)
Also check that all the pins are soldered in place. It's probably a good idea to reflow the solder...

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Changing to an Atmega 128

Post by Flaps 30 »

I agree with João. I suspect that the problem will be something like a pin that isn't soldered to the pad or a short..

As for what the fuses should be set for on the M128. To be honest it was a long time ago and I cannot find out what I did to make it all work. :cry:

Most of the M128 stuff is here ----> http://openrcforums.com/forum/viewtopic ... hilit=m128 You will find the fuse information there at the post shown here --> http://openrcforums.com/forum/viewtopic ... 545#p36367
tedbmoss
Posts: 121
Joined: Sun Jul 15, 2012 10:42 pm
Country: -
Location: Peoria, AZ

Re: Changing to an Atmega 128

Post by tedbmoss »

Yeha! I read your advice and got the first one to work, there was nothing wrong with the board, it was the grounds I left off the avr connector.
The second one works also, I had to reprogram it, it also had a bad connection to pin 12 (exit sw) which showed up after I reprogrammed the cpu. Thanks to all that helped, including all the people on the forum.
Yeah, I had trouble with programmers, but it was mostly not having the right connections, I had to use a new HobbyKing USBASP with the stk error to get the programming to work the first time, the unit that I reprogrammed to get rid of the stk error worked with the 64 but not with the 128 until I set the fuses with the unmodified USBASP first. I did not change any parameters to slow the programmer down, it just worked with companion9x.
(jhsa in comment below means leaving the ground wires off the connector to pins 4-6-8-10)
Last edited by tedbmoss on Sun May 19, 2013 6:27 am, edited 3 times in total.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Changing to an Atmega 128

Post by jhsa »

Yeah, that's not a good idea ;) :mrgreen:
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Changing to an Atmega 128

Post by MikeB »

After changing to a Mega128, a number of people have reported reboots happeniong when using the horizontal trims.
See http://openrcforums.com/forum/viewtopic.php?f=95&t=3594 for a solution to this problem.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “The Pickled Gnu (The Pub)”