Jump to content
43oh

Pin Map for MSP430G2553 RHB package


Recommended Posts

Hi All,

 

As part of my droplet project I modified the pins_energia.h file in a new varient to support my hardware using the 32pin QFN version of G2553.

 

I did run into one issue that I currently do not know how to solve.

 

The issue is that I placed the GDO0 pin of CC110L on a port 3 pin.  The radio core uses "attachInterrupt" to place an interrupt on that pin but my current theory is that it is not being registered.  If I make a jumper to a different port 2 port, life is good.  Here's the pins_energia:

#define __MSP430_HAS_PORT3_R__
#define IMP_GURU_HUB
#ifndef Pins_Energia_h
#define Pins_Energia_h
#ifndef BV
#define BV(x) (1 << (x))
#endif

#if defined(__MSP430_HAS_USCI__)
static const uint8_t SS      = 16;  /* P2.4 */
static const uint8_t SCK     = 5;  /* P1.5 */
static const uint8_t MOSI    = 22; /* P1.7 */
static const uint8_t MISO    = 21; /* P1.6 */
static const uint8_t TWISDA  = 22;  /* P1.6 */
static const uint8_t TWISCL  = 21;  /* P1.7 */
static const uint8_t DEBUG_UARTRXD = 1;  /* Receive  Data (RXD) at P1.1 */
static const uint8_t DEBUG_UARTTXD = 2;  /* Transmit Data (TXD) at P1.2 */
#define TWISDA_SET_MODE  (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */
#define TWISCL_SET_MODE  (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/)
#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT)
#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT)
#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1)
#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1)
#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1)
#endif

#define DEBUG_UART_MODULE_OFFSET 0x0

#if defined(__MSP430_HAS_USI__)
static const uint8_t SS      = 16;  /* P2.4 */
static const uint8_t SCK     = 5;  /* P1.5 */
static const uint8_t MOSI    = 22; /* P1.7 */
static const uint8_t MISO    = 21; /* P1.6 */
static const uint8_t TWISDA  = 22;  /* P1.6 */
static const uint8_t TWISCL  = 21;  /* P1.7 */
static const uint8_t DEBUG_UARTRXD = 1;  /* Receive  Data (RXD) at P1.1 */
static const uint8_t DEBUG_UARTTXD = 2;  /* Transmit Data (TXD) at P1.2 */
#define TWISDA_SET_MODE  (PORT_SELECTION0 | INPUT_PULLUP)
#define TWISCL_SET_MODE  (PORT_SELECTION0 | INPUT_PULLUP)
#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT)
#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT)
#endif

#define DEBUG_UART_MODULE 0x0

static const uint8_t A0  = 31;
static const uint8_t A1  = 1;
static const uint8_t A2  = 2;
static const uint8_t A3  = 3;
static const uint8_t A4  = 4;
static const uint8_t A5  = 5;
static const uint8_t A6  = 21;
static const uint8_t A7  = 22;
static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor

//                      +-+-+-+-+-+-+-+-+-+
//               VCC   1|                 |20  GND
//         (A0)  P1.0  2|                 |19  XIN
//         (A1)  P1.1  3|                 |18  XOUT
//         (A2)  P1.2  4|                 |17  TEST
//         (A3)  P1.3  5|                 |16  RST#
//         (A4)  P1.4  6|                 |15  P1.7  (A7) (SCL) (MISO) depends on chip
//         (A5)  P1.5  7|                 |14  P1.6  (A6) (SDA) (MOSI)
//               P2.0  8|                 |13  P2.5
//               P2.1  9|                 |12  P2.4
//               P2.2 10|                 |11  P2.3
//                      +-+-+-+-+-+-+-+-+-+
//

// Pin names based on the silkscreen
//
static const uint8_t P1_1 = 1;
static const uint8_t P1_2 = 2;
static const uint8_t P1_3 = 3;
static const uint8_t P1_4 = 4;
static const uint8_t P1_5 = 5;
static const uint8_t P3_1 = 6;
static const uint8_t P3_0 = 7;
static const uint8_t P2_0 = 9;
static const uint8_t P2_1 = 10;
static const uint8_t P2_2 = 11;
static const uint8_t P3_2 = 12;
static const uint8_t P3_3 = 13;
static const uint8_t P3_4 = 14;
static const uint8_t P2_3 = 15;
static const uint8_t P2_4 = 16;
static const uint8_t P2_5 = 17;
static const uint8_t P3_5 = 18;
static const uint8_t P3_6 = 19;
static const uint8_t P3_7 = 20;
static const uint8_t P1_6 = 21;
static const uint8_t P1_7 = 22;
static const uint8_t P2_7 = 25;
static const uint8_t P2_6 = 26;
static const uint8_t P1_0 = 31;

static const uint8_t RED_LED = 17;
static const uint8_t GREEN_LED = 16;
static const uint8_t LNA_EN = 26;
static const uint8_t PA_EN = 25;
static const uint8_t HGM = 31;


static const uint8_t TEMPSENSOR = 10; // depends on chip


#ifdef ARDUINO_MAIN

const uint16_t port_to_input[] = {
	NOT_A_PORT,
	(uint16_t) &P1IN,
	(uint16_t) &P2IN,
#ifdef __MSP430_HAS_PORT3_R__
	(uint16_t) &P3IN,
#endif
};

const uint16_t port_to_output[] = {
	NOT_A_PORT,
	(uint16_t) &P1OUT,
	(uint16_t) &P2OUT,
#ifdef __MSP430_HAS_PORT3_R__
	(uint16_t) &P3OUT,
#endif
};

const uint16_t port_to_dir[] = {
	NOT_A_PORT,
	(uint16_t) &P1DIR,
	(uint16_t) &P2DIR,
#ifdef __MSP430_HAS_PORT3_R__
	(uint16_t) &P3DIR,
#endif
};

const uint16_t port_to_ren[] = {
	NOT_A_PORT,
	(uint16_t) &P1REN,
	(uint16_t) &P2REN,
#ifdef __MSP430_HAS_PORT3_R__
	(uint16_t) &P3REN,
#endif
};

const uint16_t port_to_sel0[] = {  /* put this PxSEL register under the group of PxSEL0 */
	NOT_A_PORT,
	(uint16_t) &P1SEL,
	(uint16_t) &P2SEL,
#ifdef __MSP430_HAS_PORT3_R__
	(uint16_t) &P3SEL,
#endif
};

const uint16_t port_to_sel2[] = {
	NOT_A_PORT,
#ifdef P1SEL2_
	(uint16_t) &P1SEL2,
#else
        NOT_A_PORT,
#endif
#ifdef P2SEL2_
	(uint16_t) &P2SEL2,
#else 
        NOT_A_PORT,
#endif
#ifdef P3SEL2_
	(uint16_t) &P3SEL2,
#else
        NOT_A_PORT,
#endif
};


/* 
 * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available
 * T0A1, T1A1 and T1A2 
 */
const uint8_t digital_pin_to_timer[] = {
	NOT_ON_TIMER, /*  dummy */
	NOT_ON_TIMER, /*  1 - VCC */
	NOT_ON_TIMER, /*  2 - P1.0 */
	T0A0,         /*  3 - P1.1, note: A0 output cannot be used with analogWrite */
	T0A1,         /*  4 - P1.2 */
	NOT_ON_TIMER, /*  5 - P1.3 */
	NOT_ON_TIMER, /*  6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */
	T0A0,         /*  7 - P1.5 note: A0 output cannot be used with analogWrite  */
#if defined(__MSP430_HAS_T1A3__) 
	T1A0,         /*  8 - P2.0 note: A0 output cannot be used with analogWrite */
	T1A1,         /*  9 - P2.1 */
	T1A1,         /* 10 - P2.2 */
	T1A0,         /* 11 - P2.3 note: A0 output cannot be used with analogWrite  */
	T1A2,         /* 12 - P2.4 */
	T1A2,         /* 13 - P2.5 */
#else
	NOT_ON_TIMER, /*  8 - P2.0 */
	NOT_ON_TIMER, /*  9 - P2.1 */
	NOT_ON_TIMER, /* 10 - P2.3 */
	NOT_ON_TIMER, /* 11 - P2.4 */
	NOT_ON_TIMER, /* 12 - P2.5 */
	NOT_ON_TIMER, /* 13 - P2.6 */
#endif
	T0A1,         /* 14 - P1.6 */
	NOT_ON_TIMER, /* 15 - P1.7 */
	NOT_ON_TIMER, /* 16 - /RESET */  
	NOT_ON_TIMER, /* 17 - TEST */  
	NOT_ON_TIMER, /* 18 - XOUT - P2.7 */
	T0A1,         /* 19 - XIN - P2.6: */
	NOT_ON_TIMER, /* 20 - GND */
};

const uint8_t digital_pin_to_port[] = {
	NOT_A_PIN, /* dummy */
	P1, /* 1 */
	P1, /* 2 */
	P1, /* 3 */
	P1, /* 4 */
	P1, /* 5 */
	P3, /* 6 */
	P3, /* 7 */
	NOT_A_PIN, /* 8 */
	P2, /* 9 */
	P2, /* 10 */
	P2, /* 11 */
	P3, /* 12 */
	P3, /* 13 */
	P3, /* 14 */
	P2, /* 15 */
	P2, /* 16 */
	P2, /* 17 */
	P3, /* 18 */
	P3, /* 19 */
	P3, /* 20 */
	P1, /* 21 */
	P1, /* 22 */
	NOT_A_PIN, /* 23 */
	NOT_A_PIN, /* 24 */
	P2, /* 25 */
	P2, /* 26 */
	NOT_A_PIN, /* 27 */
	NOT_A_PIN, /* 28 */
	NOT_A_PIN, /* 29 */
	NOT_A_PIN, /* 30 */
	P1, /* 31 */
	NOT_A_PIN, /* 32 */
};

const uint8_t digital_pin_to_bit_mask[] = {
	NOT_A_PIN, /* 0,  pin count starts at 1 */
	BV(1),     /* 1,  P1.1 */
	BV(2),     /* 2,  port P1.2 */
	BV(3),     /* 3,  port P1.3 */
	BV(4),     /* 4,  port P1.4 */
	BV(5),     /* 5,  port P1.5 */
	BV(1),     /* 6,  port P3.1 */
	BV(0),     /* 7,  port P3.0 */
	NOT_A_PIN, /* 8,  NC */
	BV(0),     /* 9,  port P2.0 */
	BV(1),     /* 10, port P2.1 */
	BV(2),     /* 11, port P2.2 */
	BV(2),     /* 12, port P3.2 */
	BV(3),     /* 13, port P3.3 */
	BV(4),     /* 14, port P3.4 */
	BV(3),     /* 15, port P2.3 */
	BV(4), /* 16, P2.4 */
	BV(5), /* 17, P2.5 */
	BV(5),     /* 18, P3.5 */
	BV(6),     /* 19, P3.6 */
	BV(7),     /* 20, P3.7 */
	BV(6),     /* 21, P1.6 */
	BV(7),     /* 22, P1.7 */
	NOT_A_PIN, /* 23, RST */
	NOT_A_PIN, /* 24, TEST */
	BV(7),     /* 25, P2.7 */
	BV(6),     /* 26, P2.6 */
	NOT_A_PIN, /* 27, GND */
	NOT_A_PIN, /* 28, GND */
	NOT_A_PIN, /* 29, VCC */
	NOT_A_PIN, /* 30, VCC */
	BV(0),     /* 31, P1.0 */
	NOT_A_PIN, /* 32, NC */
};
const uint32_t digital_pin_to_analog_in[] = {
        NOT_ON_ADC,     /* 0,  pin count starts at 1 */
        1,     			/* 1,  A1 */
        2,				/* 2,  A2 */
        3,     			/* 3,  A3 */
        4, 				/* 4,  A4 */
        5, 				/* 5,  A5 */
        NOT_ON_ADC, 	/* 6,  port P3.1 */
        NOT_ON_ADC,   	/* 7,  port P3.0 */
        NOT_ON_ADC, 	/* 8,  NC */
        NOT_ON_ADC, 	/* 9,  port P2.0 */
        NOT_ON_ADC, 	/* 10, port P2.1 */
        NOT_ON_ADC, 	/* 11, port P2.2 */
        NOT_ON_ADC, 	/* 12, port P3.2 */
        NOT_ON_ADC, 	/* 13, port P3.3 */
        NOT_ON_ADC,     /* 14, port P3.4 */
        NOT_ON_ADC,     /* 15, port P2.3 */
        NOT_ON_ADC, 	/* 16, P2.4 */
        NOT_ON_ADC,     /* 17, P2.5 */
        NOT_ON_ADC, 	/* 18, P3.5 */
        NOT_ON_ADC,     /* 19, P3.6 */
        NOT_ON_ADC,  	/* 20, P3.7 */
        6,  	        /* 21, A6 */
        7,              /* 22, A7 */
        NOT_ON_ADC,  	/* 23, RST */
        NOT_ON_ADC,  	/* 24, TEST */
        NOT_ON_ADC,  	/* 25, P2.7 */
        NOT_ON_ADC,  	/* 26, P2.6 */
        NOT_ON_ADC,  	/* 27, GND */
        NOT_ON_ADC,  	/* 28, GND */
        NOT_ON_ADC,  	/* 29, VCC */
        NOT_ON_ADC,  	/* 30, VCC */
        0,  			/* 31, A0 */
        NOT_ON_ADC  	/* 32, NC */
};

#endif
#endif

And here is I think where the Radio code is breaking:


  attachInterrupt(RF_GDO0, gdo0Isr, FALLING);

By the way, in the platform.h file I have the following snippit


#elif defined( IMP_GURU_HUB )
#define RF_SPI_MISO   21
#define RF_SPI_CSN    18
#define RF_GDO0       19
Link to post
Share on other sites

Oops :(  Yeah that's a small gotcha with the '430 ... Most of them only have hw int on P1 and P2, some exceptions particularly the newer FRAM series - FR5xxx/6xxx have HW interrupt on all ports, but the brand new FR41xx and upcoming FR2xxx go back to only P1 and P2 for HW interrupts.  Those latter seem to be a cheaper/more value oriented line though.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...