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.

CCS/MSP-EXP430F5529: MSP-EXP430F5529

Part Number: MSP-EXP430F5529

Tool/software: Code Composer Studio

Hello all!
Is there any way to receive a text file (about 10kB) via UART . 
  • Hello, 

    yes,

    for example:
    add a header containing # of bytes to be transmitted / received,
    add a tailer containing some kind of a control sum. 

  • Hi,

    probably the best example would be our boot loader communication for firmware updates. The BSL is using the image in .txt format and running the communication based on UART.

    Please see our BSL webpage for further information

    Best regards

    Peter

  • thanks all

    actually i sent  a .txt file via xbee which is connected to PC

    my question is how to receive this .txt file via another xbee which is connected with MSP430F5529 "The MSP430F5529 will just read this file and save it in another location on my pc "

  • Hi,

    I am not sure what exactly your problem is. What I understood, you are using an RF module called xbee to send the .txt file and trying to receive it. It sounds to me, like you'd be struggling with the data reception on the RF side. As we do not have an application report on this for the MSP430 and the problem rather seems to be on the xbee side, without visibility of the used device, I am afraid you need to ask for support on the xbee module manufacturer/supplier side.

    In case you should have problems related to the MSP430, you can come back to us.

    Best regards

    Peter

  • hi peter

    actually i have stuggles in C code how to read this file and  copy this file in another directory on pc 

  • Hello,

    sorry for my late response. It sounds like the issues you're experiencing are related to problems with SW running on the PC side, is this correct?

    Best regards

    Peter

  • Hi Peter,

    i wrote the following code to receive the data file in MSP430 and re-transmit it to the same transmitter XBEE

    But i didn't receive all bytes that i transmited ' some bytes are missing '

    i don't know the reason

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #include <msp430.h>

    #define RECEIVE_BUFFER_SIZE 256
    #define PACKET_TERMINATION_CHAR '\n'

    int main(void)
    {

    WDTCTL = WDTPW + WDTHOLD; // Stop WDT


    P3SEL |= BIT3+BIT4; // P3.3,4 = USCI_A0 TXD/RXD
    UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
    UCA0CTL1 |= UCSSEL_2; // SMCLK

    UCA0BR0 = 6; // 1MHz 9600
    UCA0BR1 = 0; // 1MHz 9600

    UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0,
    // over sampling
    UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
    UCA0IE |= UCRXIE; //interrupt RX
    __bis_SR_register(CPUOFF + GIE); //Enter LPM0 with interrupts


    }


    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)

    {

    unsigned char ReceivedByte;

    // static unsigned char Buffer[RECEIVE_BUFFER_SIZE+1];

    static int count = 0;

    ReceivedByte = UCA0RXBUF; //Retrieve the transmitted data from the receive buffer

    if(ReceivedByte != PACKET_TERMINATION_CHAR || count >= RECEIVE_BUFFER_SIZE)

    {
    while(!(UCA0IFG&UCTXIFG)); //Wait until transmit buffer is empty
    UCA0TXBUF = ReceivedByte;

    count++;


    }

    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  • Hi,

    based on the information, I just can guess, but what I see in your code, you're blocking the device in the ISR, waiting on the TX flag, instead of placing this TX portion outside of the ISR. This means, if for whatever reason the CPU has to wait for the TX buffer becoming ready for another transmit, your RX buffer gets other bytes and thus overflows, you've lost the data.

    Keep in mind the MSP430 does not allow per default interrupt nesting!

    Something useful for debugging serial communication, might be the following application report.

    Solutions_to_Common_eUSCI_and_USCI_Serial_Communication_Issues_on_MSP430_MCUs_slaa734a_2018_03.pdf

    Best regards

    Peter

  • Hello,

    could you please give me an update on the status on your side? Do you still need support on this? Many thanks in advance.

    Best regards

    Peter