Results 1 to 4 of 4

Thread: Programming for the Ether-Dream DAC

  1. #1
    Join Date
    Oct 2011
    Posts
    2

    Default Programming for the Ether-Dream DAC

    I have a problem using the data command. I have been trying to write my own software from scratch and I have been unable to use the device after writing data. After writing the command the either-dream does not send back an ack, and then hangs and stops responding to other commands as well. The only thing that continues to function is the broadcast and from that I see that the point has been added to the buffer. At this point the only way I can get it to work is to cycle the power. Using wireshark I see that it just completely stops responding. Trying to get around this, I also tried sending the begin command after sending the prepare command, which of course was NAKed, and then tried sending data. The data command still didn't receive a response, but after sending this sequence, when responding to any other command, the device only replied back with an Invalid, and echoed back the begin command. The data point was also not added to the buffer. I have tried everything I can think of and would like to get some direction on solving this.

    for testing purposes I have the structs for the command defined nearly verbatim from the documentation:

    Code:
    struct dac_point {
    	uint16_t control;					
    	int16_t x;						
    	int16_t y;
    	uint16_t i;							
    	uint16_t r;							
    	uint16_t g;							
    	uint16_t b;							
    	uint16_t u1;						
    	uint16_t u2;						
    };
    
    struct data_command {					 
    	uint8_t command; /* ‘d’ (0x64) */	 
    	uint16_t npoints;	
    	struct dac_point data[1];					
    };
    and I am creating a test point to write:

    Code:
    data_command d;
    d.command = 'd';
    d.npoints = 1;
    d.data[0].x=1000;
    d.data[0].y=1000;
    d.data[0].control = 0;
    d.data[0].g = 0;
    d.data[0].b = 0;
    d.data[0].i = 0;
    d.data[0].r = 0;
    d.data[0].u1 = 0;
    d.data[0].u2 = 0;
    I am using winsocks2 and I am creating and binding the sockets as such:
    Code:
    dac = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    bndt = bind(dac,(SOCKADDR*) &local,sizeof(local) );
    I am using blocking send() and recv() inside of critical sections
    and for the write command, the line to write the data appears as
    Code:
    EnterCriticalSection(&CriticalSection);
    c = send(dac, (char*) &d,(int) sizeof(d),0); 
    LeaveCriticalSection(&CriticalSection);
    The critical section is being used because pings are being used in a separate thread.

  2. #2
    Join Date
    Apr 2010
    Location
    USA
    Posts
    216

    Default

    Can you mail me a Wireshark packet capture file? (Uploading it and sending me a PM would be the best way.)

    The DAC shouldn't totally hang like that, though it will close the connection if it gets invalid commands... when you see the connection hang, will it still respond to a new TCP connection to the port?

  3. #3
    Join Date
    Apr 2010
    Location
    USA
    Posts
    216

    Default

    Actually, I think I see the problem - you'll need to tell your compiler that that struct needs to be packed, or it'll add extra padding around the data fields. If you're using MSVC, put #pragma pack(push,1) before the struct definitions and #pragma pack(pop) afterwards.

  4. #4
    Join Date
    Oct 2011
    Posts
    2

    Default

    That worked, thanks for the quick reply!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •