1. Platform Description MSP430F5438
2. Why use MSPWare?
Due to work reasons, STM32 is used more in school, and STM32 DriverLib is more convenient to use. When I first learned MSP430, I was back to the era of register operation, which was a little bit uncomfortable. Later, I found that MSP also has DriverLib, but not many people use it. I explored it little by little with this example document and compared it with register operation. After a period of hard work, I became familiar with it.
3. Trends in Embedded System Programming
I personally think that DriverLib will become the mainstream, which can shorten the difficulty of using MCU. As the capacity of Flash and RAM continues to increase, there is no need to study every function. The key is to get started with MCU faster and solve practical problems. The new MCUs that have just been launched on the market also have DriverLib, which shortens the time to get started and quickly captures the market.
4. Sample code, start XT1. TI's sample code lacks the code to initialize the P7.0 and P7.1 peripheral functions, so it cannot run. A few modifications are made here.
#include "inc/hw_memmap.h"
#include "ucs.h"
#include "wdt_a.h"
#include "gpio.h"
#include "sfr.h"
uint16_t status;
void main (void)
{
// Stop the watchdog
WDT_A_hold(WDT_A_BASE);
//P4.0 keeps output status
GPIO_setAsOutputPin(GPIO_PORT_P4,GPIO_PIN0);
// Initialize P7.0 and P7.1 as multiplexing functions
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P7 , GPIO_PIN0 | GPIO_PIN1 );
// Start XT1 and wait for all crystal oscillator error flags to clear
UCS_LFXT1Start( UCS_BASE , UCS_XT1_DRIVE0 , UCS_XCAP_3 );
// Enable global interrupts
__bis_SR_register(GIE);
while(1)
{
// Flip P4.0
GPIO_toggleOutputOnPin(GPIO_PORT_P4,GPIO_PIN0);
// Software delay
__delay_cycles(1000000);
}
}
If XT1 or XT2 is used, UCS_setExternalClockSource(UCS_BASE,XT1_CLK,XT2_CLK) needs to be called before calling UCS_getSMCLK, UCS_getMCLK, and UCS_getACLK;
Although functions such as UCS_getSMCLK have no practical use for this code, they are still very helpful for setting the UART or SPIder baud rate.
The modified code is as follows:
#include "inc/hw_memmap.h"
#include "ucs.h"
#include "wdt_a.h"
#include "gpio.h"
#include "sfr.h"
uint32_t clockValue_ACLK = 0;
uint32_t clockValue_MCLK = 0;
uint32_t clockValue_SMCLK = 0;
void main (void)
{
// Stop the watchdog
WDT_A_hold(WDT_A_BASE);
//P4.0 keeps output status
GPIO_setAsOutputPin(GPIO_PORT_P4,GPIO_PIN0);
// Initialize P7.0 and P7.1 as multiplexing functions
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P7 , GPIO_PIN0 | GPIO_PIN1 );
// Start XT1 and wait for all crystal oscillator error flags to clear
UCS_LFXT1Start( UCS_BASE , UCS_XT1_DRIVE0 , UCS_XCAP_3 );
// If you use XT1 or XT2, you need to call this function
UCS_setExternalClockSource(UCS_BASE,32768,8000000);
// Get system clock, system clock, auxiliary clock
clockValue_SMCLK = UCS_getSMCLK( UCS_BASE );
clockValue_MCLK = UCS_getMCLK( UCS_BASE );
clockValue_ACLK = UCS_getACLK( UCS_BASE );
// Enable global interrupts
__bis_SR_register(GIE);
while(1)
{
// Flip P4.0
GPIO_toggleOutputOnPin(GPIO_PORT_P4,GPIO_PIN0);
// Software delay
__delay_cycles(1000000);
}
}
By default, ACLK selects XT1 clock, in which case XT1 clock is 32768 Hz, FLL reference clock is XT1, and DCODIV is 1048576 Hz after frequency multiplication. The reference clocks of SMCLK and MCLK are both DCODIV.
Previous article:MSP430Ware use notes to initialize DCO to 8MHz
Next article:MSP430F5438 study notes DCO frequency multiplication to 8MHZ
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- RAQ #223: How to measure and determine soft-start timing without a soft-start equation?
- RAQ #223: How to measure and determine soft-start timing without a soft-start equation?
- GigaDevice's full range of automotive-grade SPI NOR Flash GD25/55 wins ISO 26262 ASIL D functional safety certification
- GigaDevice's full range of automotive-grade SPI NOR Flash GD25/55 wins ISO 26262 ASIL D functional safety certification
- New IsoVu™ Isolated Current Probes: Bringing a New Dimension to Current Measurements
- New IsoVu™ Isolated Current Probes: Bringing a New Dimension to Current Measurements
- Infineon Technologies Launches ModusToolbox™ Motor Kit to Simplify Motor Control Development
- Infineon Technologies Launches ModusToolbox™ Motor Kit to Simplify Motor Control Development
- STMicroelectronics IO-Link Actuator Board Brings Turnkey Reference Design to Industrial Monitoring and Equipment Manufacturers
- Melexis uses coreless technology to reduce the size of current sensing devices
- SIGMATEL's D-MAJOR MP3 Hard Drive Application Notes
- Happy Teacher's Day! Exclusive benefits for moderators and teacher netizens
- Reset time problem
- Understanding MIMO Antennas: Part I
- TM8712 User Manual
- Advantages and disadvantages of 7nm processors
- Measuring the operating current of pyboardCN V2
- CC4019------Four 2 to 1 data selector
- 51 MCU controls the USB host bottom-level driver of SL811HS
- Simulation Design of Ultra-Wideband Helical Antenna