Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
12580 Discussions

NIOSII/f Truncating UDP packets


I am writing an application using a NIOS II to transmit UDP packets at a modest rate.  Using a NIOS II/e, the processing rate was insufficient, so I moved to a NIOS II/f.  The packets I need to send are just over 1kByte (1044 bytes).

As a demonstrator, I now have an application based on the standard SSS, that sends a UDP packet whenever I packet is received.  The packet is 1100 bytes.

This works fine on NIOS II/e.  The packets are received and the reply received on a PC app.

When I switch the processor to a NIOS II/f (changing nothing else), the application appears to work from the NIOS end without error, but the packets actually sent by the system are incomplete.  Looking at them with Wireshark they are not the correct length.  The headers are fine, but the total number of bytes varies from 400bytes up to the correct size.  As such, they do not arrive in the application as the size specified in the header does not match the actual packet size.

Any ideas why there would be a difference between e & f NIOS II variants?

0 Kudos
2 Replies

Demonstration code is a standard SSS example with this task added.

void UDPTask()
	unsigned char packet[100];
	struct sockaddr_in addr_client = {0};
	int sizeof_addr_client = sizeof(addr_client);
	struct sockaddr_in addr_server = {AF_INET, htons(49213)};
	addr_server.sin_addr.s_addr = INADDR_ANY;

	int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
	if (bind(sockfd, (struct sockaddr *)&addr_server, sizeof(addr_server)) < 0)
	    printf("============================BIND FAILED\n");
#define PING_SIZE	1100
	char ping[PING_SIZE];
	ping[0] = 0x04;
	ping[PING_SIZE-1] = 0x7c;

	printf("-----------------------UDP TASK\n");

		int n = recvfrom(sockfd, (char*)packet, 100, 0x100, (struct sockaddr *)&addr_client, &sizeof_addr_client);
		printf("----------------------MSG_IN %d %x\n", n, n>0 ? packet[0] : 0);
		sendto(sockfd, ping, sizeof(ping), 0x800, (struct sockaddr *) &addr_client, sizeof_addr_client);
0 Kudos

The f variant is higher performance, for transferring UDP packet you need high performance.

0 Kudos