Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
zedzed
PostPosted: Nov 03, 2007 - 03:03 AM
Newbie


Joined: Nov 03, 2007
Posts: 8


Hi All,

I'm trying to port MJOY:
http://web.archive.org/web/200705300537 ... rticle.php
from mega8 to mega88.

Firstly, has anyone done this already?

I've attached my source code and unix-diff file (so you can see the changes I made). I think it's all correct, it assembles and flashes, but doesn't communicate with USB correctly. i.e. Windows gives a USB communication error.

I'd really appreciate any help or tips, because it looks like I'm stuck.


Last edited by zedzed on Nov 05, 2007 - 04:15 AM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
digitool
PostPosted: Nov 03, 2007 - 03:19 AM
Resident


Joined: Jul 02, 2003
Posts: 970
Location: Tricky Dicky City

Bear in mind that the mega88 ships with the clock set to internal as default. If you want to use an external "crystal" then the correct fuses must be set.
Not setting the fuses correctly will usually result in selecting an external "clock" which won't work with a crystal.Failing to understand how to set fuses properly before doing so is a major reason people post here with tales of 'dead' chips.
 
 View user's profile Send private message  
Reply with quote Back to top
Mike B
PostPosted: Nov 03, 2007 - 04:59 AM
Raving lunatic


Joined: Jun 22, 2004
Posts: 2996
Location: Utah

Did you check out application note AVR094: Replacing ATmega8 by ATmega88:

http://www.atmel.com/dyn/resources/prod ... oc2553.pdf
 
 View user's profile Send private message  
Reply with quote Back to top
zedzed
PostPosted: Nov 03, 2007 - 11:06 AM
Newbie


Joined: Nov 03, 2007
Posts: 8


Thanks for the tips.

Obviously I've read AVR094, I couldn't compile the source for a ATmega88 target without changing lots of registers. I went through each bolded item in AVR094 (the registers that changed functionality), and hopefully ported them all correctly.

I think my fuse bits are appropriate:
F7 DF F8 (low, high, ext)
I am measuring 11.99MHz with my el-cheapo multimeter on the XTAL, so that's a good sign.

I was thinking of trying out something like USBtiny, to test if my electronics/wiring is correct. I wonder if someone's ported that to 88.
 
 View user's profile Send private message  
Reply with quote Back to top
MegaTorr
PostPosted: Nov 03, 2007 - 06:28 PM
Hangaround


Joined: Dec 03, 2004
Posts: 345
Location: Sunny Vancouver

You don't have to port usbtiny to the mega88, it works with everything I've tried so far without modification.

The only restriction you have is that D+ and D- have to be on the same PORT.
 
 View user's profile Send private message  
Reply with quote Back to top
zedzed
PostPosted: Nov 04, 2007 - 06:44 AM
Newbie


Joined: Nov 03, 2007
Posts: 8


I don't think so MegaTorr, avr-gcc doesn't even support the mega88, so I can't compile it.

This is a whole lot of trouble, time to find a mega8 chip (though they're more expensive)...
 
 View user's profile Send private message  
Reply with quote Back to top
MegaTorr
PostPosted: Nov 04, 2007 - 07:17 AM
Hangaround


Joined: Dec 03, 2004
Posts: 345
Location: Sunny Vancouver

check the sticky tags in the avr-gcc forum, especially the first one. Works rather well, and as of today it has a brand new version too Wink.
 
 View user's profile Send private message  
Reply with quote Back to top
zedzed
PostPosted: Nov 04, 2007 - 10:16 AM
Newbie


Joined: Nov 03, 2007
Posts: 8


You're right MegaTorr, the avr-gcc page didn't list atmega88, it must just be outdated. Editing the Makefiles with -mmcu=atmega88 got USBtiny's SPI program compiled and it works!

Ok, so my bug is purely software (porting mjoy.asm to mega88), time to go over it with a fine-tooth comb.
 
 View user's profile Send private message  
Reply with quote Back to top
zedzed
PostPosted: Nov 04, 2007 - 02:31 PM
Newbie


Joined: Nov 03, 2007
Posts: 8


Ok it's solved, I got MJOY working on ATmega88. It was no simple task Smile All the problems stem from the fact that the original code uses SRAM 0x60-0xff and never used the HIGH byte in pointers. ATmega88 starts its SRAM from 0x0100, so you really need to worry about ZH/YH/XH/SPH etc.

Will post working source code tomorrow.
 
 View user's profile Send private message  
Reply with quote Back to top
Rukus
PostPosted: Nov 05, 2007 - 04:11 AM
Hangaround


Joined: Oct 25, 2007
Posts: 159
Location: Rochester, NY

MJOY 88.0
~~~~~~~~~

This is a port of MJOY v1.2 to the ATmega88, a newer, cheaper version of the ATmega8. You can buy it from some online stores for less than $3.

The MJOY website has disappeared from the web, but you can find a archived version here:

http://web.archive.org/web/200705300537 ... rticle.php

The FUSE bits you should use for a ATmega88 are:

Low : F7
High: DF
Ext : FF
 
 View user's profile Send private message  
Reply with quote Back to top
zedzed
PostPosted: Nov 05, 2007 - 04:16 AM
Newbie


Joined: Nov 03, 2007
Posts: 8


Wow forum bug! That was not Rukus, it was my post!
 
 View user's profile Send private message  
Reply with quote Back to top
eagleheart
PostPosted: May 09, 2008 - 08:44 AM
Newbie


Joined: Apr 10, 2008
Posts: 3
Location: Port Orchard, Wa.

I was working on the same thing. Mjoy, ATmega8 to Atmega88. You beat me to it. Thank you. It works great. I am using the old 1.1 version of the Schematic just to make sure it worked before I build it into a little home made car for the kids. LOL or maybe me and NASCAR game. LOL thanks again
 
 View user's profile Send private message  
Reply with quote Back to top
Drools
PostPosted: Dec 30, 2008 - 08:09 PM
Wannabe


Joined: Aug 23, 2008
Posts: 59


What compiler are you guys using to get this working? I'm getting quite a few errors when compiling with AVR Studio 4.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits