Hello!
I have developed a sketch that works well on the Arduino Mega but the Mega 2560 is much too much for my purposes. I am quite fond of the ATmega32A (surface mount variant) and the feature set that it offers. I do have a board where this chip is mounted with minimum support circuitry so that is not the issue. My problem is getting the Arduino sketch to correctly compile for the chip. The software does upload successfully (through USBasp), but the definition of the pins seem to be incorrect.
It is my understanding that I need to modify pins_arduino.h & boards.txt.
I have replaced the existing files with ones that contained the ATmega32A through hole package. In order to get the code to work I obviously need to edit the pins.arduino.h and boards.txt.
Questions related to pins_arduino.h:
For items such as
static const uint8_t SDA= 20;
static const uint8_t SCL = 19;
static const uint8_t MISO= 2;
static const uint8_t MOSI= 1;
static const uint8_t SCK = 3;
static const uint8_t SS = 44;
**1.**Is the numerical value referring to the physical pin on the chip or the value defined later.
By this I mean is this number the number on the datasheet or the number being defined by the digital number. By digital number I mean items such as
const uint8_t PROGMEM digital_pin_to_port_PGM[32] = {
PB, // PB0 ** D0
PB, // PB1 ** D1
PB, // PB2 ** D2
PB, // PB3 ** D3
PB, // PB4 ** D4
PB, // PB5 ** D5
ect.
2. How would I define a PWM pin and is this necessary?
3. Is there anything else I need to consider of high importance of this file. The definition of PB0-PB7, PD0-PD7, PC0-PC7, PA0-PA7 seems correct. It's just the "special functions" I'm having a problem with. By special I am referencing the previous two questions. (Functions involving TX/RX, SCK/SCL, and PWM).
Any other advice / literature in reference to this file would be greatly appreciated.
Questions related to boards.txt:
1 Just wondering if there is anything incorrect/improper here.
Here is what I am using for my boards.txt and I am using a 8 MHz Clock
mega32-8.name=ATmega32a-External 8mhz
mega32-8.build.mcu=atmega32A
mega32-8.build.f_cpu=8000000L
mega32-8.build.core=arduino:arduino
mega32-8.build.variant=mega32-
mega32-8.build.board=AVR_MEGA32-8000000L
mega32-8.upload.tool=avrdude
mega32-8.upload.maximum_size=32256
mega32-8.bootloader.low_fuses=0xEF
mega32-8.bootloader.high_fuses=0x89
#mega32-8.bootloader.extended_fuses=0xFD
Any literature and input anyone has would be greatly valued!
Thank you,
Mat
P.S. I apologize if I'm missing any pertinent information or if I posted incorrectly (related to format) Advice for posting is welcome as well.