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.
Hello Team,
We are working on Address-Bit Multiprocessor Format where i have referred (slau445i) section 22.3.3.2. I have an issue with this its not working as i expected.
I tested the code with real term sent data through terminal by setting MARK and NONE. when i sent byte from real term setting NONE, it is entering into ISR (actually interrupt should not rise) and also into if condition and same happening by setting MARK(9th bit, here should rise interrupt) too. Why it is happening like that, am i mistake in configuration? below is the code i'm trying. can anyone help me in "Address-Bit Multiprocessor Format ". I'm very thankful if it is done through example.
int main(void) { static const uint8_t True = 1; WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer clock_setup(); initialize_gpio(); data_transfer_switch(); initialise_uart(); while (True) { if ((in_ptr) != (out_ptr)) { UCA0TXBUF = array[out_ptr]; out_ptr++; out_ptr &= 0x0F; } } } void initialise_uart() { UCA0IFG &= ~UCTXIFG; // Disable Enhanced Universal Serial Communication Interface(eUSCI) // before UART configuration // Configure UART pins P1SEL0 |= BIT6 | BIT7; // set 2-UART pin as second function // Configure UART UCA0CTLW0 |= UCSWRST; // Put Enhanced Universal Serial Communication Interface in reset UCA0CTLW0 |= UCTXADDR_1; UCA0CTLW0 |= UCDORM_1; UCA0CTLW0 |= UCSSEL__SMCLK; // clock source select is SMCLK UCA0CTLW0 |= UCMODE_2; // Baud Rate calculation UCA0BR0 = baudrate_integer; // 24000000/1000000 = 24.0 UCA0MCTLW = baudrate_fractional; // 24000000/1000000 - INT(24000000/1000000) = 0 UCA0CTLW0 &= ~UCSWRST; // Initialize Enhanced Universal Serial Communication Interface(eUSCI) UCA0IE |= UCRXIE; // Enable USCI_A0 Receive interrupt __bis_SR_register(GIE); // To enter UART Interrupt Service Routine } /********** UART ISR *********************/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void) #else #error Compiler not supported! #endif { switch (__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG)) { case USCI_NONE: break; case USCI_UART_UCRXIFG: while (!(UCA0IFG & UCTXIFG)); status = (UCA0STATW & UCADDR); if(status) { array[in_ptr] = UCA0RXBUF; in_ptr++; in_ptr &= 0x0F; } break; case USCI_UART_UCTXIFG: break; case USCI_UART_UCSTTIFG: break; case USCI_UART_UCTXCPTIFG: break; default: break; } }
Hi Vamshi,
First, thanks for your detailed post and also for attaching your code using the Syntax Highlighter! It's very helpful to debug these types of issues.
Next, let me help you understand why this isn't working for you. In your code, I see that you're using the correct UCMODE and UCDORM settings - that's great! The problem here is the backchannel UART on the LaunchPad. It can support even parity if configured to do so, but by default, it does not support a parity bit. Thus, it cannot support the MARK or SPACE parity bit settings unfortunately. You can learn more about the backchannel UART of the onboard eZ-FET debugger in the MSP Debuggers User's Guide.
Now, I would recommend using a standalone TTL-to-USB serial adapter that supports various parity bits. I tested this out using one with the Serial Port Utility (SPU) terminal, and I observed that the UART packet is received when the parity bit is set to MARK but is not received when set to SPACE. I put an LED toggle inside the if(status) function to easily see when packets were received.
Also, I'd recommend testing your code when NOT running a debug session in CCS. It seems to affect the clock speeds and thus the performance/responsiveness.
I hope this helps!
Regards,
James
**Attention** This is a public forum