Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Using UE9 with UDP feedback command


  • Please log in to reply
10 replies to this topic

#1 labaip

labaip
  • Members
  • 5 posts

Posted 27 May 2014 - 02:35 AM

Hello ,

I'm using UE9 with UDP feedback command at fast rates (1 command every 2 mS) .

Everything seems to work ok but I found some (1 every 100-1000 commands) command checksum error , I'm not able to explain myself.

 

Errors are repeated at the same checksum values (i.e. CHK8=0x06 CHK16=0xFE , CHK8=05 CHK16=0xFD , CHK8=04 CHK16=0xFC  ) .

 

Checksum routines used are the C samples found on site.

 

Is there any possible issue in checksum routine UE9 side or C samples side ?

 

Regards

Maurizio



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 May 2014 - 04:46 PM

The checksum routine should be correct.  Would it be possible to send us the entire array of bytes sent & received when you get the error?  Looking at the full command and its response would help a lot in figuring this out.  You can either post them here or send them to us at [email protected]



#3 labaip

labaip
  • Members
  • 5 posts

Posted 28 May 2014 - 01:11 AM

Hello ,

here below some data packet generating checksum error .

I simply generate a sinusoidal waveform on DAC0 with UDP feedback command . All other datas are fixed , except checksums.

Note that at buffer element #17  I find always a Cx data-range value on errors .

This make me think about a software managing issue (C side or UE9 side) rather than a bad or crashed UDP trasmission.

 

In files attached there are two errors generation errsin.txt from sinusoidal DAC0 values , errlin.txt from linear ramp DAC0 values,

with the same Cx buffer element #17 values constant.

 

Regards

Maurizio Milani

 

[ERR15 OK1325] 49 f8 0e 00 41 01 04 04 00 00 00 00 00 00 00 00 75 c1 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR16 OK1424] b5 f8 0e 00 ad 01 04 04 00 00 00 00 00 00 00 00 e1 c1 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR17 OK1424] c5 f8 0e 00 bd 01 04 04 00 00 00 00 00 00 00 00 f1 c1 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR18 OK1790] b1 f8 0e 00 a9 01 04 04 00 00 00 00 00 00 00 00 db c3 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR19 OK1790] 9c f8 0e 00 94 01 04 04 00 00 00 00 00 00 00 00 c6 c3 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR20 OK2526] 9d f8 0e 00 95 01 04 04 00 00 00 00 00 00 00 00 c0 ca 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR21 OK2526] b4 f8 0e 00 ac 01 04 04 00 00 00 00 00 00 00 00 d7 ca 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR22 OK2606] 8f f8 0e 00 87 01 04 04 00 00 00 00 00 00 00 00 ad cf 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR23 OK2606] 94 f8 0e 00 8c 01 04 04 00 00 00 00 00 00 00 00 b2 cf 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR24 OK2764] f5 f8 0e 00 ee 00 04 04 00 00 00 00 00 00 00 00 1d c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR25 OK2764] dd f8 0e 00 d6 00 04 04 00 00 00 00 00 00 00 00 05 c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR26 OK3521] 38 f8 0e 00 30 01 04 04 00 00 00 00 00 00 00 00 5b ca 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR27 OK3523] 68 f8 0e 00 60 01 04 04 00 00 00 00 00 00 00 00 8b ca 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR28 OK3679] aa f8 0e 00 a2 01 04 04 00 00 00 00 00 00 00 00 ca cd 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR29 OK3680] 88 f8 0e 00 80 01 04 04 00 00 00 00 00 00 00 00 a8 cd 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR30 OK3759] 5e f8 0e 00 56 01 04 04 00 00 00 00 00 00 00 00 85 c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR31 OK3760] 2d f8 0e 00 25 01 04 04 00 00 00 00 00 00 00 00 54 c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR32 OK4582] c3 f8 0e 00 bb 01 04 04 00 00 00 00 00 00 00 00 e2 ce 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR33 OK4583] da f8 0e 00 d2 01 04 04 00 00 00 00 00 00 00 00 f9 ce 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR34 OK4861] 11 f8 0e 00 09 01 04 04 00 00 00 00 00 00 00 00 3e c0 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR35 OK4862] 0c f8 0e 00 04 01 04 04 00 00 00 00 00 00 00 00 39 c0 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR36 OK4960] 96 f8 0e 00 8e 01 04 04 00 00 00 00 00 00 00 00 bf c4 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR37 OK4962] c4 f8 0e 00 bc 01 04 04 00 00 00 00 00 00 00 00 ed c4 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR38 OK4974] 12 f8 0e 00 0a 01 04 04 00 00 00 00 00 00 00 00 39 c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR39 OK4976] 43 f8 0e 00 3b 01 04 04 00 00 00 00 00 00 00 00 6a c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR40 OK6105] 87 f8 0e 00 7f 01 04 04 00 00 00 00 00 00 00 00 a5 cf 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR41 OK6105] 8c f8 0e 00 84 01 04 04 00 00 00 00 00 00 00 00 aa cf 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR42 OK6262] 39 f8 0e 00 31 01 04 04 00 00 00 00 00 00 00 00 60 c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR43 OK6263] 20 f8 0e 00 18 01 04 04 00 00 00 00 00 00 00 00 47 c6 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR44 OK6314] c9 f8 0e 00 c1 01 04 04 00 00 00 00 00 00 00 00 f5 c1 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
[ERR45 OK6315] aa f8 0e 00 a2 01 04 04 00 00 00 00 00 00 00 00 d6 c1 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00

Attached Files



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 May 2014 - 02:48 PM

Are you detecting checksum errors in you command packets, or are these command packets that produce response packets with checksum errors? The checksums in the above commands look correct checksum wise.

 

Make sure you are passing the correct array size to the checksum functions. Also, post your code that detects the checksum errors and a packet that causes the error.



#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 May 2014 - 02:57 PM

Are the above commands producing a BadChecksum response of 0xB8, 0xB8 from the UE9:

 

http://labjack.com/s...ers-guide/5.3.1



#6 labaip

labaip
  • Members
  • 5 posts

Posted 29 May 2014 - 01:59 AM

Hello ,

I made some other tests and I can think about a misunderstanding in checksum computation (maybe carry/borrow flag issues) somewhere :

 

1) I found checksum errors only in tx feedback command.No errors on rx feedback values , using the same checksum routine.

 

unsigned char cC8(unsigned char* buffer){                                 // Checksum 8

    int i; // For loops
    unsigned short int temp; // For holding a value while we working.
    unsigned short int checksum = 0;

             
    for( i = 1; i < 6; i++){
               checksum = checksum + buffer[i];
    }
    
    temp = checksum/256;
    checksum = ( checksum - 256 * temp ) + temp;
    temp = checksum/256;
    
    return (unsigned char)( ( checksum - 256 * temp ) + temp );   
}

// ----------------------------------------------------------------

unsigned short int cC16(unsigned char* buffer, int len){                  // Checksum 16
    int i;
    unsigned short int checksum = 0;

        
    for( i = 6; i < len; i++){
        checksum += buffer[i];
    }
    
    return (unsigned short int) checksum;
}

 

 
2)My main 1mS routine GIVES or DOESN'T GIVE CHECKSUM ERRORS depending on values I if I increment/decrement the two DACx variables :

              if (flip==0) {                                                                              // dac & dac1 are integers , lsb. and msb. and flop unsigned char

                                dac=dac+8;                                                           // NO CHECSUM ERROR IF I INCREASE DAC and DECREASE DAC1 in the same way !!!
                                dac1=dac1-8;
                              
                                lsb=dac&0x00FF;                                                   // DAC0 ramp value LSB  FEEDBACK TX byte #16
                                msb=(((dac&0xFF00)/256)&0x0F)|0xC0;                // DAC0 ramp value MSB                     TX byte #17
                                lsb1=dac1&0x00FF;                                               // DAC1 ramp value LSB                      TX byte #18
                                msb1=(((dac1&0xFF00)/256)&0x0F)|0xC0;            // DAC1 ramp value MSB                     TX byte #19
                                flop=flop^0x4;                                                         // Flip IO FIO3                                       TX byte #8
                            

                                trasfe_tx(0);                                                           // OUT FEEDBACK to UDP socket

                               } 

           

             if (flip==1) {trasfe_rx(0);                                                             // INP DATA from UDP socket ...
                              }                                                
           

            flip=flip^0x1;   

 

Other NO CHECKSUM ERRORS CONDITIONS :

If I use DAC++;DAC1--;                             NO CHECKSUM ERRORS

If I use DAC=DAC+32;DAC1=DAC1+32;   NO CHECKSUM ERRORS

 

All other increase conditions (computed as I need in real working application with float computation (i.e. DAC=2048+((float)dacV*(float)K_alignement) ) generates some checksum errors.

 

Thanks for your help.

Maurizio Milani



#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 May 2014 - 12:38 PM

1. Your code looks fine here, though if you are unsure you can copy the extendedChecksum16/8 functions from the ue9.c file from the examples.

 

2. Can you provide the code for how you are using your checksum functions, how feedback bytes are set and how you are detecting the error? Better, can you attach your full source code files or email them to us at [email protected] . I assume you are setting your Feedback command's checksums before every UDP write and performing error detection in your trasfe_tx call.



#8 labaip

labaip
  • Members
  • 5 posts

Posted 30 May 2014 - 12:11 AM

Hello ,

I attached the whole test software 2 versions , generating error and not generating error  .

It's quite short and you can test it from a PC 192.168.100.14 connected to a UE9 with IP 192.168.100.51 (our standard).

Sorry if some part of comments in file are in italian language.

 

Note that I found different checksum errors with different 'rolling' numbers .

In periodic 1mS routine Perint_tmr() the only difference at line dac0++;dac1++;

 

In sw aipB2B_ERR.c  I increase both dac0 & dac1 , 1 per 2mS cycle I obtain some errors as usual.

In sw aipB2B_NOERR.c  I increase dac0 and decrease dac1 , 1 per 2mS cycle I obtain no errors at all.

 

Thanks

Maurizio Milani

Attached Files



#9 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 30 May 2014 - 07:00 PM

I ran your code and see that certain UE9 Feedback commands, that seemingly have correct checksums, using UDP communications are producing responses of 0xB8, 0xB8 (BadChecksum). I'm not sure of the cause yet, but it seems UDP related. We'll look into this more next week and let you know what we find. In the meantime, if possible try using TCP communications instead of UDP and see if that helps. I noticed in my tests certain packets that were producing BadChecksum responses using UDP would work using TCP.



#10 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 03 June 2014 - 03:38 PM

There was a bug with the UDP checksum routine for certain commands on the UE9 end. This has been fixed in Comm. firmware 1.59 (159) which is currently available for download on beta firmware page:

 

http://labjack.com/s...rmware/ue9/beta

 

Update your firmware with 1.59 .bin file using LJSelfUpgrade. After the update, let us know if you are still running into problems.



#11 labaip

labaip
  • Members
  • 5 posts

Posted 04 June 2014 - 01:10 AM

Perfect .

Now everything work as expected with no more random checksum errors on UDP commands.

 

Thank you very much , rarely I found this kind of quick and resolutive 'feedback'.

 

Maurizio Milani




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users