Hi,
I noticed Tim Logan mentioned here that he didn't recommend over 38400 with the back channel UART. What is the limitation?
I am trying to use the backchannel UART on the MSP432P401 launchpad and at 115200 baud I am missing every other character on receive. On transmit,there appears to be no problem. My UART ISR and setup is given below.
const eUSCI_UART_Config uartConfig =
{
EUSCI_A_UART_CLOCKSOURCE_SMCLK, // SMCLK Clock Source
26, // BRDIV = 26
0, // UCxBRF = 0
0, // UCxBRS = 0
EUSCI_A_UART_NO_PARITY, // No Parity
EUSCI_A_UART_LSB_FIRST, // MSB First
EUSCI_A_UART_ONE_STOP_BIT, // One stop bit
EUSCI_A_UART_MODE, // UART mode
EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION // Low Frequency Mode
};
char uartRXData[80];
static bool uartEndOfLineFlag = false;
void EusciA0_ISR(void) { static int i=0; uint32_t status = UART_getEnabledInterruptStatus(EUSCI_A0_BASE); UART_clearInterruptFlag(EUSCI_A0_BASE, status); if(status & EUSCI_A_UART_RECEIVE_INTERRUPT) { uartRXData[i] = UART_receiveData(EUSCI_A0_BASE); if(uartRXData[i++]==0x0d) { uartEndOfLineFlag = true; uartRXData[i] = 0; // To end the array. i=0; // Get ready for the next command. } } }
void initializeClocks(void) { /* Initialize main clock to 48MHz. To make it 3 MHz change the 48 to 3 * and the 16's to 1.*/ PCM_setCoreVoltageLevel(PCM_VCORE1); CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); // Full speed CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_16 ); MAP_CS_initClockSignal(CS_HSMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_16 ); MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_16 ); } /* We may want to use P3.2 and P3.3 as a Bluetooth UART because the * backchannel UART is a bit slow. I only get every other character * at 115200 baud. */ int initializeBackChannelUART(void){ initializeClocks(); /* Selecting P1.2 and P1.3 in UART mode. */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION); /* Configuring UART Module */ if(UART_initModule(EUSCI_A0_BASE, &uartConfig)==STATUS_FAIL) return (STATUS_FAIL); UART_selectDeglitchTime(EUSCI_A0_BASE,EUSCI_A_UART_DEGLITCH_TIME_200ns); /* Enable UART module */ MAP_UART_enableModule(EUSCI_A0_BASE); /* Enable UART interrupts for backchannel UART * We may or may not need to do this. The simple * printf() routine doesn't seem to use it. */ UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT); /*EUSCI_A_SPI_TRANSMIT_INTERRUPT);*/ Interrupt_enableInterrupt(INT_EUSCIA0); return 1; }
What options do I have and what are the benefits/drawbacks of each?
- Use DMA (perhaps in ping pong mode)....
- Use an external port like P3.2 and P3.3....
- Cut the speed down to 38400....
Thanks,
Rob