Home/Support/Support Forum/udp packet (size 665 bytes) to spi pins
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

udp packet (size 665 bytes) to spi pins

0 votes
I want to print the udp packets I send over the network to the spi pins. I wrote a code for this purpose. The size of my udp packets is 665 bytes.


What I want to ask is that when I print the udp package on the spi pins, I lose the package and there is a jitter in the spi module.

my sample code is as follows:

//
SPI REGISTER
rc = NASpiRegisterDevice(devicePtr1);
if (rc)
{
//printf("NASpiRegisterDevice() failed %d\n", rc);
}
else
{
//printf("\nNASpiRegisterDevice() success! % d\n",rc);
}
//
while (1)
{
BytesRcvThisTime = MAXBUFFERSIZE; //665
CallStatus = udp_RecvAPacket(ListenerSocket, &TheLocalAddress, InputBuffer, &BytesRcvThisTime);
if (CallStatus > 0 && BytesRcvThisTime==665)
{

//
BURASI SPI TRANSFER

ccode = NASpiReadWrite(devicePtr1->name,InputBuffer,OutputBuffer,BytesRcvThisTime);

if(ccode==NASTATUS_SUCCESS){
if(OutputBuffer!=NULL){
//puts(OutputBuffer);
ret=0;
}
}
else if( ccode==NASTATUS_INVALID_CHANNEL || ccode==NASTATUS_INVALID_HANDLE || ccode==NASTATUS_INVALID_PARAMETER){
//printf("Something unsupported to master device because its invalid ");
ret=-1;
}
else if(ccode==NASTATUS_SPI_MASTER_INVALID_PORT_NUMBER || ccode==NASTATUS_SPI_MASTER_UNSUPPORTED_PORT ){
//printf("Port number not defined or not supported ");
ret=-1;
}
else if(ccode==NASTATUS_SPI_MASTER_INVALID_BUFFER){
//printf("Buffer is empty");
ret=-1;
}
else{
error_count+=1;
ret=-1;
}
//

//
BUFFER BOÞALTILIYOR.
memset(InputBuffer, '\0', (MAXBUFFERSIZE + 1));
memset(OutputBuffer, '\0',(MAXBUFFERSIZE + 1));


}
}
//
SPI DEREGISTER
rc = NASpiDeregisterDevice(devicePtr1->name);
if (rc)
{
//printf("\nNASpiDeregisterDevice() failed!\n");
}
else
{
//printf("\nNASpiDeregisterDevice() success! %d\n", rc);
}
//printf("\n");
}
asked Jan 13 in NET+OS by mertguler New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
You have opened a support case for this question and we have replied with some follow up questions. Please respond to the email from the support that was sent to you on January 14, 2020
answered 2 days ago by LeonidM Veteran of the Digi Community (3,212 points)
...