Tool/software: Code Composer Studio
Hello developers,
I currently try to setup an IR data transmission with MSP430FR2433 LaunchPad as a tx device. I want to transmit the data using the IrDA capabilities of the eUSCI_A UART.
I generally understand which bits to set in the SYSCFG1 register to enable the modulation system. But I am not successful in setting up the timing and the eUSCI_A itself. What I did so far is based on the family user guide (SLAU445) and the OutOfBox example:
IrDA setup
void initGpio(void)
{
// P2.6 as output
P2DIR |= BIT6;
// P2.6 as primary module function (UCA1TXD)
P2SEL0 |= BIT6;
}
void initIrDA(void)
{
// Enable IrDA
SYSCFG1 |= IREN;
// Disable eUSCI_A
EUSCI_A_UART_disable(EUSCI_A1_BASE); // Set UCSWRST bit
// IrDA encoder/decoder enabled
HWREG16(EUSCI_A1_BASE + OFS_UCAxIRTCTL) |= UCIREN;
// Transmit pulse clock source BITCLK16 (16 * 1/16 clock fractions)
HWREG16(EUSCI_A1_BASE + OFS_UCAxMCTLW) |= UCOS16; // Oversampling mode enabled
HWREG16(EUSCI_A1_BASE + OFS_UCAxIRTCTL) |= UCIRTXCLK; // Select BITCLK16
// Transmit pulse length 3/16 bit period (6 half clock cycles)
// Set UCIRTXPLx to 5
HWREG16(EUSCI_A1_BASE + OFS_UCAxIRTCTL) |= UCIRTXPL2 | UCIRTXPL0; // b101
/* Initialization of eUSCI_A */
EUSCI_A_UART_initParam param = {0};
param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK;
param.clockPrescalar = 8;
param.firstModReg = 10;
param.secondModReg = 247;
param.parity = EUSCI_A_UART_NO_PARITY;
param.msborLsbFirst = EUSCI_A_UART_LSB_FIRST;
param.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT;
param.uartMode = EUSCI_A_UART_MODE;
param.overSampling = EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION;
if(STATUS_FAIL == EUSCI_A_UART_init(EUSCI_A1_BASE, ¶m))
{
return;
}
// Enable eUSCI_A
EUSCI_A_UART_enable(EUSCI_A1_BASE); // Clear UCSWRST bit
}
What I am not sure about is the general timing. Do I have to set up Timer0_A3 separately and how do I sync the UART transmission and the timer for the carrier signal?
According to this modified picture from the user guide the envelope signal determins in ASK mode, whether the carrier signal is forwarded to the output or not. But how does the UART data signal influence this? It just invertes the envelope signal or am I wrong here?
I hope you can answer these questions, thanks in advance for any hint.
Regards,
Steffen