Yes, of course you can do that. Just for the Launchpad the numbering is always done on the boarder of the PCB = Pin Headers of the board, as this is the point where a typical user would connect something.
If you prefer for your own board to have the device pin numbers used - you can do that.
Doing the updates as you mentioned above should do that 🙂
To get the board in the GUI you need to
- add a device in the variants folder - as just discussed with the update of the pins_energia.h file
- add a section into the boards.txt file (located in the folder above)
in a section the name before the dot needs to be identical (all lines need to start with that) and this name needs to be unique
So take the existing MSP430F5994 part, replace the name before the dot and the name = display name in the selection drop down menu
Ok, just to be sure I understand what I'm supposed to do. So, I can ignore that for the launchpad they used the pin numbers for the headers, instead of the pin out on the 80 pin chip on the board, and replace it with the pin out of the 48 pin package that I used on my custom board.
At line 45, I would change to SS0 = 16 because that's the pin that P4.0 is on the 48 pin package (if I had used that as the EUSCI_B0 chip select pin)
line 216, I'll shorten the whole section to be 48 long, and match the pins to their function. So, whatever line is pin 16 will be:
static const uint8_t P4_0 = 16;
And then the arrays down below, I shorten them to be 49 long, since there is no pin 0, and rearrange them so the pins correspond to the position in the array. So, for example, digital_pin_to_timer or the 12th line of the array would be :
T0B2, /* 11 - P1.5 */
because on pin 11 there's the timer TB0.2 and the digital pin 1.5, even changing the comments so I don't confuse myself in case I have to come back to it in a few months. And then do the same for the other arrays.
Did I miss anything? Other than trying to make the new board variant show up in the IDE, and maybe using different pins in the section at line 45 because I used EUSCI_A1 for spi, instead of B0. I'll make new threads for those if I can't figure them out.
Thank you so much!
I was wondering if anyone could help? I am trying to drive a servomotor using MSP-EXP430F5529LP. I need to drive the servo to a position, then I disconnect power to the servo using an analog switch. The servo isn't under any great load, so it doesn't move when power is disconnected. Problem is MSP430 is still drawing ~ 525 uA. When I comment out myservo.attach(P2_5), the current consumption drops to the desired 2 uA. I've stripped away most of the code to aid debugging (see below). As far as I can tell, servo.attach() is what's causing the problem. I've read elsewhere that servo.detach() simply stops PWM signals from reaching the previously attached pin (P2_5) and that the timer is still running. Presumably this is why I'm drawing so much current. Can I just set the mode control bit in the TACTL register to stop the timer? Not sure if this would be enough?
P1DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;
P1OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT5)+(~BIT6)+(~BIT7);
P2DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT6+BIT7;
P2OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT6)+(~BIT7);
P3DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;
P3OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT5)+(~BIT6)+(~BIT7);
P4DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;
P4OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT5)+(~BIT6)+(~BIT7);
P5DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;
P5OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT5)+(~BIT6)+(~BIT7);
P6DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;
P6OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT5)+(~BIT6)+(~BIT7);
P7DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;
P7OUT &= (~BIT0)+(~BIT1)+(~BIT2)+(~BIT3)+(~BIT4)+(~BIT5)+(~BIT6)+(~BIT7);
P8DIR |= BIT0+BIT1+BIT2;
P8OUT &= (~BIT0)+(~BIT1)+(~BIT2);
you are right the pins_energia.h file is the correct location for that.
Just let me give you one example of how the mapping works.
(line numbers are based on latest released version (1.0.7)
line 45 : = pin header
static const uint8_t SS0 = 47; /* P4.0 */
line 216: = pin header
static const uint8_t P4_0 = 47;
Beginning with line 457 the mapping from the pin header to the device function is done
With the function above
line 505 - tells it has not Timer
line 560 - tell it is on Port 4
line 615 - tell it is on Port4 but now more explicit on Port 4.0
line 670 - tell is has Analog input 8
The final mapping can now be found in the datasheet. Check for mapping of Port 4.0 to the pin mapping of the device variant.