PDA

View Full Version : Arbtoix-M robocontroller's ATMEGA644PA, which pins are PWM, MOSI, MISO, SCK pins ?



AykutRobotics
11-06-2018, 04:23 AM
I was using Arduino boards always but I try to learn the Arbotix-M board now to use on my robotic projects now, I am a newbie with Arbotix-M.

I try to find out the correct pin mapping for the Arbtoix-M robocontroller which uses the ATMEGA644PA; because I will try to use nrf24 and an arduino compatible pololu Dual G2 High Power Motor Shield/Driver on the Arbotix-M board to control my robot. Thus, I will change t he .cpp file of motor driver's connected pins according to that to use on the pololu motor driver.

I found this datasheet for the ATMEGA644PA and it says there are 6 pwm pins but it doesn't say which ones on the pictures shared there http://www.waveshare.net/datasheet/ATMEL_PDF/ATmega644PA.PDF.

In the internet there are lots of different pin mappings for the ATMEGA644PA so I was not so sure. Therefore, would you share me the correct pin mapping pictures for ATMEGA644PA that is used on the Arbotix-M board please ? thank you very much.

KurtEck
11-06-2018, 06:48 PM
I am not sure if there is such a picture... What I do is look at the sources.... Look where your Arbotix setup is and look in variants\arbotix2\pins_arduino.h... Or some such file and you will see things like:


const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PB, /* 0 */
PB,
PB,
PB,
PB,
PB,
PB,
PB,
PD, /* 8 */
PD,
PD,
PD,
PD,
PD,
PD,
PD,
PC, /* 16 */
PC,
PC,
PC,
PC,
PC,
PC,
PC,
PA, /* 24 */
PA,
PA,
PA,
PA,
PA,
PA,
PA /* 31 */
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV(0), /* 0, port B */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(6),
_BV(7),
_BV(0), /* 8, port D */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(6),
_BV(7),
_BV(0), /* 16, port C */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(6),
_BV(7),
_BV(0), /* 24, port A */
_BV(1),
_BV(2),
_BV(3),
_BV(4),
_BV(5),
_BV(6),
_BV(7)
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER, /* 0 - PB0 */
NOT_ON_TIMER, /* 1 - PB1 */
NOT_ON_TIMER, /* 2 - PB2 */
TIMER0A, /* 3 - PB3 */
TIMER0B, /* 4 - PB4 */
NOT_ON_TIMER, /* 5 - PB5 */
NOT_ON_TIMER, /* 6 - PB6 */
NOT_ON_TIMER, /* 7 - PB7 */
NOT_ON_TIMER, /* 8 - PD0 */
NOT_ON_TIMER, /* 9 - PD1 */
NOT_ON_TIMER, /* 10 - PD2 */
NOT_ON_TIMER, /* 11 - PD3 */
TIMER1B, /* 12 - PD4 */
TIMER1A, /* 13 - PD5 */
TIMER2B, /* 14 - PD6 */
TIMER2A, /* 15 - PD7 */
NOT_ON_TIMER, /* 16 - PC0 */
NOT_ON_TIMER, /* 17 - PC1 */
NOT_ON_TIMER, /* 18 - PC2 */
NOT_ON_TIMER, /* 19 - PC3 */
NOT_ON_TIMER, /* 20 - PC4 */
NOT_ON_TIMER, /* 21 - PC5 */
NOT_ON_TIMER, /* 22 - PC6 */
NOT_ON_TIMER, /* 23 - PC7 */
NOT_ON_TIMER, /* 24 - PA0 */
NOT_ON_TIMER, /* 25 - PA1 */
NOT_ON_TIMER, /* 26 - PA2 */
NOT_ON_TIMER, /* 27 - PA3 */
NOT_ON_TIMER, /* 28 - PA4 */
NOT_ON_TIMER, /* 29 - PA5 */
NOT_ON_TIMER, /* 30 - PA6 */
NOT_ON_TIMER /* 31 - PA7 */
};

The first two parts here show which port each pin is on and the MASK.. So pin 0 is PB0...

The digital_pin_to_timer_PGM structure actually puts in the actual pin mapping in the comments.