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