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: MSP432运行速率问题

Part Number: MSP432P401R


遇到与原贴类似问题,请求解答

  • 我们会在测试确认后给您回复

  • 若是可以的话,请给出您的代码和相关说明,谢谢

  • 代码和原始问题中给出的类似,跑出来结果基本一直。配置系统时钟MCLK为外部晶振48MHz,从P4.3输出MCLK时钟,波形周期为20.8ns,没问题。执行IO口连续翻转语句,输出波形周期在600多ns。向了解为什么只有两句IO口翻转语句就用了30多到40个时钟周期?

  • 以下是我的测试代码:

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    /******************************************************************************
     * MSP432 Empty Project
     *
     * Description: An empty project that uses DriverLib
     *
     *                MSP432P401
     *             ------------------
     *         /|\|                  |
     *          | |                  |
     *          --|RST               |
     *            |                  |
     *            |                  |
     *            |                  |
     *            |                  |
     *            |                  |
     * Author: 
    *******************************************************************************/
    /* DriverLib Includes */
    #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
    
    #include <ti/devices/msp432p4xx/inc/msp432p401r_classic.h>
    #include <arm_math.h>
    #include <arm_const_structs.h>
    
    /* Standard Includes */
    #include <stdint.h>
    #include <stdbool.h>
    
    int main(void)
    {
        /* Stop Watchdog  */
        MAP_WDT_A_holdTimer();
    
        //![Simple CS Config]
           /* Configuring pins for peripheral/crystal usage and LED for output */
           MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,
           GPIO_PIN3 | GPIO_PIN2, GPIO_PRIMARY_MODULE_FUNCTION);
           MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
    
           /* Just in case the user wants to use the getACLK, getMCLK, etc. functions,
           * let's set the clock frequency in the code.
           */
           CS_setExternalClockSourceFrequency(32000,48000000);
    
           /* Starting HFXT in non-bypass mode without a timeout. Before we start
           * we have to change VCORE to 1 to support the 48MHz frequency */
           MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
           MAP_FlashCtl_setWaitState(FLASH_BANK0, 1);
           MAP_FlashCtl_setWaitState(FLASH_BANK1, 1);
           CS_startHFXT(false);
    
           /* Initializing MCLK to HFXT (effectively 48MHz) */
           MAP_CS_initClockSignal(CS_MCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
           //![Simple CS Config]
    
           P3OUT = 0x00;
           P3OUT = 0x01;
           P3OUT = 0x00;
           P3OUT = 0x01;
           P3OUT = 0x00;
    
           P3MAP01 = 0x00;
           P3MAP01 = 0x01;
           P3MAP01 = 0x00;
    
           /* Configuring SysTick to trigger at 12000000 (MCLK is 48MHz so this will
           * make it toggle every 0.25s) */
           MAP_SysTick_enableModule();
           MAP_SysTick_setPeriod(12000000);
           MAP_Interrupt_enableSleepOnIsrExit();
           MAP_SysTick_enableInterrupt();
    
           /* Enabling MASTER interrupts */
           MAP_Interrupt_enableMaster();
    
        while(1)
        {
            MAP_PCM_gotoLPM0();
            
        }
    
    }
    
    void SysTick_Handler(void)
    {
    
        GPIO_setOutputHighOnPin(GPIO_PORT_P1, GPIO_PIN0);
        GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);
    
    }
    

  • 你好,看了您的源码和运行对比了下,为什么我这边PXOUT = 0x00的指令周期是您的2倍呢?

  • 为什么我这边PXOUT = 0x00的指令周期是您的2倍呢?

    应该和编译器的优化有关。您看一下我们两者的汇编语句是不相同的。

    您可以尝试改变为不同优化等级来具体看一下