Quantcast
Channel: Wireless Connectivity
Viewing all articles
Browse latest Browse all 116964

Forum Post: RE: CC3000 send() failing with packets larger than ~128 bytes?

$
0
0

Alright!  I fixed it!

In order to send larger packets, you'll need to increase the size of the transmit buffer.  Same applies to the receive buffer with recv().

This is a two step-process.  First, change the value of CC3000TX_BUFFER_SIZE in CC3000_Common.h within the CC3000HostDriver project.  First, determine the size that the buffer should be as explained here: (http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide#TX_and_RX_buffers).  

The calculation for the actual size of buffer for reception and transmission is as follows:

Given the maximal data payload size that is expected to be received by application, the required buffer is

max(CC3000 MINIMAL RX BUFFER SIZE, DESIRED PAYLOAD DATA + HCI DATA HEADER SIZE + SPI HEADER SIZE + RECVFROM ARG LENGTH +1)

E.g. For using RX data payload of 30 Bytes, the RX buffer size will be:
max(119, 30 + 5 + 5 + 24) = 119.

E.g. For using RX data payload of 100 Bytes, the RX buffer size will be:
max(119, 100 + 5 + 5 + 24) = 134.

I need to send packets of 512 shorts (1024 bytes), so my Tx buffer size should be 1058 bytes. There's probably a better way to do this, but I just changed line 122:

// #define CC3000_TX_BUFFER_SIZE (CC3000_MINIMAL_TX_SIZE)
#define CC3000_TX_BUFFER_SIZE  1058

Then rebuild the CC3000HostDriver.

If you try to rebuild your binary now, in my case SensorApplication, you'll get a linker error, something like this:

"../lnk_msp430fr5739.cmd", line 124: error #10099-D: program will not fit into
   available memory.  run placement with alignment fails for section
   ".FRAM_DATA" size 0x49a .  Available memory ranges:
   FRAM_DATA    size: 0xf0         unused: 0xf0         max hole: 0xf0      
>> Compilation failure

The TX and RX buffer are stored in a special memory segment called "FRAM_DATA".  You'll need to increase the size of this memory segment.  Do this by editing your lnk_msp430fr5739.cmd file (I found it in Source/CCS/SensorApplication/).  You'll notice that FRAM_DATA has length 0x00F0 (240 bytes).  We need to increase this size to the required size (in this case 0x049A).  This causes a difference of 0x049A - 0x00F0 = 0X03AA

We need to change the FRAM origin and length to make up for this change in FRAM_DATA length.  We simply add 0x03AA to FRAM origin and subtract 0x03AA from length. The final change looks like:

FRAM_DATA : origin = 0xC200, length = 0x049a
FRAM : origin = 0xC69A, length = 0x38E6

Rebuild SensorApplication and all should be well!

Thanks for the help!

-Griff



Viewing all articles
Browse latest Browse all 116964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>