Converting code to not use DriverLib and manually setting each register bit
This commit is contained in:
@@ -1,13 +1,15 @@
|
|||||||
#include "usci_init.h"
|
#include "usci_init.h"
|
||||||
|
|
||||||
void usci_init(void){
|
void usci_init(void){
|
||||||
/************************************************ USCI A0 ************************************************/
|
/******************************** USCI A0 ********************************/
|
||||||
|
|
||||||
/************************************************ USCI A1 ************************************************/
|
/******************************** USCI A1 ********************************/
|
||||||
|
|
||||||
/************************************************ USCI A2 ************************************************/
|
/******************************** USCI A2 ********************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* UART Mode
|
||||||
|
*
|
||||||
* The FTDI FT230XS-R that was selected can handle up to 3 Mbaud, so we'll target 1 Mbaud
|
* The FTDI FT230XS-R that was selected can handle up to 3 Mbaud, so we'll target 1 Mbaud
|
||||||
* The SMCLK is currently at 10 MHz
|
* The SMCLK is currently at 10 MHz
|
||||||
*
|
*
|
||||||
@@ -19,29 +21,38 @@ void usci_init(void){
|
|||||||
* secondModReg: 0
|
* secondModReg: 0
|
||||||
* overSampling: 0
|
* overSampling: 0
|
||||||
*/
|
*/
|
||||||
USCI_A_UART_initParam USCI_A_UART_initParam_A2 = {
|
// USCI_A_UART_initParam USCI_A_UART_initParam_A2 = {
|
||||||
.selectClockSource = USCI_A_UART_CLOCKSOURCE_SMCLK,
|
// .selectClockSource = USCI_A_UART_CLOCKSOURCE_SMCLK,
|
||||||
.clockPrescalar = 10,
|
// .clockPrescalar = 10,
|
||||||
.firstModReg = 0,
|
// .firstModReg = 0,
|
||||||
.secondModReg = 0,
|
// .secondModReg = 0,
|
||||||
.parity = USCI_A_UART_NO_PARITY,
|
// .parity = USCI_A_UART_NO_PARITY,
|
||||||
.msborLsbFirst = USCI_A_UART_LSB_FIRST,
|
// .msborLsbFirst = USCI_A_UART_LSB_FIRST,
|
||||||
.numberofStopBits = USCI_A_UART_ONE_STOP_BIT,
|
// .numberofStopBits = USCI_A_UART_ONE_STOP_BIT,
|
||||||
.uartMode = USCI_A_UART_MODE,
|
// .uartMode = USCI_A_UART_MODE,
|
||||||
.overSampling = USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION
|
// .overSampling = USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION
|
||||||
};
|
// };
|
||||||
|
|
||||||
USCI_A_UART_init(USCI_A2_BASE, &USCI_A_UART_initParam_A2); // Initialize the UART block
|
//USCI_A_UART_init(USCI_A2_BASE, &USCI_A_UART_initParam_A2); // Initialize the UART block
|
||||||
USCI_A_UART_enable(USCI_A2_BASE); // Enables operation of the UART block
|
//USCI_A_UART_enable(USCI_A2_BASE); // Enables operation of the UART block
|
||||||
|
|
||||||
/************************************************ USCI A3 ************************************************/
|
// Initialization
|
||||||
|
UCA2CTL1 |= UCSWRST; // Sets the Software Reset to high, disabling the USCI module; Register options can only be set when the UCSWRST bit = 1
|
||||||
|
UCA2CTL1 |= UCSSEL__SMCLK; // USCI module will use the SMCLK as it's clock source
|
||||||
|
UCA2CTL1 &= UCRXEIE; // Disabling Erroneous Character Reception Interrupt
|
||||||
|
UCA2CTL1 &= UCBRKIE; // Disabling Break Character Reception Interrupt
|
||||||
|
UCA2CTL1 &= UCDORM; // Disabling USCI module Dormant Mode
|
||||||
|
UCA2CTL1 &= UCTXADDR; // Next frame transmitted is an address
|
||||||
|
UCA2CTL1 &= UCTXBRK; // Do not transmit a Break/Synch as the next frame
|
||||||
|
|
||||||
/************************************************ USCI B0 ************************************************/
|
/******************************** USCI A3 ********************************/
|
||||||
|
|
||||||
/************************************************ USCI B1 ************************************************/
|
/******************************** USCI B0 ********************************/
|
||||||
|
|
||||||
/************************************************ USCI B2 ************************************************/
|
/******************************** USCI B1 ********************************/
|
||||||
|
|
||||||
/************************************************ USCI B3 ************************************************/
|
/******************************** USCI B2 ********************************/
|
||||||
|
|
||||||
|
/******************************** USCI B3 ********************************/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
#define USCI_INIT_H_
|
#define USCI_INIT_H_
|
||||||
|
|
||||||
#include <msp430x54xa.h>
|
#include <msp430x54xa.h>
|
||||||
#include "usci_a_uart.h"
|
|
||||||
|
|
||||||
bool USCI_A_UART_init(uint16_t baseAddress, USCI_A_UART_initParam *param);
|
|
||||||
void USCI_A_UART_enable(uint16_t baseAddress);
|
|
||||||
|
|
||||||
void usci_init(void);
|
void usci_init(void);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user