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.

MSP432P401R: PMAP Example

Part Number: MSP432P401R

I could find only a few PMAP examples and all of them related to PWM signals.

I notice that P7 is pin-mapable and is not wired to any hardware on the launchpad except the Jx connectors used for boosterpacks, so I choose P7 for my multiple-bus example.

Suppose I do this:

const uint8_t * myP7map[8] = {UCA1TXD, UCA1RXD,  UCB1SDA, UCB1SCL, UCB2SOMI, UCB2SIMO, UCB2CLK, UCA2TXD}

MAP_PMAP_configurePorts( (const uint8_t *) myP7map, PMAP_P7MAP, 8, PMAP_DISABLE_RECONFIGURATION);

P7->SEL0 = 0xFF; //  If I understand correctly, I must setup secondary function

P7->SEL1 = 0x00;

// I don't need to set DIR because all the above functions will do it automatically.

Will this work?

Thanks

  • As in a previous post, the linker still objects to driverlib calls in my CCS installation, so I have re-written this snippet user register-level code. The following snippet compiles and links, but I have not tried downloading and executing it yet. This at least takes me further into my "journey of discovery" regarding MSP432.

        const uint8_t myP7map[8] = {PMAP_UCA1TXD, PMAP_UCA1RXD, PMAP_UCB0SDA, PMAP_UCB0SCL, PMAP_UCB2SOMI, PMAP_UCB2SIMO, PMAP_UCB2CLK, PMAP_UCA2TXD};
    //    MAP_PMAP_configurePorts( (const uint8_t *) myP7map, PMAP_P7MAP, 8, PMAP_DISABLE_RECONFIGURATION);  // doesn't link
        uint8_t i;
        volatile uint8_t *ptr;
        PMAP->KEYID = PMAP_KEYID_VAL;                  // Enable Write-access to modify port mapping registers
        ptr = (volatile uint8_t *) (&P7MAP->PMAP_REGISTER[0]);
        for (i = 0; i < 8; i++)
        {
            *ptr = myP7map[i];
            ptr++;
        }

        PMAP->KEYID = 0;                        // Disable Write-Access to modify port mapping registers

        P7->SEL0 = 0xFF; //  If I understand correctly, I must setup secondary function... not verified yet
        P7->SEL1 = 0x00;

  • David,

     The Linker really shouldn't be an issue. Have you tried the pmap_timera_redirection example from Resource Explorer? Does that compile/link?

    For what you are trying to do with PMAP, you still need to assign a given pin Peripheral module function AND direction (in addition to specifying with PMAP what peripheral is getting mapped there.  (See Section 12.2.6, 2nd paragraph of the MSP432 Technical Reference manual, which mentions the need to set PxDIR bits). Using the driverlib API calls below should do this for you.

    For example, from the above timera_redirection code, you see:

    const uint8_t port_mapping[] =
    {
    //Port P2:
    PMAP_NONE, PMAP_NONE, PMAP_NONE, PMAP_NONE, PMAP_TA1CCR1A, PMAP_NONE,
    PMAP_NONE, PMAP_NONE
    };

    // Map ports occording to values in port_mapping array (handles KEYID/etc automatically)
    MAP_PMAP_configurePorts((const uint8_t *) port_mapping, PMAP_P2MAP, 1,
    PMAP_DISABLE_RECONFIGURATION);

    // Set PAxSEL and PAxDIR for the given port & Pins
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);

    Let me know if this works for you, and if the timera_redirection example compiles properly.

    -Bob L.

  • Thanks for the advice, but Ive messed up driverlib installation, I suppose, so until I fix it, I must use register-level commands.
    One thing I don't understand is why you and pmap_timera_redirection.c specify GPIO_PRIMARY_MODULE_FUNCTION (means SEL0=0, SEL1=0, I assume),
    whereas:
    1. msp432p401x_portmap_01.c, William Goh 2016 uses
    P2->SEL0 = 0xFF; // P2.0 - P2.6 Port Map functions
    P2->SEL1 = 0; // P2.0 - P2.6 Port Map functions
    If I understand how this works, it specifies the SECONDARY function
    2. SLAU356E section 11.2.2 says
    The port pin itself is switched from a general purpose I/O to the selected peripheral/secondary function by setting the corresponding PxSEL.y bit to 1.
    As I indicated, I am new to the MSP432.... never downloaded/run a single program so far; I am gearing up to all that. You know more than I do, but I am trying to resolve inconsistencies now, rather than in the more expensive future.

    Also, my entire example above involved bus signals, UARTs, I2C, SPI and the direction is set by the module, NOT, NOT using Px->DIR.
    Thanks for your help.
  • David,

    Could you send a screenshot of the error you get when trying to compile using driverlib calls?

    -Bob

  • In my large program, I commented out all the driverlib calls in order to progress. I put one, the simplist, back:

        MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,
        GPIO_PIN3 | GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);   // Pins for peripheral/crystal usage

    Here is the CDT Build Console output at the end of the compile stage:

    'Finished building: ../main.c'
    ' '
    'Building target: HomeNetworkMSP432.out'
    'Invoking: ARM Linker'
    "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --advice:power="all" --define=__MSP432P401R__ --define=ccs -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi -z -m"HomeNetworkMSP432.map" --heap_size=1024 --stack_size=512 -i"C:/ti/ccsv7/ccs_base/arm/include" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="HomeNetworkMSP432_linkInfo.xml" --rom_model -o "HomeNetworkMSP432.out" "./main.obj" "./startup_msp432p401r_ccs.obj" "./system_msp432p401r.obj" "../msp432p401r.cmd"  -llibc.a
    <Linking>

     undefined                                   first referenced
      symbol                                         in file     
     ---------                                   ----------------
     GPIO_setAsPeripheralModuleFunctionOutputPin ./main.obj      

    error #10234-D: unresolved symbols remain
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 1 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    error #10010: errors encountered during linking; "HomeNetworkMSP432.out" not built
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 2 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 3 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    .... etc.

    a) it cannot link the driverlib function. Does the fact that they compile mean that the driverlib header file was discovered?

    b) every single port is uninitialized... I don't know if this is a related fault or not, but the ports are initialized.

    c)no one answered my question about whether primary or secondary function should be used for the P7 port in my example However, I guess that I will find out soon enough once I download and execute.

    Thanks for taking an interest.

  • Hi Bob Landers.... were you able to figure out why Driverlib won't link? As you can see, it compiles.

    Thanks.

  • David,

     From here, this is what I would suggest:

    1. reinstall your SimpleLink MSP432P4 SDK from the download site. (Make sure you select MSP432, not MSP432E4). Make sure that it gets installed at c:\ti

    I realize you may not want to do this, so the following steps apply even if you choose not to do step 1 initially.

    2. Check the Linker include paths by right-clicking the CCS project int the Project Explorer window and selecting "Settings"

    3. In the Settings window, select "ARM Linker-> File Search Path" as shown below. Verify that the settings match what is shown here:

    4. Next, Verify that the SimpleLink Resource variables are set properly for your install. Check the picture below for reference:

    I would strongly suggest going through ALL these steps including the reinstall, but either way, you clearly have a corrupted path for the driverlib calls. 

    Regards,

      Bob L.

**Attention** This is a public forum