How to (efficiently) find what pins map to a given peripheral?

Discussion in 'Embedded Systems and Microcontrollers' started by akrylik, Mar 29, 2014.

  1. akrylik

    Thread Starter New Member

    Nov 18, 2012
    6
    0
    I'm working specifically with the LPC4078FBD100 but this applies to any MCU I think.

    When I'm drawing the schematic for a new board, I want to know what pins on the MCU map to the given peripheral that I'm wiring up at the moment. However, the datasheets for MCUs invariably just give a list of the pins in port/bit order with the mux'ed functions on the right. So finding all the pins that map to UART3 is a really time-consuming and error-prone process especially when you have 100+ pins. For a concrete example look at the pin mapping table for the LPC4078FBD100:

    http://www.nxp.com/documents/data_sheet/LPC408X_7X.pdf

    The pin table is 40 pages long and as such it takes forever to find anything because its organized by port and bit rather than by peripheral/function. So to find all the pins mux'ed to SPI0 for example, you literally have to scan through 40 pages and go cross-eyed as a result.

    I've heard that some people will use a spreadsheet to organize pin and function for smaller chips (<30 pins) but what happens when you get to 100+ pins? Given that most pins are mux'ed to about 4-5 different functions, that would mean you would have to type 500+ rows of pin information into the spreadsheet for these larger MCUs!

    So how does everyone deal with this issue in an efficient and robust manner?
     
    Last edited: Mar 29, 2014
  2. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    3,766
    928
    First off, that is a good question.

    To your final inquiry; 'everyone' does not need to do this. In fact, very few individuals need to do this. Reverse engineering being a rather black art, and all. :)

    The data is presented in a way that is most beneficial to those writing code and using the chips ports. I am sure you would find, if you had access to the documents available to the designing team, that the cross ref. described already exists.

    To solve your problem you might stick with the spreadsheet solutions. They would be one of the easiest and quickest to learn solutions for the 'everyone' in your question. If done correctly, they prevent oversights due to human failings.

    To accomplish this, an optical char recognition approach would be my choice.

    Lots of room in this whole idea for an insightful entrepreneur to start a small enterprise.
     
  3. akrylik

    Thread Starter New Member

    Nov 18, 2012
    6
    0
    I don't know why but it seems like you are assuming that I'm trying to reverse engineer an existing board but that is not the case. :)

    I'm designing my own board and in the process I'm finding that the pin table in the datasheet does not present the information in a way that's useful to me. For example, to decide how to arrange other components around the MCU so that routing is simple I would like to know what pins are assigned to a given function like an EMC bus or SPI.
     
    Last edited: Mar 29, 2014
  4. akrylik

    Thread Starter New Member

    Nov 18, 2012
    6
    0
    For example, I want information organized like this:

    [​IMG]

    but it takes a really long time to extract this information from the datasheet.
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    I have a similar problem using the STM32Fxxx ARM chips.

    Fortunately, STM has provided the pin-peripheral table in a useful format.
    If NXP does not have a similar table then you will have to create it yourself. It shouldn't be that difficult.

    In the first column going down is the row identifier for each port pin, PA0-PA15, PB0-PB15, etc.

    Across the top of the table is the Alternate Function, AF0 - AF15.
    Then you fill in the peripheral mapping given by NXP.

    Then I make my own pin assignment table.
    Down the first column are the bit numbers 0-15.
    Across the top are the ports, PA, PB, PC, PD, etc.
    Then I fill in how I have assigned the peripherals.

    Hope this helps.
     
  6. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
  7. akrylik

    Thread Starter New Member

    Nov 18, 2012
    6
    0
    @MrChips

    Thank you for pointing me to that table. Unfortunately, I already knew about it and it doesn't really get at what I'm going on about. Hehe. Again that table and the pin table on p 46 of the datasheet for STM32F405/415 (which I looked up since you said it was working for you):

    http://www.st.com/web/en/resource/technical/document/datasheet/DM00035129.pdf

    are both still optimized for programmers (i.e. sorted by port/bit) and not for board designers (sorted by peripheral/function). For example, for the table 84 in the User Manual that you pointed to, I would still need to scan through 5 pages of rows looking for all the port bits that say UART0 can use and then map those port bits back to the actual pins using another table and then do that for every peripheral.

    I see how these tables in their current format are useful for programmers but what about the board designers? Why don't the chip manufacturers release these tables in spreadsheet/database/text/anything-but-pdf format to begin with?
     
  8. akrylik

    Thread Starter New Member

    Nov 18, 2012
    6
    0
    Here is something else that is ironic (for me at least).

    So NXP has recognized that pin configuration is complicated (still haven't recognized the board designers yet though) and created tools like this:

    http://www.lpcware.com/content/tools/lpc-initializer

    It's actually quite useful in that you can focus on a peripheral and see (graphically) what pins are mappable and where the pins are around the chip (or under for BGA). Unfortunately, only a few chips are supported (not the one I'm using obviously) and still the data used to create the tool is stuck in the tool. Sigh.
     
  9. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    Table 7 on page 46 of the STM32F405 is the pin number definitions. I don't use this table.

    The table that is more useful is Table 9, page 61 - Alternate Function Mapping.
    Then I use the actual pinout/footprint diagram, Figure 13 on page 41 so that I can visualize how the layout is going to flow.

    Then I can make better choices as to which pin-function mapping works best for me.

    I use printed copies of these tables and pin-outs since I find it easier to use and to mark up.
     
  10. akrylik

    Thread Starter New Member

    Nov 18, 2012
    6
    0
    @MrChips

    Ah, that is definitely the best layout for a pin mapping table that I've seen for a large chip yet. I like how the peripheral families are given across the top so that you can concentrate on just 1 column when focusing on a given peripheral.

    I totally agree with printing everything out along with the pinouts image (as you can see in my earlier post) so that you can mark them up. I always run out of table space and end up moving to the floor though.
     
Loading...