This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401M: How to use port mapper module (PMAP) with TI drivers to change pin functions on the fly

Part Number: MSP432P401M

Is the port mapper (PMAP) feature supported within TI drivers? We need to change pin functions on-the-fly in a firmware project that uses TI drivers. I see a module for this in driverlib but I'm not sure how this will interact with TI drivers if we change PMAP pin configurations at runtime.

  • Hi Ruben,

    Not sure on this one.  Let me ask around.

  • Hi Ruben,

    I finally tracked down someone (Chris Yorkey) that might know the answer here.

  • Hey guys,

    So this is a good question.  I do have some experience with using the PMAP feature on MSP432P and actually have a customer that has done some work with it as well.  What I can say is that PMAP is supported within TI drivers and in fact mapping can even be configured during runtime.  As far as any specific intricacies or interrelated Gotchas, I can't really comment further.

    Check out this link for some additional details on DriverLib PMAP Operation:

    https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP432_Driver_Library/latest/exports/driverlib/msp432_driverlib_3_21_00_05/doc/MSP432P4xx/html/driverlib_html/group__pmap__api.html

    I will also reach out to my customer to see if there are any other thoughts or input to share.

    Thanks,

    Chris

  • Thanks Chris and Dennis. I'm glad to know this works and PMAP config can be changed on-the-fly with TI drivers. A working example would be great to look at.

    I had read the API description, but the simple timer example there doesn't show how to change back and forth between two pin functions. My assumption is that you would need to have multiple versions of the port mapper configuration register; one for each function that will be assigned to the pin. For example, see below where port_mapping1 corresponds to timer TA1 CCR1 compare output Out1 (PM_TA1CCR1A) on P2.4 and port_mapping2 corresponds to eUSCI_A0 SPI slave in master out (PM_UCA0SIMO) on P2.4.

    The part that I'm unclear about is that TI drivers require a single pin function to be mapped to each pin for the driver. The examples typically do this statically, but in the case below I need to assign two different driver functions (SPI and timer) to a single pin. If I want to switch between these on-the-fly do I need to use PIN_open()/Pin_close() calls with two different pin tables every time we want to switch the pin functions? This would be cumbersome and I assume it would add significant latency.

    I would prefer it if I could just open both drivers (SPI and timer) using the same pin and then just use the PMAP call to switch the pin functions "under the hood" when I need to switch from SPI to timer and back. Of course we would be careful not to switch the pins in the middle of an active transaction. Do you have any additional details on how to handle the TI driver pintable "overloading" I'm thinking of?

    /* Port mapper configuration register */
    const uint8_t port_mapping1[] =
    {
    //Port P2:
    PM_NONE, PM_NONE, PM_NONE, PM_NONE, PM_TA1CCR1A, PM_NONE, PM_NONE,
    PM_NONE
    };
    
    /* Port mapper configuration register */
    const uint8_t port_mapping2[] =
    {
    //Port P2:
    PM_NONE, PM_NONE, PM_NONE, PM_NONE, PM_UCA0SIMO, PM_NONE, PM_NONE,
    PM_NONE
    };
    
    /* Remapping  TACCR0 to P2.4 */
        MAP_PMAP_configurePorts((const uint8_t *) port_mapping1, PMAP_P2MAP, 1,
                PMAP_ENABLE_RECONFIGURATION);
                
    /* Remapping  PM_UCA0SIMO to P2.4 */
        MAP_PMAP_configurePorts((const uint8_t *) port_mapping2, PMAP_P2MAP, 1,
                PMAP_DISABLE_RECONFIGURATION);

  • Hey guys,

    You bring up some really good points.  I think the PMAP function ideally works best when remapping pins from the same peripheral block, thus avoiding the need to assign two different driver functions to a single pin, like you mentioned.  In this case, with 2 driver functions (SPI and Timer) I too am not sure if this can be done natively (without 'manually' reassigning the 2 different driver functions) or not.

    I suppose one could first try testing the Option1 (reassign 2 driver functions manually) route to see if it is functional and efficient enough.  If not, unfortunately there doesn't appear to be a readily available Option 2 (reassign natively) that we could work with, since I too agree with you that the 'overloading' may need to be handled appropriately.

    I did touch base with my customer today and unfortunately, they aren't going to be in a position to add much more commentary than we already exchanged.

    I'll think about this some more and peruse the 'Net to see if maybe, just maybe, someone else has done this already.

    Regards,

    Chris

  • Hi Ruben,

    Can you provide a customer update?  Did Chris' help point the customer in the right direction?

  • Dennis, we were not able to figure out how to use PMAP TI driver to change pin functions between two peripherals on-the-fly. The customer found another way to solve the system level problem so feel free to close this. Thanks!