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.

CC3000 internal buffer usage (what data is written to the 1500 byte internal buffer and what not)?

When I query the CC3000 with HCI_CMND_READ_BUFFER_SIZE, I get an answer that my CC3000 has 6 buffers, each 1500 bytes long (in hex 06 DC 05 => 0x06 and 0x05DC).

I read from http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide#TX_and_RX_buffers that the maximum TX and RX payload size can be up to 1468 bytes each (excluding the arguments size, HCI header and SPI header).

When using UDP sendto (the packet type with longest arguments), the lengths for headers and arguments would be:

  • SPI header is (always) 5 bytes;
  • HCI header for DATA-HCI-message type is also 5 bytes long;
  • sendto argument length is 24 bytes.

When I sum up 5+5+24+1468, I get 1502 bytes, which is more than 1500 bytes.

Over the SPI bus during sendto command (function hci_data_send), actually additionally more 16 bytes of socket data (family, IP address, port) is sent as well. In detail over SPI lines during sendto go:
5 (SPI header) +5 (HCI header)+24 (arguments)+1468 (TX payload )+16(socket) =1518 bytes.

This value almost matches with the value in CC3000 host driver TI provides in the SDK (http://www.ti.com/litv/zip/swrc282), where CC3000_MAXIMAL_TX_SIZE is defined as 1519 (+1 for the CC3000_BUFFER_MAGIC_NUMBER to detect buffer overrun), which lets me assume that my calculations up to this point are correct.

Now to my problem and question - I do not understand where the maximum Tx/Rx length of 1468 bytes originally comes from, as with it 1518 bytes gets sent over the SPI lines, whereas CC3000 internal buffer size is only 1500 bytes. Is some data (e.g. the header bytes) not written into the CC3000 internal buffers? But even when I subtract them, I still end up with 1508 bytes...

I would greatly appreciate, if someone could shine a light to how the 1468 byte Tx/Rx limitation relates to the 1500 byte CC3000 buffer size?

Thanks,
Risto

  • Hi Risto,

    Has the above model affected your data flow, by creating any issue?

    As far as the application is concerned, you should not exceed 1468 bytes. The rest (1519-1468) is handled by CC3000 HCI driver/SPI driver.The additional logic of managing the provided data by the host, is internal to CC3000.

    As you can see, the value of 1500 bytes is considered as an informational value. I am not sure if we have explicitly used this value anywhere or mentioned this in documentation.

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendra,
    thank you for your answer!

    > Has the above model affected your data flow, by creating any issue?

    As a developer, I want to know what my code does and understand the reasons behind. Without the knowledge of underlying components (such as CC3000, and the CC3000 host driver by TI), only a blind trust to their operation is possible. On another note, anyone in the (professional) software development can easily assure that no code is ever completely bug-free, a statement surely also applicable to the CC3000 host driver from TI. By questioning why something does what, allows developers (=your customers) to understand, write better code resulting in better functioning products, and possibly also fix bugs in linked code fragments.

    > As you can see, the value of 1500 bytes is considered as an informational value.
    >I am not sure if we have explicitly used this value anywhere or mentioned this in documentation.

    And this is very sad! It is unfortunate that as a customer of your hardware, I had to find out the value of  CC3000 buffer size myself by experimenting with the HCI_CMND_READ_BUFFER_SIZE command, instead of finding it inside CC3000 hardware or protocol documentation, where such information belongs.

    IMHO there is a strong demand for more exhaustive information about the internals of CC3000 and the implemented protocol than currently provided by TI in the datasheet http://www.ti.com/lit/ds/symlink/cc3000.pdf and CC3000 Wiki.

    Sincerely,
    Risto

  • I believe to have figured out the relation between the HCI_CMND_READ_BUFFER_SIZE replies 1500 byte buffers and over the wire (SPI) packet length. I documented it in the CC3000 Wiki.

    In brief - the 1500 byte buffer is not directly related to SPI packet length, and is only used to save UDP or TCP outgoing data (only during hci_data_send). The maximum UDP or TCP data payload is limited to 1468 bytes, the remaining 32 bytes are used for arguments and parameters.

    SPI packet length can be up to 5+65535 bytes, whereas the longest packet type able to utilize this is the HCI Patch packet type (type code 0x03). As CC3000 has only 0x4400=17KBytes of patchable code in it's EEPROM (driver+firmware+bootloader), the maximum realistic SPI packet ever to go over the bus is just slightly more than this value (contains additionally to 17KBytes also the different message headers).

    Regards,
    Risto