Help with a Mega128 board

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

so i need some suggestions.

here's the deal.

I designed my own PCB for the mega128.

while i was waiting for it to be made and shipped to me, i used a mega128 development board to get some work done ( I used the Maverick-IIB 16MHz external oscillator dev board from bdmicro.com)

I made some LCD code that works great with the dev board. So i finally recieve my custom designed board. I do alittle testing. I just tried simple things, like toggling pins, turning on some programmable LEDs i added.

Here's were the trouble starts..

First, all the ports toggle fine, except port F (that's the ADC port) no matter what i write to it, i get like .52V. it doesn't change. all the pther ports change fine.

here's another problem.

On the dev board i wrote my LCD code for PORTA. like i said.. it works awesome on the DEV board. So knowing that PORTA on my board is working fine, i wire it up.. when i reset the MCU. The LCD seems to initiallize, but the cursor on it kind of flickers a weee bit.. it's hard to notice.. but if you look hard ehough it doens't really turn on and of consistantly (like it does on the DEv board), and kind of flickers a wee bit. plus.. i can't write anything to the LCD from there.. so it seems to be half-assing initializing.

I'm using a 16MHz oscillator on this one as well..

Anyone have any ideas that can help me out with these two problems???

I've checked the wiring like 6 times now. I know the LCD works on the DEV board. i know i can toggle pins correctly (except PORTF)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1)

Quote:
First, all the ports toggle fine, except port F (that's the ADC port) no matter what i write to it, i get like .52V. it doesn't change. all the pther ports change fine.

Did you put: DDRF = 0xFF; [?] or not? Messing around with ADC?
Hmmm, maybe we can see the code?... so we may be able to give U some more help.

2) LCD problem: seems to be a wiring problem... but you said it's ok [?] Otherwise... something like a paranormal phenomenon...

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yea i did do DDRF = 0xFF

i don't have the code with me at the moment cause it's on my other computer.. but i wasn't screwing with the ADC.. it's off by default right??

hhhmmm i'm gonna check the wiring one more time.. can there be a problem with my clock??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
it's off by default right??

yeah.
Quote:
can there be a problem with my clock??

you mean 16MHz xtal being too much for your AVR board?
Hmmm, if it's mega128L, then it will run up to 8 MHz.

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you have power connected to Avcc and ground to Agnd? This is needed for port F to operate,
whether or not you use the adc. Could even cause other problems, who knows.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

double checked wiring.. it's fine.. yea i do have power and gnd connected to AVCC and AGND.

it's not a mega128L. i just thoguht maybe the clock is screwy and the timing is off on my MCU.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I replaced my clock and no good... maybe my microcontroller is bad??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
maybe my microcontroller is bad??

Maybe you damaged it when you did the wiring job... :-(

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

If you are use delays on your LCD initialisation routine, you could try setting a square wave output onto a pin on both of your systems and scope it to make sure you have the same frequency on both systems.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post the schematic of your board and the code you are using.
Without those it is just a guessing game.

Ralph Hilton

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't post schematics at the moment.. but someone mentioned that it might be the fuse bits??

i'm a bit confused on which to set for an external 16MHz oscillator??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

She's working!!!!!!

it was the fuse config bits that were wrong.. Mega128 come in Mega103 compatibillity mode out of the factory.. so you have to change it... My PORTF problem has also been resolved.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Don't forget that the JTAG comes enabled on new mega128's. You will not get normal action on PF4 - PF7 unless you disable the JTAG.

I thought I would mention this...just in case :-) .

[edit] I did not thoroughly read this thread so my apologies if I missed the above being mentioned already.

Regards,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am designing a board right now to use with a 128. I am glad to see that you have had good luck. Actually once development is complete, I may find that I can use an AVR with less memory and SRAM. I am at 16k for the code and 550 bytes for the SRAM. I probably will have little use for more than 2K bytes of EEPROM, and 1K would probably do. I DO want 16mhz. I use 1 16bit timer. I also use 3 external interrrupts right now, and I may go for 3 more.

I, too, have had excellent luck with the Mavric development board. I decided that I would use the development board WITH my new board. I want to use as little area as possible (and my freeware Eagle is only good for 80x100mm). So I will have my new "daughter board" stack on top of the Mavric board right on to its headers.

Right now I plan on having the power supply on my "daughter board" (although if my board is bigger than the Mavric, which one is really the daughter?), but I may have the PS on a separate PCB just for simplicity and modularity.

What does your board do differently from the Mavric? I presume that it is more special purpose....

I'd love to see the layout/schematic. Maybe I can crib some of your ideas!!!!

As for your problem with the flickering LCD, look for a bad ground. That is the most obvious cause. I thought I destroyed one the other day. The symptom was NO contrast, but the characters were there as slight ghostly images. I then fiddled the connector (power and data, but not the contrast, come in on a long ribbon cable with a DB25 near the display).

-Tony