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 everyone 

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

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 to another location on my pc "

  • Hey Beso,

    I have a few questions I'm hoping you could answer:

    1. Do you have the MSP430F5529 communicating with the xbee board?

    2. What specific xbee board are you using? Can you point me to any documentation for that board?

    Thanks,

    Mitch

  • Hello Mitch,

    i have one xbee module connected with pc by usb

    the another xbee module connected with MSP430F5529 using uart (P3.4 AND P3.3)

    I Wrote a code to send char from MSP430F5529 and received it in XCTU. it workes fine

    BUT i have no experience how to receive files and read it in micro-controllers and resend it to pc via xbee

     

  • Hey Beso,

    The way I would approach this is by sending the .txt file byte by byte from the PC to the MSP. You have established communication between the MSP and PC (which is great!) so now let's figure out how to store the file to the MSP.

    One thing we need to know is how to write data to specific locations in the flash memory. We have code examples that demonstrate how to do this! These examples can be found by opening CCS and going to View > Resource Explorer. Then in Resource explorer, navigate to Software > MSP430Ware > Devices > MSP430F5XX_6XX > MSP430F5529 > Peripheral Examples > Register Level. Here you will find the  MSP430F55xx_flashwrite_0x.c code examples. These examples will show you how to write data to specific places in flash memory. 

    So the overall approach would be:

    1. Send data byte of .txt file from PC xbee to MSP xbee

    2. Once MSP xbee receives data byte, transmit data byte from xbee to MSP via UART 

    3. In UART interrupt, write the received data byte to flash memory (this is where the code examples will be useful)

    4. Repeat for the rest of the .txt data bytes

    To send the file back to the PC, you will point to the flash memory location of the .txt data and send it back to the xbee via UART. This will also be done byte by byte.

    Hope this helps!

    Thanks,

    Mitch

  • Hello Mitch ,

    i really appreciate your kidness

    My .txt file contents (JACK) 

    i wrote the following code and i opened the XCTU software to show the received data on xbee which is connected to PC but the monitor shows (JCK) the letter A was deleted

    i don't know my mistake

    and please do you know if it is possible  (when sending the file back to the PC save it as .txt file like on desktop directory )?

    #pragma vector=USCI_A0_VECTOR

    __interrupt void USCI_A0_ISR(void)

    {
    unsigned long * Flash_ptrD;                                // Initialize Flash pointer Seg D

    Flash_ptrD = (unsigned long *) 0x1800;            // Initialize Flash pointer

    while (!(UCA0IFG&UCRXIFG));                         // USCI_A0 RX buffer ready?
    {


    FCTL3 = FWKEY;                                            // Clear Lock bit
    FCTL1 = FWKEY+ERASE;                             // Set Erase bit
    *Flash_ptrD = 0;                                              // Dummy write to erase Flash seg
    FCTL1 = FWKEY+BLKWRT;                          // Enable long-word write
    *Flash_ptrD =UCA0RXBUF;                           // Write to Flash
    FCTL1 = FWKEY;                                         // Clear WRT bit
    FCTL3 = FWKEY+LOCK;                            // Set LOCK bit

    }

    while (!(UCA0IFG&UCTXIFG));                   // USCI_A0 RX buffer ready?
    {
    UCA0TXBUF = * Flash_ptrD;
    }
    }

  • Hi Beso,

    I'm not sure why your 'A' didn't get transmitted. I would maybe try sending a .txt file of only 'A' or a string of multiple 'A's.

    Saving the data in a .txt format is something that will be handled on the PC side. You could open a terminal program on the PC to show the MSP data being sent, and then save it as a .txt file. Or if you want to have a more automated solution, you could set a script to do this.

    Thanks,

    Mitch

  • Hi Mitch,

    Thanks for your help

    I think there is missing bytes when retransmit the data

    I tried to send another string like “hello world “

    But it wasn’t retransmitted correctly  the monitor shows “ wrld” just

    I don’t know what’s the matter

    Should i add checksum??

  • Hi Beso,

    It might be worth checking the data being sent directly from the MSP (before it gets to the xbee) to make sure it's consistently sending the correct data. Once this is confirmed, I would double check the requirements of the xbee side. For example, is the MSP sending the data to the xbee at the baudrate required by the xbee?

    Thanks,

    Mitch  

**Attention** This is a public forum