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.

MSP430FR2355: only able to receive last character of string sent from android over Serial

Part Number: MSP430FR2355

I'm attempting to send multiple characters from an android application i've written to communicate with the our Sensor board that is using a MSP430FR2355. 

Android is sending the string over as a byte array when I hit the send button. 

sendButton.setOnClickListener(new View.OnClickListener() 
{
     @Override
     public void onClick(View v) 
     {
          if (!editText.getText().toString().equals("")) 
          {
               String data = editText.getText().toString();
               if (usbService != null) 
               { 
                    // if UsbService was correctly binded, Send data
                    usbService.write(data.getBytes());
               }
          }
     }
}

on the MSP430 side I'm using interrupts to indicate when message is coming in. When I receive an interrupt flag I immediately halt the program with a break and check the UCA1RXBUF buffer. The only character present is the last character of the string. 

So if I send "Hello", the interrupt only sees the "o". 

Its serial so I I figured I would be receiving characters one at a time. So the ISR would be called for each character. As the character was received I would just insert the characters as they are received into my own buffer, character array. Process the full message depending on my needs and so on. 

I can't do this as, I'm only receiving the last character of the byte array that's being sent. 

is the correct way for me to handle this is to convert the string over to a byte array, and using a for loop send each character of the byte array individually? or is there a better option? Any insight?

  • Short answer: Don't breakpoint/pause in the ISR. This stops your program, but doesn't stop your Android program, which, in the time it takes for CCS to deal with the breakpoint, has already sent everything. Your serial clock keeps running, and quietly overruns RXBUF, so you see the last byte.

**Attention** This is a public forum