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");
}