new ethernet stack & rtos

22 Oct 2012

i have a couple of questions about the new stack what is the frequency that the rtos checks the ethernet stack for a new packet ? if quite slow can it be increased up ?

i have an application which is sending 530 byte udp packets approx 100 per second and the system will recieve 2 then miss 2 and just keep doing this

if i set the sending machine to 10mb and the mbed to 100mb i can see all 4 packets at a time but i cant be guaranteed the sending machine will be 10mb

if i set the mbed to 10mb and the sending machine to 100mb it will receive 3 packets and ignore the 4th and keep doing that

is there some low level buffer which is getting filled and not emptied hence missing packets by being overwritten could the buffer be made bigger or get the rtos to check more frequently

any suggestions welcome

many thanks

chris

25 Oct 2012

Hi

here is my main for the program i'm trying to get to work with the udp socket but the ethernetinterface just doesnt seem to be able to cope with the speed

data is sent from a media server in 530 byte udp packets and within each data packet is 512 bytes of dimmer level data and an artnet header and a universe number of that packets destination

it is 100 packets sent at approx 25hz so 4 packets are sent each time followed by a wait of approx 20-30ms and 4 more packets are sent and so on

the receive software above retrieves the packets and we check inbuffer[14] which contains the universe of the packet we need to work with and we need to check if its one of ours rxport1 to rxport4 if its one of ours we copy into universe 1 to 4

the issue is this wont recieive any more than 2 universes at a time so we can receive universe 1 & 2 but it will ignore 3 & 4 could this be a buffer issue with the first 2 packets coming in but the next 2 packets are being discarded and the delay between groups of 4 packets allow packets 1 & 2 to be worked on

if possible could someone from MBED please have a look at this situation as i am now stuck and cant move forward

looking forward to a solution to this problem

many thanks

Chris

int main (void)
{
    EthernetInterface eth;
    eth.init("2.0.0.2","255.0.0.0","2.0.0.1"); //we will use the mac address eventualy to create the unique ip address
    eth.connect();
    UDPSocket server;
    server.bind(artnet_port);
    server.enableBroadcast();
    Endpoint client;


    while (true) {//b


        int n = server.receiveFrom(client, in_buffer, sizeof(in_buffer));

        if (n > 0) {
                      
          opcode = in_buffer[9];//art poll opcode 20 art poll 50 artdmx
          universelow = in_buffer[14];//dmx universe we wish to use

            switch (opcode) {//c
                case 0x20: { // its art poll request//d
                   memcpy (out_buffer,reply_packet,240);// put reply packet in buffer prior to sending
                   server.sendTo(client, out_buffer, 240);//send artpoll reply to interogating controller
                    }//d
                break;

                case 0x50: { //art output//e
                    //2
                    rxport1 = 0x09;
                    rxport2 = 0x0a;
                    rxport3 = 0x0b;
                    rxport4 = 0x0c;



                    if (rxport1 == universelow ) {
                        ledtest1 = 1;
                        uni1 =1;//toggle pin for my reference
                        memcpy(universe1,in_buffer,n);// this transfers in 5us
                      
                        uni1 = 0;//toggle pin for my reference
                        ledtest1 = 0;
                    }

                    if (rxport2 == universelow) {
                        ledtest2 = 1;
                        uni2 =1;//toggle pin for my reference
                        memcpy(universe2,in_buffer,n);//this transfers in 10us
                        uni2 = 0;//toggle pin for my reference
                        ledtest2 = 0;
                    }

                    if (rxport3 == universelow) {
                        ledtest3 = 1;
                        uni3 =1;//toggle pin for my reference
                        memcpy(universe3,in_buffer,n);//we dont get here unless we switch off the send to rxport 1 or 2
                        uni3= 0;//toggle pin for my reference
                        ledtest3 = 0;
                    }

                    if (rxport4 == universelow) {
                        ledtest4 = 1;
                        uni4 =1;//toggle pin for my reference
                        memcpy(universe4,in_buffer,n);//we dont get here unless we switch off the send to rxport 1 or 2
                        uni4 = 0;//toggle pin for my reference
                        ledtest4 = 0;

                    }
                    break;


                    default:
                        break;

25 Oct 2012

Quick update on progress

Having toggled a pin on reception of a packet I measured 43us between each of the packets but it only indicated 2 packets received so data is coming

I tried modding the config file to turn off autonegotiate ,full duplex and set the speed to 10m and it seems to work so far but every now and again it locks up so I need to track down why

Cheers

Chris