Hi ,
This is just a sharing for community and a warning regarding char usage :
CC3000 host driver uses many char and perform lot of shift operation on these chars.
Developpers must take care of compilation options :
for example if you use Keil, by default "Plain Char is signed", so this mean the driver will not work properly mainly due to *** on signed char that leads to uncorrect lengh of data for example
instead of lengh 0x39 you will get 0xFFFFF39 ...
Example of macro leading to issue :
unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset)
{
return (unsigned long)
((unsigned long) ((unsigned long)(*(p + offset + 3)) << 24) +
(unsigned long)((unsigned long)(*(p + offset + 2)) << 16) +
(unsigned long)((unsigned long)(*(p + offset + 1)) << 8) +
(unsigned long)(*(p + offset)));
}
i've upgraded all the driver with only "unsigned char", and accordingly upgraded corresponding macros in cc3000_common.c
unsigned long STREAM_TO_UINT32_f(unsigned char* p, unsigned short offset)
{
unsigned char * pbyte = p + offset;
return ((unsigned long)(pbyte[0])) +
(((unsigned long)(pbyte[1])) << 8) +
(((unsigned long)(pbyte[2])) << 16) +
(((unsigned long)(pbyte[3])) << 24);
}
Cheers
Lionel