Go Down

Topic: Mapping PB6 and PB7 (Xtal pins) on a bare ATmega328 (Read 3557 times) previous topic - next topic

hoedus

Hi everybody,
I'm new to Arduino and I have a question about pin mapping.
I read the examples of this page (http://arduino.cc/en/Tutorial/ArduinoToBreadboard) to make the minimal circuit with the internal oscillator (I wanted as few parts as possible and a good oscillator was not at all mandatory). I thought I could use the Xtal pins as I/O pins, but don't know how to map them in Arduino.
Can anybody help me with that?
I wanted to use them, because that made the layout of my PCB much easier... Now I'm not sure it was a really good idea.
Thanks for the help!

PaulS

Quote
I thought I could use the Xtal pins as I/O pins

What made you think that?

Quote
I wanted to use them, because that made the layout of my PCB much easier

Of course, you tested this on a breadboard first, right?

Quote
Now I'm not sure it was a really good idea.

I wonder why...
The art of getting good answers lies in asking good questions.

hoedus

Quote
What made you think that?


I'm just discovering Arduino, and I thought it was kind of a soft "layer" that helped programming Atmega microctrollers, but still allowed the use of all the functions of the ATmega.
Moreover, the fact that the tutorial proposes a "Minimal Circuit (Eliminating the External Clock)" made me think that all the pins of the controller would be available in this configuration (if this is wrong, I think they should mention it in the tutorial...).

Quote
Of course, you tested this on a breadboard first, right?


Of course I did.To one exception: the mapping was different for those two pins. When creating the PCB, these pins were just much more convenient to use. I assumed that just a remapping of two pins would be OK, without needing a new trial.

Quote
Now I'm not sure it was a really good idea.
I wonder why...


OK, so please could you give me a clear answer? Is it possible to use these pins, and if not, is it possible to modify a config file somewhere in order to make it possible?  (the ATmega can do it, so I guess the permanent mapping PB6=XTAL1 and PB7=XTAL2 must be written somewhere...)

Thank you very much

rbtying

It's possible, but you'll need to use direct port register manipulation - the Arduino firmware/libraries don't support them.

kabturek

It's possible to use these pins without direct port register manipulation but you have to make a small change to the arduino core.
I've mapped them to digital 20/21 and written a little howto here:
http://placeboaudio.com/how-tu-use-atmega-pb6-pb7-with-arduino-when-n

Hope that helps :)

stundenblume

Hi,

everybody who wants to map the pins PB6 and PB7 to D20 and D21 is referring to the howto of kabturek. But that site is down. Can anybody please share his experience with this topic.


Thanx

Sebastian

stundenblume

Me again,

I found a version of his howto at web.archiv.org.


Sebastian

Go Up