打印
[MCU]

MSP432中断和时钟系统

[复制链接]
703|9
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主

Task1 Install CCS local version
Previously, we played with the CCS cloud tools. If you want to try the local version, you can download the CCS from [download CCS]. The latest version is 8.3 and there are Windows, Mac, and Linux versions.
When you install the CCS local version, make sure you select the “MSP432” from the product list when installation. There two cases you must use the CCS local version
  • If your computer system USB controller cannot recognize the TI hardware, i.e., the driver issue. We have some students met this problem both in Windows and Mac platform. You can install the CCS local version to solve this problem since the CCS local version can help update the firmware.
  • The CCS cloud version does not support third part RTOS other than TI-RTOS, e.g., freeRTOS. If you want to try the freeRTSO, you have to use the local version.
After you installed the CCS local version, you will see the main page. The IDE is based on Eclipse.
Click the Resource Explore, you will see the same version as shown in the CCS cloud. Select the MSP432 board.
Select the MSP432 SDK and click install.

使用特权

评论回复

相关帖子

沙发
zhangmangui|  楼主 | 2020-11-14 13:20 | 只看该作者
Task2 GPIO Interrupt via Driverlib
  • Using the same code in Task1. Add the following code after the pin P1.0 output setup

/* Configuring P1.1 as an input and enabling interrupts */    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);    MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);    MAP_Interrupt_enableInterrupt(INT_PORT1);/* Enabling MASTER interrupts */    MAP_Interrupt_enableMaster();   
  • We will develop one example that when the switch is pressed, the LED output is toggled.
  • The previous GPIO functions can be referred from the DriverLib user guide
  • We first use “GPIO_setAsInputPinWithPullUpResistor” function to set the selected Pin in input Mode with Pull Up resistor
  • The full list of GPIO related functions are shown in the following code
Full list of GPIO related functions (P.153)void GPIO_clearInterruptFlag (uint_fast8_t selectedPort, uint_fast16_t selectedPins) void GPIO_disableInterrupt (uint_fast8_t selectedPort, uint_fast16_t selectedPins) void GPIO_enableInterrupt (uint_fast8_t selectedPort, uint_fast16_t selectedPins) uint_fast16_t GPIO_getEnabledInterruptStatus (uint_fast8_t selectedPort)uint8_t GPIO_getInputPinValue (uint_fast8_t selectedPort, uint_fast16_t selectedPins) uint_fast16_t GPIO_getInterruptStatus (uint_fast8_t selectedPort, uint_fast16_t selectedPins) void GPIO_interruptEdgeSelect (uint_fast8_t selectedPort, uint_fast16_t selectedPins, uint_fast8_t edgeSelect)void GPIO_registerInterrupt (uint_fast8_t selectedPort, void(∗intHandler)(void))void GPIO_setAsInputPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_setAsInputPinWithPullDownResistor (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_setAsInputPinWithPullUpResistor (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_setAsOutputPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_setAsPeripheralModuleFunctionInputPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins, uint_fast8_t mode)void GPIO_setAsPeripheralModuleFunctionOutputPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins, uint_fast8_t mode)void GPIO_setDriveStrengthHigh (uint_fast8_t selectedPort, uint_fast8_t selectedPins)void GPIO_setDriveStrengthLow (uint_fast8_t selectedPort, uint_fast8_t selectedPins)void GPIO_setOutputHighOnPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_setOutputLowOnPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_toggleOutputOnPin (uint_fast8_t selectedPort, uint_fast16_t selectedPins)void GPIO_unregisterInterrupt (uint_fast8_t selectedPort)
  • Next, we enable the Interrupt
    • We utilize “GPIO_clearInterruptFlag” to clear the interrupt flag on the selected pin, then enables interrupt “GPIO_enableInterrupt”
    • We utilize “void Interrupt_enableInterrupt ( uint32_t interruptNumber )” –(DriverLib user guide p.182) to enable the interrupt of “INT_PORT1”
    • Finally, we utilize “bool Interrupt_enableMaster ( void )”. This function allows the processor to respond to interrupts. This function does not affect the set of interrupts enabled in the interrupt controller; it just gates the single interrupt from the controller to the processor. –(DriverLib user guide p.184)
  • Remove the previous GPIO toggle function inside the while loop. Add the following code (outside the main function) as the Interrupt handler
/* GPIO ISR */void PORT1_IRQHandler(void){    uint32_t status;    status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);    /* Toggling the output on the LED */    if(status & GPIO_PIN1)    {        MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);    }}
  • We utilize “uint_fast16_t GPIO_getEnabledInterruptStatus ( uint_fast8_t selectedPort )” to get the status. The status is the Logical OR of any of the GPIO_PIN0-PIN15. The default value of status is 0. While GPIO_PIN1’s definition is “0x0002” (GPIO_PIN0’s definition is 0x0001), “status & GPIO_PIN1” will get the PIN1’s status.
  • You can debug the code and add breakpoint to test.
Questions
Question1: If you change the P1.1 initialization function from “GPIO_setAsInputPinWithPullUpResistor” to “GPIO_setAsInputPin”, and use “GPIO_getInputPinValue” to get the initial value of P1.1. What you will get?
Question2: If you change the “GPIO_setAsInputPinWithPullUpResistor” to “GPIO_setAsInputPinWithPullDownResistor”. Can you still get the interrupt? Why?
Question3: If you add function “void GPIO_interruptEdgeSelect ( uint_fast8_t selectedPort, uint_fast16_t
selectedPins, uint_fast8_t edgeSelect )” after the P1.1 input setup, and select “GPIO_LOW_TO_HIGH_TRANSITION” as the edgeSelect. You can setup one breakpoint inside the interrupt handler. When you will get the interrupt?

使用特权

评论回复
板凳
zhangmangui|  楼主 | 2020-11-14 13:44 | 只看该作者
Task3 Interrupt via Register Access
If you want to try the interrupt via register access, you can use the following code to realize the same function.
In CCS project, click New CCS project, and select the MSP432 device family and MSP432P401R, click Finish.
Add the following code to the main.c, the final main.c looks like this
#include "msp.h"/** * main.c */void main(void){        WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD;                // stop watchdog timer            // Configuring P1.0 as output and P1.1 (switch) as input with pull-up    // resistor. Rest of pins are configured as output low.    // Notice intentional '=' assignment since all P1 pins are being    // deliberately configured    P1->DIR = ~(uint8_t) BIT1;    P1->OUT = BIT1;    P1->REN = BIT1;                         // Enable pull-up resistor (P1.1 output high)    P1->SEL0 = 0;    P1->SEL1 = 0;    P1->IES = BIT1;                         // Interrupt on high-to-low transition    P1->IFG = 0;                            // Clear all P1 interrupt flags    P1->IE = BIT1;                          // Enable interrupt for P1.1    // Enable Port 1 interrupt on the NVIC    NVIC->ISER[1] = 1 << ((PORT1_IRQn) & 31);    // Terminate all remaining pins on the device    P2->DIR |= 0xFF; P2->OUT = 0;    P3->DIR |= 0xFF; P3->OUT = 0;    P4->DIR |= 0xFF; P4->OUT = 0;    P5->DIR |= 0xFF; P5->OUT = 0;    P6->DIR |= 0xFF; P6->OUT = 0;    P7->DIR |= 0xFF; P7->OUT = 0;    P8->DIR |= 0xFF; P8->OUT = 0;    P9->DIR |= 0xFF; P9->OUT = 0;    P10->DIR |= 0xFF; P10->OUT = 0;        // Enable global interrupt    __enable_irq();}/* Port1 ISR */void PORT1_IRQHandler(void){    volatile uint32_t i;    // Toggling the output on the LED    if(P1->IFG & BIT1)        P1->OUT ^= BIT0;    // Delay for switch debounce    for(i = 0; i < 10000; i++)    P1->IFG &= ~BIT1;}Task4 Systick Interrupt
In this task, we will bink the LED periodically using the SysTick module.
If we want to use the new created project in Task3, when we add the include for the driverlib

/* DriverLib Includes */#include <ti/devices/msp432p4xx/driverlib/driverlib.h>
When you compile the project, it will show driverlib.h not found. The reason is that the SDK include path is not setup in the CCS Cloud. You can right click the project and select the project properties->ARM Compiler
If you check the previous sample code from Lab1: “gpio_toggle_output”, you will see the complete setup of the SDK path.
If you want to use the DriverLib in the CCS Cloud, you should change the code based on the previous “gpio_toggle_output” sample not the new project. Due to the limitation of the CCS Cloud, you cannot change the include path manually.
Another option is to use the CCS local version. You can add the path manually. But, TI recommends to import the sample code directly to save the time for path configuration.
You can duplicate the sample project “gpio_toggle_output”, then rename the project and the project file name.
Add the following code to the main.c
/* DriverLib Includes */#include <ti/devices/msp432p4xx/driverlib/driverlib.h>/* Standard Includes */#include <stdint.h>#include <stdbool.h>int main(void){    volatile uint32_t ii;    /* Halting the Watchdog */    MAP_WDT_A_holdTimer();        /* Configuring P1.0 as LED */    MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);    /* Initializing MCLK to REFO */    MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);        /* Configuring SysTick to trigger at 16000.      */    MAP_SysTick_enableModule();    MAP_SysTick_setPeriod(3000000);//16000    MAP_SysTick_enableInterrupt();        /* Enabling MASTER interrupts */    MAP_Interrupt_enableMaster();    while (1)    {    }}/* SysTick ISR */void SysTick_Handler(void){    MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);}
In the previous code, we first configure P1.1 as input for switch and P1.0 as LED, then Initializing MCLK to REFO and configure the SysTick.
You can run the previous code and the LED in the board will blink based on the frequency setup. Comparing with the LED blinking in Lab1, this code utilizes the timer interrupt to toggle the LED without blocking the main function, i.e., empty in the while loop.
MSP432 Clock system and SysTick
Clock system (CS) is the key to any digital system. The MSP432 contains multiple clock sources. As shown in the MSP432 datasheet Clock System part, the CS contains the sources of the various clocks in the device. It also controls the mapping between the sources and the different clocks in the device.
The MSP432 clock module can be configured to operate without any external components, with up to two external crystals, or with resonators, or with an external resistor under full software control.
As shown in the MSP432 Technical Reference Manual (pdf)Chapter6 (page 378), The clock system module includes the following clock resources:
  • LFXTCLK: Low-frequency oscillator (LFXT) that can be used either with low-frequency 32768-Hz watch crystals, standard crystals, resonators, or external clock sources in the 32-kHz or below range. When in bypass mode, LFXTCLK can be driven with an external square wave signal in the 32-kHz or below range.
  • HFXTCLK: High-frequency oscillator (HFXT) that can be used with standard crystals or resonators in the 1-MHz to 48-MHz range. When in bypass mode, HFXTCLK can be driven with an external square wave signal.
  • DCOCLK: Internal digitally controlled oscillator (DCO) with programmable frequencies and 3-MHz frequency by default
  • VLOCLK: Internal very-low-power low-frequency oscillator (VLO) with 9.4-kHz typical frequency
  • REFOCLK : Internal, low-power low-frequency oscillator (REFO) with selectable 32.768-kHz or 128kHz typical frequencies
  • MODCLK: Internal low-power oscillator with 25-MHz typical frequency
  • SYSOSC: Internal oscillator with 5-MHz typical frequency
The following figure shows the module for LFXTCLK, HFXTCLK, and DCOCLK.
LFXTCLK and HFXTCLK are usually connect to external crystals. If you check the schematic of the MSP432 launchpad (page36 of the MSP432 launchpad user guide), you will see crystal Q1 (2pin 32.768KHz and Q2 (4pin 48MHz).
The 32-kHz crystal allows for lower LPM3 sleep currents and a higher-precision clock source than the default internal 32-kHz REFOCLK. Therefore, the presence of the crystal allows the full range of low power modes to be used.
The 48-MHz crystal allows the device to run at its maximum operating speed for MCLK and HSMCLK.
The MSP432P401R device has several internal clocks that can be sourced from many clock sources. Most peripherals on the device can select which of the internal clocks to use to operate at the desired speed.

In page14 of the MSP432 launchpad user guide
There are five system clocks inside the MSP432 to drive different module. The default configuration is shown
The definition of these five system clocks can be referred from
• ACLK: Auxiliary clock. ACLK is software selectable as LFXTCLK, VLOCLK, or REFOCLK. ACLK can be divided by 1, 2, 4, 8, 16, 32, 64, or 128. ACLK is software selectable by individual peripheral modules. ACLK is restricted to maximum frequency of operation of 128 kHz.
• MCLK: Master clock. MCLK is software selectable as LFXTCLK, VLOCLK, REFOCLK, DCOCLK, MODCLK, or HFXTCLK. MCLK can be divided by 1, 2, 4, 8, 16, 32, 64, or 128. MCLK is used by the CPU and peripheral module interfaces, as well as, used directly by some peripheral modules.
• HSMCLK: Subsystem master clock. HSMCLK is software selectable as LFXTCLK, VLOCLK, REFOCLK, DCOCLK, MODCLK, HFXTCLK. HSMCLK can be divided by 1, 2, 4, 8, 16, 32, 64, or 128. HSMCLK is software selectable by individual peripheral modules.
• SMCLK: Low-speed subsystem master clock. SMCLK uses the HSMCLK clock resource selection for its clock resource. SMCLK can be divided independently from HSMCLK by 1, 2, 4, 8, 16, 32, 64, or 128. SMCLK is limited in frequency to half of the rated maximum frequency of HSMCLK. SMCLK is software selectable by individual peripheral modules.
• BCLK: Low-speed backup domain clock. BCLK is software selectable as LFXTCLK and REFOCLK and is used primarily in the backup domain. BCLK is restricted to a maximum frequency of 32.768 kHz.
In page 379 of MSP432 Technical Reference Manual (pdf)
In the previous sample code, we use MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1) to init MCLK from REFOCLK. The function definition can be referred from driverlib guide
The REFOCLK is configurable for either 32KHz (default) or 128KHz. Thus, the previous code set MCLK=32KHz (CS_CLOCK_DIVIDER_1=1).
Then, we configure SysTick to trigger at 16000. The SysTick is a basic module inside all ARM Cortex-M processors.
The Cortex-M4 includes an integrated system timer, SysTick, which provides a simple, 24-bit, clear-on-write, decrementing, wrap-on-zero counter with a flexible control mechanism. The counter can be used in several different ways, and it is typically deployed either for operating system related purposes or as a general-purpose alarm mechanism.
Part 6.2.4 of the MSP432 datasheet.
A SysTick exception is an exception that the system timer generates when it reaches zero when it is enabled to generate an interrupt. Software can also generate a SysTick exception using the Interrupt Control State register (ICSR). In an OS environment, the processor can use this exception as system tick.
In page 66 of MSP432 Technical Reference Manual (pdf)
The SysTick driverlib API can be access: [link]. It has the following functions
In the previous sample code, we first enableModule, setPeriod=16000, then enableInterrupt. The period is the number of clock ticks in each period of the SysTick counter and must be between 1 and 16,777,216.
Since our MCLK=32KHz, then the SysTick interrupt period = 32KHz/16000=2Hz (0.5s period).
We also need to add the SysTick_Handler to toggle the LED for every SysTick interrupt. That’s why the LED blinks every 0.5s.
Questions
  • If you comment the following code: MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1), what kind of period value you need to set for SysTick in order to get the 1Hz LED toggle frequency? Why?

使用特权

评论回复
地板
zhangmangui|  楼主 | 2020-11-14 15:48 | 只看该作者
Task5 SysTick configuration
In the previous task, we set the MCLK=REFOCLK, while REFOCLK can be 32KHz or 128KHz. We can use the following code to toggle the clock value.
if(is32khz)            MAP_CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);        else            MAP_CS_setReferenceOscillatorFrequency(CS_REFO_32KHZ);
The following sample code combines the P1.1 switch interrupt, SysTick setup, and LED blinking via timer interrupt.
  • An interrupt occurs on P1.1 (the switch) which will change the
    frequency of the reference oscillator between the two modes (32khz and 128 khz)
/* DriverLib Includes */#include <ti/devices/msp432p4xx/driverlib/driverlib.h>/* Standard Includes */#include <stdint.h>#include <stdbool.h>/* Statics */static volatile bool is32khz;int main(void){    volatile uint32_t ii;    /* Halting the Watchdog */    MAP_WDT_A_holdTimer();        is32khz = true;        /* Configuring P1.1 as input for switch and P1.0 as LED */    MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);    MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);    MAP_Interrupt_enableInterrupt(INT_PORT1);    /* Initializing MCLK to REFO */    MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);        /* Configuring SysTick to trigger at 16000.      */    MAP_SysTick_enableModule();    MAP_SysTick_setPeriod(16000);//16000    MAP_SysTick_enableInterrupt();        /* Enabling MASTER interrupts */    MAP_Interrupt_enableMaster();    while (1)    {    }}/* SysTick ISR */void SysTick_Handler(void){    MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);}/* Port 1 ISR */void PORT1_IRQHandler(void){    uint32_t status;    status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);    if(status & GPIO_PIN1)    {        if(is32khz)            MAP_CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);        else            MAP_CS_setReferenceOscillatorFrequency(CS_REFO_32KHZ);        is32khz = !is32khz;    }}
You can get the value of these clocks via drivelib functions.
Add the following definition outside of the main function.
static volatile uint32_t aclk, mclk, smclk, hsmclk, bclk;
You can use the following functions to get the value of clocks
/*     *  Getting all of the frequency values of the CLK sources using the     * convenience functions */    aclk = CS_getACLK();    mclk = CS_getMCLK();    smclk = CS_getSMCLK();    hsmclk = CS_getHSMCLK();    bclk = CS_getBCLK();
To get the clock value, you can setup a breakpoint (right click the mouse), and watch these values in the variables window as shown below

使用特权

评论回复
5
zhangmangui|  楼主 | 2020-11-14 15:49 | 只看该作者
Task6 External Clock
In this task, we will utilize the external 32Khz crystal to drive the SysTick timer.
Replace the previous code MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1); by the following code
/* Configuring pins for peripheral/crystal usage */    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,            GPIO_PIN0 | GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION);/* Setting the external clock frequency. This API is optional, but will     * come in handy if the user ever wants to use the getMCLK/getACLK/etc     * functions     */    CS_setExternalClockSourceFrequency(32000,48000000);    /* Starting LFXT in non-bypass mode without a timeout. */    CS_startLFXT(CS_LFXT_DRIVE3);    /* Initializing MCLK to LFXT (effectively 32khz) */    MAP_CS_initClockSignal(CS_MCLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
Since we are using external crystal, we should configure the pin to enable the crystal usage. In the schematic, we know LFXT is connect by the pin PJ.0/LFXIN and PJ.1/LFXOUT. That’s why we setAsPeripheralModuleFunctionOutputPin as PRIMARY_MODULE_FUNCTION
We utilize CS_startLFXT(CS_LFXT_DRIVE3) to start the LFXT. The definition of this function is here (link)
Finally, we utilize MAP_CS_initClockSignal to initialize MCLK to LFXT.
Task7 Low power mode
In the previous code, when there is no interrupts, the CPU will stuck in the while loop and do nothing. To save the energy, we can let the CPU go to sleep and only wake up when the new interrupt is coming.
MSP432 supports several power modes. Active modes (AM) are any power mode in which CPU execution is possible. LPM0, LPM3, LPM4, and LPMx.5 modes do not allow for CPU execution.
Page 424 of MSP432 Technical Reference Manual (pdf)
We can add the following code before the SysTick configuration to enable the low power mode
  • There are three power mode:
/* Since we are operating at 32khz, we can operating in LF mode */    MAP_PCM_setPowerMode(PCM_LF_MODE);
Inside the while loop, we can let the CPU go to sleep via the follow code
MAP_PCM_gotoLPM0();
During LPM0, the processor execution is halted. Halting the processor reduces dynamic power due to reduced switching activities caused by execution of the processor. In general, there is only one LPM0 setting, and LPM0 can be entered from all active modes.
LPM0 modes are called as Sleep modes in Arm terminology
Page 425 of MSP432 Technical Reference Manual (pdf)
In order to make the CPU go to sleep after the SysTick interrupt, we can add the following code before SysTick interrupt enable
MAP_Interrupt_enableSleepOnIsrExit();
The complete code is attached.
/* Statics */static volatile uint32_t aclk, mclk, smclk, hsmclk, bclk;int main(void){    volatile uint32_t ii;    /* Halting the Watchdog */    MAP_WDT_A_holdTimer();        is32khz = true;        /* Configuring P1.1 as input for switch and P1.0 as LED */    MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);    MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);    MAP_Interrupt_enableInterrupt(INT_PORT1);    /* Initializing MCLK to REFO */    //MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);        /* Configuring pins for peripheral/crystal usage */    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,            GPIO_PIN0 | GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION);//GPIO_SECONDARY_MODULE_FUNCTION    CS_setExternalClockSourceFrequency(32000,48000000);    /* Starting LFXT in non-bypass mode without a timeout. */    CS_startLFXT(CS_LFXT_DRIVE3);    /* Initializing MCLK to LFXT (effectively 32khz) */    MAP_CS_initClockSignal(CS_MCLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);        /*     *  Getting all of the frequency values of the CLK sources using the     * convenience functions */    aclk = CS_getACLK();    mclk = CS_getMCLK();    smclk = CS_getSMCLK();    hsmclk = CS_getHSMCLK();    bclk = CS_getBCLK();        /* Since we are operating at 32khz, we can operating in LF mode */    MAP_PCM_setPowerMode(PCM_LF_MODE);        /* Configuring SysTick to trigger at 16000.      */    MAP_SysTick_enableModule();    MAP_SysTick_setPeriod(16000);//16000    MAP_Interrupt_enableSleepOnIsrExit();    MAP_SysTick_enableInterrupt();        /* Enabling MASTER interrupts */    MAP_Interrupt_enableMaster();    while (1)    {        MAP_PCM_gotoLPM0();    }}/* SysTick ISR */void SysTick_Handler(void){    MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);}

使用特权

评论回复
6
kxsi| | 2020-12-2 19:03 | 只看该作者
请问 为什么是全英文的啊  枪毙了我了

使用特权

评论回复
7
nawu| | 2020-12-2 19:07 | 只看该作者
英文中夹杂着代码 这让我怎么看呀

使用特权

评论回复
8
qcliu| | 2020-12-2 20:30 | 只看该作者
这种资料就是看原文最好了  没有歧义

使用特权

评论回复
9
tfqi| | 2020-12-2 20:34 | 只看该作者
我只能复制**重新排版看了

使用特权

评论回复
10
wiba| | 2020-12-2 20:36 | 只看该作者
对**中大段的程序我很感兴趣

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:欢迎进入【TI DSP 论坛】 & 【DSP 技术】           TI忠诚粉丝!

935

主题

26376

帖子

589

粉丝