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
3c317116
Commit
3c317116
authored
5 years ago
by
Edward Longman
Browse files
Options
Downloads
Patches
Plain Diff
Fix the backchannel EUSCI number
parent
1bdcd9fd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/lib/uart_drv/uart_drv.c
+32
-36
32 additions, 36 deletions
source/lib/uart_drv/uart_drv.c
with
32 additions
and
36 deletions
source/lib/uart_drv/uart_drv.c
+
32
−
36
View file @
3c317116
...
...
@@ -33,6 +33,7 @@
#include
"uart_drv.h"
#include
"msp430.h"
#include
"circ_buf.h"
#include
"../radio_drv/hal_types.h"
/* defines the size of the circular buffers */
#define TX_UART_BUFFER_SIZE 80
...
...
@@ -460,40 +461,40 @@ void hal_uart_init(void)
rx_end_of_str
=
NO_END_OF_LINE_DETECTED
;
rx_str_length
=
0
;
//Due to 3 peripherals per port there are more select bits.
UART_PORT_SEL
0
|=
UART_PIN_RXD
+
UART_PIN_TXD
;
UART_PORT_SEL
1
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
//Due to 3 peripherals per port there are more select bits.
UART_PORT_SEL
1
|=
UART_PIN_RXD
+
UART_PIN_TXD
;
UART_PORT_SEL
0
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
UART_PORT_DIR
|=
UART_PIN_TXD
;
UART_PORT_DIR
&=
~
UART_PIN_RXD
;
/* 9600 bits per second on 32768 ACLK */
/*
UCA
1
CTL1 |= UCSWRST; // Reset State
UCA
1
CTL1 |= UCSSEL_1; // ACLK
UCA
1
CTL0 = UCMODE_0;
UCA
1
CTL0 &= ~UC7BIT; // 8bit char
UCA
0
CTL1 |= UCSWRST; // Reset State
UCA
0
CTL1 |= UCSSEL_1; // ACLK
UCA
0
CTL0 = UCMODE_0;
UCA
0
CTL0 &= ~UC7BIT; // 8bit char
UCA
1
BR0 = 3; // 9600 bits per second
UCA
1
BR1 = 0;
UCA
0
BR0 = 3; // 9600 bits per second
UCA
0
BR1 = 0;
UCA
1
MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA
1
CTL1 &= ~UCSWRST;
UCA
0
MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA
0
CTL1 &= ~UCSWRST;
*/
/* 115200 bits per second on 16MHz SMCLK */
UCA
1
CTL1
|=
UCSWRST
;
// Reset State
UCA
1
CTL1
|=
UCSSEL_2
;
// SMCLK
UCA
1
CTL0
=
UCMODE_0
;
UCA
1
CTL0
&=
~
UC7BIT
;
// 8bit char
UCA
0
CTL1
|=
UCSWRST
;
// Reset State
UCA
0
CTL1
|=
UCSSEL_2
;
// SMCLK
UCA
0
CTL0
=
UCMODE_0
;
UCA
0
CTL0
&=
~
UC7BIT
;
// 8bit char
UCA
1
BR0
=
138
;
// 115200 bits per second
UCA
1
BR1
=
0
;
UCA
0
BR0
=
138
;
// 115200 bits per second
UCA
0
BR1
=
0
;
//Slight different modulation options in FR5994
UCA0MCTLW
=
UCBRS2
+
UCBRS1
+
UCBRS0
;
UCA
1
CTL1
&=
~
UCSWRST
;
UCA
0
CTL1
&=
~
UCSWRST
;
UCA
1
IE
|=
UCRXIE
;
// Enable USCI_A0 RX interrupt
UCA
0
IE
|=
UCRXIE
;
// Enable USCI_A0 RX interrupt
__bis_SR_register
(
GIE
);
// Enable Interrupts
}
...
...
@@ -508,9 +509,9 @@ void hal_uart_init(void)
**************************************************************************/
void
hal_uart_deinit
(
void
)
{
UCA
1
IE
&=
~
UCRXIE
;
UCA
1
IE
&=
~
UCTXIE
;
UCA
1
CTL1
=
UCSWRST
;
//Reset State
UCA
0
IE
&=
~
UCRXIE
;
UCA
0
IE
&=
~
UCTXIE
;
UCA
0
CTL1
=
UCSWRST
;
//Reset State
//Due to 3 peripherals per port there are more select bits.
UART_PORT_SEL0
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
UART_PORT_SEL1
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
...
...
@@ -532,29 +533,23 @@ void hal_uart_start_tx(void)
if
(
isr_state
==
TX_ISR_OFF
)
{
ENTER_CRITICAL_SECTION
(
isr_flag
);
isr_state
=
TX_ISR_ON
;
UCA
1
IE
|=
UCTXIE
;
UCA
1
TXBUF
=
circ_buf_get_data
(
&
uart_tx_buf
);
UCA
0
IE
|=
UCTXIE
;
UCA
0
TXBUF
=
circ_buf_get_data
(
&
uart_tx_buf
);
LEAVE_CRITICAL_SECTION
(
isr_flag
);
}
}
// Echo back RXed character, confirm TX buffer is ready first
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A1_VECTOR
__interrupt
void
USCI_A1_ISR
(
void
)
#elif defined(__GNUC__)
void
__attribute__
((
interrupt
(
USCI_A1_VECTOR
)))
USCI_A1_ISR
(
void
)
#else
#error Compiler not supported!
#endif
HAL_ISR_FUNC_DECLARATION
(
eUSCI_isr
,
EUSCI_A0
)
{
char
tmp_uart_data
;
switch
(
__even_in_range
(
UCA1IV
,
4
))
P1OUT
^=
BIT0
;
switch
(
__even_in_range
(
UCA0IV
,
4
))
{
case
UCIV__NONE
:
break
;
// Vector 0 - no interrupt
case
UCIV__UCRXIFG
:
// Vector 2 - RXIFG
tmp_uart_data
=
UCA
1
RXBUF
;
tmp_uart_data
=
UCA
0
RXBUF
;
circ_buf_put_data
(
&
uart_rx_buf
,
tmp_uart_data
);
...
...
@@ -571,11 +566,12 @@ void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
case
UCIV__UCTXIFG
:
// check if there is more data to send
if
(
circ_buf_remainder
(
&
uart_tx_buf
)
<
uart_tx_buf
.
size_of_buffer
)
{
UCA
1
TXBUF
=
circ_buf_get_data
(
&
uart_tx_buf
);
UCA
0
TXBUF
=
circ_buf_get_data
(
&
uart_tx_buf
);
}
else
{
isr_state
=
TX_ISR_OFF
;
UCA
1
IE
&=
~
UCTXIE
;
// Disable USCI_A0 TX interrupt
UCA
0
IE
&=
~
UCTXIE
;
// Disable USCI_A0 TX interrupt
}
P1OUT
^=
BIT0
;
break
;
// Vector 4 - TXIFG
default:
break
;
...
...
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