Jump to content
JasonL

MSP430FR5994 pins_energia.h misunderstanding

Recommended Posts

I've been trying to get an Energia sketch for the MSP430FR5994 LaunchPad Development Kit to work with a custom board I made. I used a different MSP430FR5994 package than the one on the launchpad so I need to change the pins used. It sounds like typically the way to do that is to create a new board variant with its own pins_energia.h file with the pins changed. But, it looks like the FR5994 version of the file doesn't map the pins to the actual chip, but to the booster pack headers on the development kit, implying that those are mapped to the actual chip pins somewhere else, but I can't find where that happens. I'm obviously missing something.

Thank you for your help

Share this post


Link to post
Share on other sites

Hi,

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.

 

 

 

Share this post


Link to post
Share on other sites

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[11]  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!

Share this post


Link to post
Share on other sites

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

 

 

Share this post


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...