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.

CC2540: SPI transmission data over 256 bytes

Part Number: CC2540

Hi Everyone,

I am working on SPI between MCU and CC2540.

MCU will send the data to CC2540 by SPI, However CC2540 deliver the data over air to dongle which connected with PC.

Then I used BTool to observe the result, and I found that if I send the data size over 256 bytes each time there will be something wrong.

After that I distinguished the data to two parts, but it was not helpful.

Hope someone can tell me what happen and how can I do.

Best regards. 

  • Hi hangsheng huang,

    Can you give me more details on your set up? When you say something is wrong when you send more than 256 bytes, what do you mean? Do you have a problem receiving the 256 bytes over SPI or do you have a problem sending the 256 bytes over the air? What is the maximum data size you can send successfully? Does 255 bytes work?
  • I used the TI SPI driver patch v1.4 to implement.
    In this C code it define SPI_MAX_PKT_LEN 256.

    I had tried to send 219 bytes data to cc2540 with SPI at once and it worked.
    However I changed the data size to 292 bytes then it still send the data to CC2540.
    But some data will disappear(not packet) when I used the Btool to check the result.

    I totally need to send 292 bytes data to cc2540 with SPI at once but SPI buffer size are only 256 bytes.
    So I'm thinking that if the buffer size effect the data transmission or not?
  • Hi hangsheng huang,

    I think 256 bytes is all that is supported. You may be experiencing a truncation somewhere.

    Have you reviewed the Serial to BLE Project: http://processors.wiki.ti.com/index.php/SerialBLEbridge_V_1.4.1

    From the wiki page: This page details a Serial-to-BLE bridge sample application which can be used as a basis for adding serial communication to an existing project, creating a simple serial packet parser, and achieving maximum over-the-air throughput.

    This project may help provide some guidance with your design.

  • Thank you, Rachel.

    I already studied the page, and it is really helpful.

    However I still have another question.

    Is it possible that I send too much data from MCU to cc2540 via spi to overwrite cc2540 spiRxBuf?

    Then it cause data vanish when parsing Rx data(spiRxBuf) into the spiRxDat.

    How can I know the cc2540 parsing Rx data time consuming?

    Best Regards,

    hangsheng Huang.

  • Hi hangsheng huang,

    If you are sending more data than the buffer holds, you will lose some data. Here is a post about using SPI DMA to transfer more than 256 bytes. Can you try the advice given here: e2e.ti.com/.../515440