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.
Hi,
I am trying to send char from MSP430fr5994 MCU to CCS terminal the code is as below. but I cant see the char on terminal. help please.
Terminal settings are as in the pic.
#include <msp430.h>
int main (void){
WDTCTL |= WDTPW | WDTHOLD;
UCA1CTLW0 |= UCSWRST ;
UCA1CTLW0 |= UCSSEL__SMCLK;
UCA1BRW=8;
UCA1MCTLW |= 0xD600;
P6SEL1 &= ~BIT0;
P6SEL0 |= BIT0;
PM5CTL0 &= ~ LOCKLPM5;
UCA1CTLW0 &= ~UCSWRST ;
char A='A';
int i;
while (1){
UCA1TXBUF =A;
for (i=0; i<1000; i++){}
}
return 0;
}
Are you using the USB connected to the computer and using the UART that way? If, so then you need to use the backchannel UART, which is UCA0. This UART line connects through the USB.
//FOR UCA3TXD //P6SEL1 &= ~BIT0; //P6SEL0 |= BIT0; //FOR UCA1TXD P2SEL1 |= (BIT5); P2SEL0 &= ~(BIT5); //FOR UCA0TXD //P2SEL1 |= (BIT0); //P2SEL0 &= ~(BIT0);
Here are some additional resources to help, eUSCI_A3 Echo, UART Academy. MSP430FR5994 Launchpad User's Guide section 2.2.4 talks about the backchannel UART I mentioned.
// UCOS16 =0, UCBRFx= not used, UCBRS=xD6 thats why " UCA0MCTLW |= 0xD600;" so BR= 115200
I have tried UCA0 with port 2 as well but the result is same. I dont data yet.
----------------------------------------------------------------------------------------------------------------
#include <msp430.h>
int main (void){
WDTCTL |= WDTPW | WDTHOLD;
UCA0CTLW0 |= UCSWRST ;
UCA0CTLW0 |= UCSSEL__SMCLK;
UCA0BRW=8;
UCA0MCTLW |= 0xD600; // UCOS16 =0, UCBRFx= not used, UCBRS=xD6 thats why " UCA0MCTLW |= 0xD600;" so BR= 115200
//FOR UCA0TXD
P2SEL1 |= (BIT0);
P2SEL0 &= ~(BIT0);
PM5CTL0 &= ~ LOCKLPM5;
UCA0CTLW0 &= ~UCSWRST ;
int i;
while (1){
UCA0TXBUF ='A';
for (i=0; i<1000; i++){}
}
return 0;
}
by the way thanks for answer and recommendations, Yeh I am trying to send data from MSP430FR5994 MCU to CCS terminal via USB. I have tried with UCA0,A1,A3 but all same. I cant receive data...
Also below code supposed to send data each time button (P5.5) pressed via interrupts. But it does not work as well.
Got stuck... Any idea???
**************************************************************************************
#include <msp430.h>
char Message[]="Hello Mf";
unsigned int position;
int main (void){
WDTCTL |= WDTPW | WDTHOLD;
UCA0CTLW0 |= UCSWRST ;
UCA0CTLW0 |= UCSSEL__SMCLK;
UCA0BRW=8;
UCA0MCTLW |= 0xD600; // UCOS16 =0, UCBRFx= not used, UCBRS=xD6 thats why " UCA0MCTLW |= 0xD600;" so BR= 115200
//switch settings
P5DIR &=~ BIT5;
P5REN |= BIT5;
P5OUT |= BIT5;
P5IES |=BIT5;
//FOR UCA0TXD
P2SEL1 |= (BIT0);
P2SEL0 &= ~(BIT0);
PM5CTL0 &= ~ LOCKLPM5;
UCA0CTLW0 &= ~UCSWRST ;
//enable IRQ
P5IE |=BIT5;
P5IFG &=~ BIT5;
__enable_interrupt();
while (1){}
return 0;
}
//PRAGMA settings
#pragma vector = PORT5_VECTOR
__interrupt void ISR_PORT5_SW(void){
position =0;
UCA0IE |= UCTXIE;
UCA0IFG &=~ UCTXIFG;
UCA0TXBUF =Message[position];
P5IFG &=~ BIT5;
}
#pragma vector = EUSCI_A0_VECTOR
__interrupt void ISR_EUSI_A0(){
if (position==sizeof(Message)){
UCA0IE &=~ UCTXIE;
}else {
position++;
UCA0TXBUF=Message[position];
}
UCA0IFG &=~ UCTXIFG;
}
Yep, I took many hours but finally find out. I cant beileve it. Just an Or signd took my 1 day.
it does not work with that " WDTCTL |= WDTPW | WDTHOLD; "
while it works perfectly with that "WDTCTL = WDTPW | WDTHOLD; "
ahhhh
**Attention** This is a public forum