This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: MSP432P401R
I am developing an over the air update software solution using zigbee for our design, and I have modified the original BSL (MSP432BSL_1_00_01_00) code to communicate with the radio. I am able to send data and receive ack values and messages from the target device (MSP432), even successfully complete update, but randomly the EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG will not clear and I get stuck in that loop. It is very random, so I wanted to see if anyone else has seen this behavior, or if it is a known bug. Please see the code below for my transmit byte function.
void Radio_sendByteUART(uint8_t data) { /* Wait until the TX buffer is empty, then send */ while(MAP_GPIO_getInputPinValue(GPIO_PORT_P2, GPIO_PIN4));//Waiting for Radio to be ready to receive data. while(!(MAP_UART_getInterruptStatus(BSL432_RADIO_MODULE, EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG))); EUSCI_A1->TXBUF = data; }
Hello,
Could you please change your to:
void Radio_sendByteUART(uint8_t data) { /* Wait until the TX buffer is empty, then send */ while(MAP_GPIO_getInputPinValue(GPIO_PORT_P2, GPIO_PIN4));//Waiting for Radio to be ready to receive data. // while(!(MAP_UART_getInterruptStatus(BSL432_RADIO_MODULE, EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG))); // EUSCI_A1->TXBUF = data; MAP_UART_transmitData(BSL432_RADIO_MODULE,data); }
And let us know if you see the same behavior. Also, could you please share the code that you are using to configure the UART.
Thanks,
David
Hi David,
I tried your suggestion and it is not hanging as much. I still have the issue every once in a while.
Now it is getting stuck in the UART_transmitData function:
void UART_transmitData(uint32_t moduleInstance, uint_fast8_t transmitData) { /* If interrupts are not used, poll for flags */ if (!BITBAND_PERI(EUSCI_A_CMSIS(moduleInstance)->rIE.r, UCTXIE_OFS)) while (!BITBAND_PERI(EUSCI_A_CMSIS(moduleInstance)->rIFG.r, UCTXIFG_OFS)) ; EUSCI_A_CMSIS(moduleInstance)->rTXBUF.r = transmitData; }
The code I am using to configure the UART is as follows:
//Using a 24MHz the same settings as the original BSL code. const eUSCI_UART_Config LBS_RADIO_UARTConfig_115200 = { EUSCI_A_UART_CLOCKSOURCE_SMCLK, 6, // UCBRx 8, // firstModReg UCBRFx 32, // secondMod UCBRSx EUSCI_A_UART_NO_PARITY, // No Parity EUSCI_A_UART_LSB_FIRST, // LSB First EUSCI_A_UART_ONE_STOP_BIT, // One stop bit EUSCI_A_UART_MODE, // UART mode EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION // Oversampling }; void Radio_UART_Config(){ UCA1CTL1 |= UCSWRST; BSL432_RADIO_MODULE = EUSCI_A1_BASE; BSL432_RADIO_PORT = GPIO_PORT_P2; BSL432_RADIO_RXD_PIN = GPIO_PIN2; BSL432_RADIO_TXD_PIN = GPIO_PIN3; BSL432_RADIO_RXD_MODE = GPIO_PRIMARY_MODULE_FUNCTION; BSL432_RADIO_TXD_MODE = GPIO_PRIMARY_MODULE_FUNCTION; /* Selecting P2.2 and P2.3 in UART mode */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(BSL432_RADIO_PORT, BSL432_RADIO_RXD_PIN, BSL432_RADIO_RXD_MODE); MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(BSL432_RADIO_PORT, BSL432_RADIO_TXD_PIN, BSL432_RADIO_TXD_MODE); MAP_UART_selectDeglitchTime(BSL432_RADIO_MODULE,EUSCI_A_UART_DEGLITCH_TIME_200ns); /* Configuring UART Module */ MAP_UART_initModule(BSL432_RADIO_MODULE, &LBS_RADIO_UARTConfig_115200); /* Enable UART module */ MAP_UART_enableModule(BSL432_RADIO_MODULE); UCA1CTL1 &= ~UCSWRST;// MAP_UART_registerInterrupt(BSL432_RADIO_MODULE,&Radio_Received_IRQ); /* Enabling interrupts */ MAP_UART_enableInterrupt(BSL432_RADIO_MODULE, EUSCI_A_UART_RECEIVE_INTERRUPT); MAP_Interrupt_enableInterrupt(INT_EUSCIA1); }
Thank you for the assistance. Please let me know if I can provide more info.
Hello,
I created this example code using your configuration but unfortunately I could not reproduce that behavior.
Do you have a logic analyzer / scope trace that you can share when the device stops transmitting.
Thanks,
David
Hi David,
I followed your suggestions. I first tried the code change you provide and that significantly reduced the recurrence of the issue. I have been able to run the update software over 500 times without seeing the issue. However, I can still get the issue show up randomly. I also checked the signal integrity for the TX and RX signals, and they seem to be clean (I haven't been able to catch a waveform of the fault since it is so random). I am right now looking at the TX and RX data coming between the radio and the MSP432 to see if I can catch anything.
For the moment, I have also added a Watch Dog Timer when entering the sendByte function. if the WDT is triggered, an ISR function calls a mass erase so I don't lose communication with box.
Do you have any other suggestions?
**Attention** This is a public forum