GithubHelp home page GithubHelp logo

AVR Programming Method about nesizer2 HOT 8 CLOSED

beau-seidon avatar beau-seidon commented on August 27, 2024
AVR Programming Method

from nesizer2.

Comments (8)

beau-seidon avatar beau-seidon commented on August 27, 2024

I also have an Arduino Uno board I can drop the Atmega into, which would be much simpler and my preferred method if it would work,

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

Hi Beau,

The way I have been doing the programming is to just have the Atmega328 seated in the board and use the 6 pin header (SV1) on the board to program it. The pin header provides an ISP (In-circuit Serial Programming) interface directly to the Atmega. I've used an old ICE programmer for that, but it should be pretty straight forward to use a Raspberry Pi as an ISP programmer: https://learn.adafruit.com/program-an-avr-or-arduino-using-raspberry-pi-gpio-pins/installation

There are probably many ways to go about this, but the reason why I recommend to just keep the Atmega in the board when programming, is that the Atmega will be programmed with new fuse settings which change the clocking from internal oscillator to using an external clock. So after the first time the Atmega has been programmed and gotten new fuse settings, it will not be possible to program again without an external clock running. Since the NESizer already has that clock there, it is easiest to just keep the Atmega in the board.

from nesizer2.

beau-seidon avatar beau-seidon commented on August 27, 2024

Perfect. That's even simpler and makes it less likely for me to screw it all up.
The external clock I was going to use is a 16 MHZ crystal with caps, whereas yours uses a 20 connected to an inverter.
I was concerned about the clock difference which is why I asked.

Also that's one of the links I have bookmarked for programming reference, so at least I'm on the right path there.

Thank you!

from nesizer2.

beau-seidon avatar beau-seidon commented on August 27, 2024

Would it be a good idea to assemble everything and then program the Atmega before inserting the 2A03 in its socket, or does it need to be in there when I program it?

My biggest priority is to protect the 2A03, since it is the only precious component.

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

You can program it without the 2A03 in there. I think all you would need on the board to just program the Atmega is the power supply, ISP connector and clock circuit.

Note that you can not test that the Atmega is actually working correctly until a 2A03 is inserted, because the initialization code is going to hang if it does not get contact with the 2A03. But if you manage to program it with avrdude and set the fuses, than you can be very sure that the Atmega itself is going to work.

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

I think taking it out and using a 16 MHz crystal would not work, because the fuse setting is to use an external clock on XTAL1 - not external crystal with capacitors connected across XTAL1 - XTAL2.

The inverters in the circuit diagram are there to make a clock signal together with the crystal and capacitors. It is a typical and easy way to make a clock generator circuit. The reason why this is done and not connecting the crystal and capacitors directly to the Atmega, is that the same clock is also used to clock the 2A03, so that the two can be exactly synchronized.

If you made a full clock generator circuit around the 16 MHz crystal and connected it to XTAL1, then I think it would also work fine to program it on an external breadboard.

from nesizer2.

beau-seidon avatar beau-seidon commented on August 27, 2024

When I set the ATmega fuse bits, I used the following settings:

-U lfuse:w:0xe0:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m 

which, for ATmega328P, corresponds to:

Ext. Clock, Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms; [CKSEL=0000 SUT=10] and no internal clock division.

Other than the the External Clock, and no division, I left everything else default. Does that sound right to you?
Obviously, it's at least close, because the NESizer is working, but I want it to be right.

I used the following calculator to determine what arguments to pass to avrdude
https://www.engbedded.com/fusecalc/

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

Yes, that is the same settings I have used!

from nesizer2.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.