Part Number: MSP432P4111
Hi,
I try to communicate over UART_A2 with a modem on pins 3.2 and 3.3.
My target is that it runs on a FreeRTOS applicatoin with a system clock of 48MHz. But now for testing I have reduced it to a simple programm (which I found on several places).
/* * Communication with Modem Mikroelektronika LTE IO CLICK * **********************************************************************************************/ #include <stdint.h> #include <stdio.h> #include <stdbool.h> #include <ti/drivers/GPIO.h> #include <ti/drivers/gpio/GPIOMSP432.h> #include <ti/devices/msp432p4xx/driverlib/driverlib.h> #include <string.h> #define UART2 GPIO_PORT_P3, GPIO_PIN2 | GPIO_PIN3 #define MODEMSTART GPIO_PORT_P4, GPIO_PIN6 const eUSCI_UART_Config uartConfig = { EUSCI_A_UART_CLOCKSOURCE_SMCLK, // SMCLK Clock Source 78, // BRDIV = 78 2, // UCxBRF = 2 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_OVERSAMPLING_BAUDRATE_GENERATION // Oversampling }; void EUSCIA2_IRQHandler(void) { uint32_t status = MAP_UART_getEnabledInterruptStatus(EUSCI_A2_BASE); // char receiveByte = EUSCI_A2->RXBUF; //UCA2RXBUF; //This is the address where the received byte is stored char receiveByte = MAP_UART_receiveData(EUSCI_A2_BASE); MAP_UART_clearInterruptFlag(EUSCI_A2_BASE, status); if(status & EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG) { MAP_UART_transmitData(EUSCI_A2_BASE, receiveByte); printf("\nEUSCIA2_IRQHandler: %c", receiveByte); } } int main(void) { /* Halting WDT */ WDT_A_holdTimer(); printf("\nCS_getDCOFrequency=%d", CS_getDCOFrequency()); printf("\nCS_getMCLK=%d", CS_getMCLK()); printf("\nCS_getSMCLK=%d\n", CS_getSMCLK()); /* Set pins 2 and 3 of port 3 to the primary module function (UART) */ GPIO_setAsPeripheralModuleFunctionInputPin(UART2, GPIO_PRIMARY_MODULE_FUNCTION); /* Setting DCO to 12MHz */ CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_12); UART_initModule(EUSCI_A2_BASE, &uartConfig); UART_enableModule(EUSCI_A2_BASE); /* Enabling UART interrupts */ MAP_UART_enableInterrupt(EUSCI_A2_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT); MAP_Interrupt_enableInterrupt(INT_EUSCIA2); MAP_Interrupt_enableSleepOnIsrExit(); MAP_Interrupt_enableMaster(); MAP_GPIO_setAsOutputPin(MODEMSTART); /* reset Modem */ MAP_GPIO_setOutputHighOnPin(MODEMSTART); for (int var = 0; var < 2400000; ++var) { } // 50ms MAP_GPIO_setOutputLowOnPin(MODEMSTART); for (int var = 0; var < 2400000; ++var) { } // 50ms for (int var = 0; var < 2400000; ++var) { } // 50ms for (int var = 0; var < 2400000; ++var) { } // 50ms for (int var = 0; var < 2400000; ++var) { } // 50ms MAP_GPIO_setOutputHighOnPin(MODEMSTART); for (int var = 0; var < 2400000; ++var) { } // UART_transmitData(EUSCI_A2_BASE, "AT"); MAP_UART_transmitData(EUSCI_A2_BASE, 'A'); MAP_UART_transmitData(EUSCI_A2_BASE, 'T'); while (1) { MAP_PCM_gotoLPM0(); } }
The current issue is that the ISR is entered continuously and put out:
EUSCIA2_IRQHandler: A
EUSCIA2_IRQHandler: A
EUSCIA2_IRQHandler: A
...
1. It looks like the ISR Flag isn't resetted...?
2. Is it possible to transmit a char[] e.g. transmit 'AT' instead of 'A' and then 'T' ?
3. What are the settings for BRDIV, UCxBRF and UCxBRS if SMCLK has 48MHz? From the Technical Reference Manual I found this table but I can't find a setup for 48MHz.
Thanks for help