Welcome! Log In Create A New Profile

Advanced

Gen7 & 644PA @ 20Mhz

Posted by JazzyMT 
Gen7 & 644PA @ 20Mhz
February 28, 2012 03:13PM
Hi all,

I'm a complete newb when it comes to Atmel & arduino so forgive my ignorance, but I'm stuck & need help.

I am trying to build my own Gen7 setup. I have a board that I think is fine as far as I can tell. My problem is with the chip.

I purchased a ATmega644PA thinking it was basically the same as the 644P. That may or may not be a problem, but I've narrowed it down to something more fundamental.

I also purchased an STK500 development board so that I could program a bootloader on the chip. I hit a brick wall pretty early in this process. If I insert a 20Mhz crystal into the board, set it to use the external reference - as SOON as I set the fuses to use the external crystal reference ( L:0xF7 H:0xDC E:0xFC ), the chip becomes completely unresponsive. If I change the jumper back to use an internal clock reference, it runs, but the usart speed is all messed up.

When not using an external reference, the programmer seems to work fine. I can program a bootloader, but I can only program arduino programs with the STK500 using the ISP - not through the chip's direct serial port - I assume because the baud rate/timing is screwed up.

I'm using the 20MHz crystal specified in the Gen7 parts list:
[search.digikey.com]

I also had a 20MHz ceramic resonator on hand. If I set the internal fuses to use that - it runs, but the timing is still screwed up. I connected my logic analyzer to the serial output while running the "SetupText" firmware and I was able to capture & decode the "ATmega is idle" message on the output, but it was being output at a screwed up 2920 baud instead of 9600. I'm not sure how the ceramic resonator is supposed to be set up, so it might not be right, but the 20MHz crystal doesn't run it at all. I don't have a scope to check if the crystal is oscillating - I have no idea what's wrong, but it seems unlikely all my crystals would be dead.

I have two 644PA chips and they both do the same thing. I tried multiple 20MHz crystals (I bought 10 or so of them) - they all do the same thing too.

HELP!

Edited 1 time(s). Last edit at 02/28/2012 03:15PM by JazzyMT.
Re: Gen7 & 644PA @ 20Mhz
February 28, 2012 05:44PM
Quote

I also purchased an STK500 development board so that I could program a bootloader on the chip.

It's nice you have this now, but Gen7 happily allows to program factory fresh ATmegas on board. In fact, I use the Gen7 1.2 prototype now as a programmer.

Quote

If I insert a 20Mhz crystal into the board, set it to use the external reference - as SOON as I set the fuses to use the external crystal reference ( L:0xF7 H:0xDC E:0xFC ), the chip becomes completely unresponsive.

Judging by [www.engbedded.com] , the fuses appear OK. BTW., what's the advantage of the 644PA?

Quote

If I change the jumper back to use an internal clock reference, it runs, but the usart speed is all messed up.

USART baud rate directly depends on the processor's clock speed, so if you burn the 20 MHz bootloader, you get 115200 / 20 * 1 = 5760 baud at 1 MHz clock speed.

Now I assume this jumper is one on the development board which lets you add a crystal or not. If you'd have set the fuse to use an external crystal ("Full Swing Oscillator"), it wouldn't run off the internal oscillator. So apparently, your fuse burning didn't work. Or me is confused. smiling smiley

Quote

When not using an external reference, the programmer seems to work fine. I can program a bootloader, but I can only program arduino programs with the STK500 using the ISP - not through the chip's direct serial port - I assume because the baud rate/timing is screwed up.

True. ISP is baud rate independent as long as the bit rate is less than half the processor's clock speed.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Gen7 & 644PA @ 20Mhz
February 28, 2012 06:17PM
> Judging by [www.engbedded.com] ,
> the fuses appear OK. BTW., what's the advantage of
> the 644PA?

I think "A" means it has picopower type capability - to go into low power sleep between commands. To be honest - I bought a PA on accident - I thought I ordered a regular 644P.

> USART baud rate directly depends on the
> processor's clock speed, so if you burn the 20 MHz
> bootloader, you get 115200 / 20 * 1 = 5760 baud at
> 1 MHz clock speed.
>
> Now I assume this jumper is one on the development
> board which lets you add a crystal or not. If
> you'd have set the fuse to use an external crystal
> ("Full Swing Oscillator"), it wouldn't run off the
> internal oscillator. So apparently, your fuse
> burning didn't work. Or me is confused. smiling smiley

Perhaps it's not working correctly - I'm not sure. I'm using the AVR studio to set the fuses - should I be using Arduino instead? Here's the thing - I can take a factory fresh 644PA, plug it in, plug in a 20MHz crystal - set the jumper to use the external clock - as SOON as I program the fuse to use the external full swing oscillator - the chip becomes unresponsive. Before I load a bootloader - before I program anything.

When I have a bootloader & test program set up with fuses + 20MHz Crystal - the chip doesn't output anything at all - serial line is completely silent. If I change the jumper back to onboard clock generated by the AVR board, it will run, but the timing isn't right (I think the fastest signal it can generate is like 3.9xxMhz - I'm not sure what it's set to currently). This leads me to believe there's some other setting that's causing the chip to fail to run on the external crystal - but I don't know what that could be. Does the command line listed on the Gen7 page for setting the fuses set something else I'm not setting using AVRStudio?
Re: Gen7 & 644PA @ 20Mhz
February 28, 2012 06:25PM
Hey - I just figured one more thing out...

If I program the bootloader and the test program (which is supposed to output test messages at 9600 baud) and run off the AVR software oscillator from the STK500 - I get the test messages, but they're output at 1784 baud. I just looked it up - the max STK500 software oscillator is 3.68MHz.

20Mhz / 3.68Mhz = 5.4
9600 baud / 1784 baud = 5.4

So - the chip works (at the reduced rate). But it will not run off the 20Mhz crystal. wtf?
Re: Gen7 & 644PA @ 20Mhz
February 28, 2012 07:45PM
If you can measure 1784 baud, can you measure 20 MHz as well? Crystals need the right capacitors around them to work. See page 31ff on the 644P's full reference. What Gen7 uses is the "Full Swing Crystal Oscillator".


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Gen7 & 644PA @ 20Mhz
February 28, 2012 08:10PM
IT WORKS! Huzzah

Ok - this is definitely *NOT* how even the AVR documentation says to set up the chip with an external crystal, but it works for me.

I set the low fuse to 0xFF which equates to "External oscillator, 8MHz+, Startup Time 16K CK + 65ms". Using the "Full Swing Oscillator" setting does not work at all, but this did - go figure.

I successfully loaded Teacup & I get a perfect "start ok" at 115200 baud on chip reset. YAY!

Hopefully this helps someone else. Perhaps this should be the default settings listed on the Gen7 1.3.1 page for bootloader instead of 0xF7?
Re: Gen7 & 644PA @ 20Mhz
February 29, 2012 05:34AM
Quote

Perhaps this should be the default settings listed on the Gen7 1.3.1 page for bootloader instead of 0xF7?

Break everyone's Gen7 just because your's works? smiling smiley

Is it possible you have a 20MHz oscillator instead of an 20 MHz crystal? There must be something different in your setup.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Gen7 & 644PA @ 20Mhz
February 29, 2012 10:40AM
Well - obviously it shouldn't be the default if it does break your setup, but perhaps you could test that fuse setting? If it is more universal, it might be worth suggesting instead.

I'm sure I'm not the only one to experience this problem. This post seems to report very similar problems:
[forums.reprap.org]
Interestingly - brupje was also using a 644A. So - maybe there is something significantly different about how the A works. Perhaps it's a bug.

It's not possible I confused what I'm using - as mentioned in my first post - I'm using a 20Mhz crystal - the exact one specified on the Gen7 1.3.1 board parts page: [search.digikey.com]

I ordered it from digikey - verified it's the right one several times. I also ordered some 10ppm 20MHz crystals that I was going to test, but my setup is working now. I can test them once they come in ( [search.digikey.com] ).

FWIW - I swapped the chip to my Gen7 board and successfully connected with Pronterface @ 115200 baud. I have some 644P chips coming with the 10ppm crystals I ordered from Digikey - I can test those once they come in and see if they act any differently but both of my 644PA chips and 2 different crystals would not work with the "Full Swing" setting.

Edited 2 time(s). Last edit at 02/29/2012 10:56AM by JazzyMT.
Re: Gen7 & 644PA @ 20Mhz
March 20, 2012 10:41AM
For what it's worth I finally flashed my 644P with the default fuses and it works @ 20MHz w/o issue. I forgot to try "External oscillator, 8MHz+" to see if that worked too, but it seems something is definitely buggy on the 644PA to require that setting.
Re: Gen7 & 644PA @ 20Mhz
March 21, 2012 04:26AM
Be careful playing around with different clock fuses. Lately i've "locked me out" of an ATmega8 by accidently setting it to "external oscillator" rather than "crystal/resanator". As a result of it my programmer couldn't read or write anymore to the chip.To "repair" the chip I had to connect an other external clock source on the XTAL1 of my ATmega. There's a nice howto about this at : [www.mikrocontroller.net] ... unfortunately only in german.
Re: Gen7 & 644PA @ 20Mhz
March 26, 2012 01:23PM
That's good general advice, but I have an AVR STK500 which supplies both an onboard optional external oscillator signal and provides high voltage programming if I really mess something up. I picked mine up on ebay for like $35, but I would encourage more reprapers to get one if they want to play with the AVR chips in detail.
Re: Gen7 & 644PA @ 20Mhz
March 30, 2012 03:33PM
When I bought factory fresh 644PA I had problems with programming bootloader and firmware via usbAsp, but solved problem very fast:

1st U need to set fusebits via external program
2nd now U can write bootloader via arduino
3rd need to add 644PA chip to firmware list
4th set 644P as a default chip
5th now U can write firmware
Larasius
Re: Gen7 & 644PA @ 20Mhz
October 18, 2012 06:34PM
I had the same problem. To solve i test it with an external clock: two 22pf + 1NOT(74HC14) + the same 20GHZ crystal(removed from the board), but it only work with an addition 5K1 resistor in parallel with the crystal. Then i buy more 2 crystals, exactly the same and from the same manufacture, exchange to use this new and now it work without any resistor. Then i put this new resistor at the board and it work perfect.
It seams that 2 equals crystals made by the same manufacture doesn't respond equal at the same circuit.
Sorry, only registered users may post in this forum.

Click here to login