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.
I have a UART running where I receive a message about every 27ms. This UART sends the mssg to a radio which transmits it to a second radio which then sends the data over its UART to another MSP. The client (receiver) UART has a pointer pointing to an array of 20 deep BUT my message is only ever 9 bytes. The pointer initializes at the beginning of the array AND within the code after receiving each message I point it back to the beginning of the array. My problem is on the TX side I am inputting keystrokes that gets sent across the link by holding down one of the keys (ie remote) and the only mechanism on the receiver side is the UART. My pointer ends up randomly stopping at different addresses within the first nine addresses. I feel I am not doing housekeeping somewhere but for the life of me I cannot figure where I am missing it. Can someone show me what I might be doing wrong? Some comments...I am running 19200 and am in LPM3. Also the variable radioConfiguration = F, transmitter = F. The else in main is the chance something happens. You can see in the ISR after receiving each message I reset the pointer, clear flag, etc.
main:
if (!transmitter) { if (mssgRcvd) { mssgRcvd = F; memcpy(noCRC, &incoming[1], sizeof(noCRC)); CRC_Result = CRC(noCRC); if ((char)(((CRC_Result >> 8) & 0xFF) == incoming[7]) && ((char)((CRC_Result & 0xFF) == incoming[8]))) { //code only use pointer NEVER assign it here } } noRxPackets++; //troubleshooting line only pRx = incoming; UCA1IFG &= ~UCRXIFG; UCA1IE |= UCRXIE; } }
ISR:
case USCI_UART_UCRXIFG: if (radioConfiguration) { *pRx = UCA1RXBUF; howMany++; pRx++; __bic_SR_register_on_exit(LPM3_bits); } else { *pRx = UCA1RXBUF; pRx++; if (pRx > (incoming + 8)) { pRx = incoming; mssgRcvd = T; UCA1IE &= ~UCRXIE; UCA1IFG &= ~UCRXIFG; __bic_SR_register_on_exit(LPM3_bits); } } break;
Hi Steve,
What happens if you use Active mode rather than LPM3? The startup times associated with LPMx can affect these types of time-crucial tasks.
Regards,
James
**Attention** This is a public forum