| Author |
Message |
|
|
Posted: Nov 03, 2007 - 03:03 AM |
|

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
|
| |
|
|
|
|
|
Posted: Nov 03, 2007 - 03:19 AM |
|

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. |
|
|
| |
|
|
|
|
|
Posted: Nov 03, 2007 - 04:59 AM |
|


Joined: Jun 22, 2004
Posts: 2996
Location: Utah
|
|
|
|
|
|
|
Posted: Nov 03, 2007 - 11:06 AM |
|

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. |
|
|
| |
|
|
|
|
|
Posted: Nov 03, 2007 - 06:28 PM |
|

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. |
|
|
| |
|
|
|
|
|
Posted: Nov 04, 2007 - 06:44 AM |
|

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)... |
|
|
| |
|
|
|
|
|
Posted: Nov 04, 2007 - 07:17 AM |
|

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 . |
|
|
| |
|
|
|
|
|
Posted: Nov 04, 2007 - 10:16 AM |
|

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. |
|
|
| |
|
|
|
|
|
Posted: Nov 04, 2007 - 02:31 PM |
|

Joined: Nov 03, 2007
Posts: 8
|
|
Ok it's solved, I got MJOY working on ATmega88. It was no simple task 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. |
|
|
| |
|
|
|
|
|
Posted: Nov 05, 2007 - 04:11 AM |
|


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 |
|
|
| |
|
|
|
|
|
Posted: Nov 05, 2007 - 04:16 AM |
|

Joined: Nov 03, 2007
Posts: 8
|
|
| Wow forum bug! That was not Rukus, it was my post! |
|
|
| |
|
|
|
|
|
Posted: May 09, 2008 - 08:44 AM |
|

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 |
|
|
| |
|
|
|
|
|
Posted: Dec 30, 2008 - 08:09 PM |
|

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. |
|
|
| |
|
|
|
|
|