Page 1 of 1

Problem with new SDK

Posted: April 24th, 2008, 3:34 am
by sensor
Hello, i change ma software with the new dll.
And when i send a command, i have a -166 error code.
i dont anderstand.

error code:
TKFRAME_CSAFE_FRAME_TOO_LONG_ERR 166 CSAFE frame exceeds maximum allowable frame length

someone can help me ?

excuse for my bad english, i m french

Posted: April 25th, 2008, 6:29 pm
by haboustak
A: Are you using a PM3 or PM4?
B: Do you have the latest firmware?

I think that there might have been some increases in report sizes within the CSAFE library to allow for larger messages. The maximum report length in the previous SDK was 120, but I think they added an even larger one.

If updating your device to the latest firmware doesn't resolve your issue, then I'd be curious as to hear the following.
1: How large are your command and response buffers. (if you're using the preprocessor to declare them, what's the value of the macro).
2: When you call tkcmdsetCSAFE_command what values are you providing to cmd_data_size and rsp_data_size? (again, if you're using a macro, what's its value)

Hopefully a firmware update resolves it. If not -- the old CSAFE headers used a buffer on the order of 110 bytes. Compare your current value to the old.

Mike

PM4

Posted: April 27th, 2008, 3:55 am
by sensor
Hello,

thank for your response.

i have a PM4 et i try the sample code given ine the documentation.

j have our he last firmware Version 21 (released November 2007)

i give you an code example:

short ecode = -1;
unsigned short rsp_size = 0;
unsigned long rsp_data[100];

unsigned long cmd_data2[] = {0xA1};
cmd_size = sizeof(cmd_data2)/sizeof(unsigned long);

ecode = tkcmdsetCSAFE_command(pDoc->m_unit_address, cmd_size, cmd_data2, &rsp_size, rsp_data);

if(ProcessError(ecode)) continue;


you think my problème can be with 'rsp_data[100];' too small ?

i'm in holiday for 7 days, i try later a bigger value.

says me if the problem can be here.

thank

Posted: April 28th, 2008, 1:32 am
by haboustak
I think you just need to tell the library how much space you've allocated for a response. So rsp_size should be initialized to 100 bytes. It will be set to the number of response bytes once the function completes.

Code: Select all

   unsigned short rsp_size = 100; 
The library is trying to tell you "The response from the device would not fit into the space you had available." (that said... I wouldn't have guessed that's what it meant)

Let us know if that helps.

i will try

Posted: April 28th, 2008, 2:36 am
by sensor
thank for your response,

it's logic for me our after read you.
i try when i return at home and i tell you

sebastien

Resolved

Posted: May 25th, 2008, 1:17 pm
by sensor
Thank for your code

it's ok with the size of the buffer allowed

unsigned short rsp_size = 100; //o before ..
unsigned long rsp_data[100];

the rsp_size must be at 100 in may sample before each command.

sensor

Re: Problem with new SDK

Posted: November 9th, 2012, 12:28 pm
by mchase
The response buffer size must be passed into those functions requiring it and the buffer size should not exceed the size of the USB buffer; otherwise you will receive an error about "report too long". Do not pass in a zero.

In querying the USB buff size:
UINT16_T responseBuffSize;
ushort ecode = tkcmdsetDDI_max_report_size(monitorInfo.m_iDeviceNum, &responseBuffSize);
I have returned "120" as the USB buffer size.
Hope that helps anyone in the future.

Problem with new SDK

Posted: June 22nd, 2015, 2:29 am
by pearlofet
Thanks for the information, such problem may be caused by a firewall.
If you want, I can include your C# wrapper in the AMIP SDK distribution.