Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MSP430FR5994 BOOSTXL-CC1120-90 Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Energy-Driven Computing
MSP430FR5994 BOOSTXL-CC1120-90 Library
Commits
a5290be8
Commit
a5290be8
authored
5 years ago
by
Edward Longman
Browse files
Options
Downloads
Patches
Plain Diff
Make minimal watchdog interrupting example to build from
parent
81f89d39
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/CMakeLists.txt
+3
-0
3 additions, 0 deletions
source/CMakeLists.txt
source/test/min2.c
+143
-0
143 additions, 0 deletions
source/test/min2.c
with
146 additions
and
0 deletions
source/CMakeLists.txt
+
3
−
0
View file @
a5290be8
...
@@ -20,6 +20,9 @@ link_directories(
...
@@ -20,6 +20,9 @@ link_directories(
add_executable
(
${
PROJECT_NAME
}
_min test/min.c lib/hal_mcu/hal_mcu.c
)
add_executable
(
${
PROJECT_NAME
}
_min test/min.c lib/hal_mcu/hal_mcu.c
)
target_link_libraries
(
${
PROJECT_NAME
}
_min uart_drv
)
target_link_libraries
(
${
PROJECT_NAME
}
_min uart_drv
)
add_executable
(
${
PROJECT_NAME
}
_min2 test/min2.c lib/hal_mcu/hal_mcu.c
)
target_link_libraries
(
${
PROJECT_NAME
}
_min2
)
add_executable
(
${
PROJECT_NAME
}
_rxer test/LaunchPad_trx_main.c test/LaunchPad_trx_demo.c
)
add_executable
(
${
PROJECT_NAME
}
_rxer test/LaunchPad_trx_main.c test/LaunchPad_trx_demo.c
)
target_link_libraries
(
${
PROJECT_NAME
}
_rxer hal_mcu radio_drv
)
target_link_libraries
(
${
PROJECT_NAME
}
_rxer hal_mcu radio_drv
)
...
...
This diff is collapsed.
Click to expand it.
source/test/min2.c
0 → 100644
+
143
−
0
View file @
a5290be8
#include
"msp430fr5994.h"
#include
"stdio.h"
#include
"lib/radio_drv/hal_types.h"
/******************************************************************************
* LOCAL FUNCTIONS
*/
unsigned
long
volatile
time_counter
;
/******************************************************************************
* @fn main
*
* @brief Main GUI application level control loop is implemented in the
* main loop. It is a state machine that cycles thru various states
* during the interactive use by the operator. The presents a text
* based GUI, the user is then promted to type in a command with
* a given set of parameters. The state machine then calls a simpler
* parser that tries to figure out what the user wants to do.
*
* input parameters
*
* @param void
*
* output parameters
*
* @return void
*
*/
#define DCO_RANGE_SEL DCORSEL
#define DCO_FREQ_SEL DCOFSEL_4
#define F_CPU_SCALE DIVM_0
#if DCO_RANGE_SEL==DCORSEL
#if DCO_FREQ_SEL>DCOFSEL_3
#define F_CPU_RANGE 5333000UL
#else
#define F_CPU_RANGE 5333000UL*1.5
#endif
#else
#define F_CPU_RANGE 2667000UL
#endif
#if DCO_FREQ_SEL==DCOFSEL_1
#define F_CPU F_CPU_RANGE*1.0
#elif DCO_FREQ_SEL==DCOFSEL_2
#define F_CPU F_CPU_RANGE*1.313
#elif DCO_FREQ_SEL==DCOFSEL_3
#define F_CPU F_CPU_RANGE*1.5
#elif DCO_FREQ_SEL==DCOFSEL_4
#define F_CPU F_CPU_RANGE*2.0
#elif DCO_FREQ_SEL==DCOFSEL_5
#define F_CPU F_CPU_RANGE*2.62
#elif DCO_FREQ_SEL==DCOFSEL_6
#define F_CPU F_CPU_RANGE*3.0
#else //DCO_FREQ_SEL==DCOFSEL_0
#define F_CPU 1000000UL
#endif
#define F_CPU_SCALED_US F_CPU/(1<<F_CPU_SCALE)/1000000.0
/* Number of CPU cycles per us */
#define _delay_us(__us) \
if((uint32_t) (F_CPU_SCALED_US * __us) != F_CPU_SCALED_US * __us)\
__delay_cycles((uint32_t) ( F_CPU_SCALED_US * __us)+1);\
else __delay_cycles((uint32_t) ( F_CPU_SCALED_US * __us))
enum
state_names
{
IDLE_RESET
,
WAIT
,
OPERATE
};
void
main
(
void
)
{
int
idle_counter
=
0
;
/* Stop WDT */
WDTCTL
=
WDTPW
+
WDTHOLD
;
/* Setup MSP specific functions, IO's, timers and WDT */
//Comes from lib/hal_mcu/hal_mcu.c
//msp_setup();
// Enable the interupts on port 2 to catch the user button (TRXEB)
BUTTON_DIR
&=
~
BUTTON_PIN
;
// input direction
BUTTON_OUT
|=
BUTTON_PIN
;
// set high on port
BUTTON_PxIE
|=
BUTTON_PIN
;
// enable interupt
BUTTON_PxIES
|=
BUTTON_PIN
;
// Hi/lo edge
BUTTON_REN
|=
BUTTON_PIN
;
// Pull up resistor
BUTTON_PxIES
&=
~
BUTTON_PIN
;
// IFG cleared
// Removed XTAL configuration and DCO Fault detection as not on exp430_fr5994
// Unlock CS registers.
CSCTL0
=
CSKEY
;
// Set DCO to 24MHz.
CSCTL1
=
DCO_RANGE_SEL
+
DCO_FREQ_SEL
;
// ACLK = VLO, SMCLK = MCLK = DCO
CSCTL2
=
SELA_1
+
SELS_3
+
SELM_3
;
// ACLK/1, SMCLK/8, MCLK/1
CSCTL3
=
DIVA_0
+
DIVS_0
+
F_CPU_SCALE
;
// Power down unused clocks.
CSCTL4
=
HFXTOFF
+
VLOOFF
;
// Lock clock registers.
CSCTL0
=
0
;
// Setup Watch dog timer for 0.5 second tick using 16MHz DCO on MSP430FR5994
// WDT 0.5s @ 16mHz, SMCLK, interval timer
WDTCTL
=
WDTPW
+
WDTSSEL_0
+
WDTTMSEL
+
WDTIS_2
;
SFRIE1
|=
WDTIE
;
// Enable WDT interrupt
// Unlock the system.
PM5CTL0
&=
~
LOCKLPM5
;
P1DIR
|=
BIT0
|
BIT1
;
__enable_interrupt
();
/* Infinite loop with a 1 second timer */
while
(
1
)
{
P1OUT
^=
BIT0
;
_delay_us
(
4166
);
_delay_us
(
8332
);
}
}
/******************************************************************************
* @fn wdt_isr
*
* @brief Interrupt service routine for watch dog timer.
*
* input parameters
*
* @param void
*
* output parameters
*
* @return void
*
*/
HAL_ISR_FUNC_DECLARATION
(
wdt_isr
,
WDT
)
{
/* global "0.5 second" counter used for printing time stamped packet sniffer data */
P1OUT
^=
BIT1
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment