Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Corrupt SDM-SIO1 Data


MatthewBoyd Jul 10, 2014 07:58 PM

I have two SDM-SIO1's connected to a CR1000, and the data from them are often corrupted (unknown symbols instead of data). One is connected to a Vaisala WXT520 via 2-wire RS485 at 19200 baud and the other to a smart powerstrip via 2-wire RS-232 at 9600.

The powerstrip data is only corrupted when the Vaisala is being polled (every 1 s), and the Vaisala is corrupted either way. About 1 in 10 responses are corrupted. Using an o-scope (one shot trigger), the waveforms for both the WXT520 and the powerstrip are very clean. When listening-in at the SDM-SIO1's TX and RX terminals using a serial terminal program, no corruption is found even when some of the lines are recorded corrupt by the CR1000.

Changing the SDMSpeed from the default of 26.04 us to 51.84 us seems to help, and changing it to the minimum of 9 us definitely makes it worse. The corruption for the wind data is usually the later part of the string response, the first part of the string looks fine.

There is 2.5 ft of wire between the CR1000 and the SDM's, which are multi-drop (instead of star) connected.

I flush the buffer via SerialFlush before each SerialIn. The serial buffers for each are set big enough (. The TXDelay's are both set to 50 us and the baud rates, etc. are accurately set.

Any suggestions?


smile Jul 12, 2014 08:38 AM

Hi

please, can you post the CR1000 programm or part of it.

Thanks

Smile


Sam Jul 14, 2014 05:22 AM

also please try the latest loading the latest sdm-sio1 operating system.
https://www.campbellsci.com/downloads?sb=sdm-sio1&c=9999


MatthewBoyd Jul 14, 2014 02:21 PM

Below is the program. I do have the latest OS on the SDM-SIO1 and on the CR1000.

'CR1000
'
PipeLineMode

'Declare Constants
ConstTable
Const MainScanPeriod_s = 10
Const FastScanPeriod_s = 1
Const DataTableLapses = 10
''''''''''''''''''''''''''''''''''''''''''
Const SixInOnePort = 35 'SDM Address 3 = Port 35
Const SixInOneBaud = 19200
Const SixInOneDelay = 50 'default = 50, target=100
Const SixInOneBuff = 136
''''''''''''''''''''''''''''''''''''''''''
Const PwrStripPort = 34 'SDM Address 2 = Port 34
Const PwrStripBaud = 9600
Const PwrStripDelay = 50 'default = 50, target=100
Const PwrStripBuff = 64
EndConstTable

'Declare Variables
Public PollWXT520 As Boolean = True
Public PollPowerStrip As Boolean = True
Public SDMSpeed_uS As Float = 26.04 'default=26.04, res=8.6, target=51.84
Public Time_hr As Float 'time of day
Public Time_min As Float 'minute in hour
''''''''''''''''''''''''''''''''''''''''''
Public SixInOneMeasResp As String * 136
Public SixInOneMeasVals(14) As Float 'split string response from six-in-one sensor
Public SixInOneHeatEnabled As Boolean
Public SixInOneResp(11) As String * 136
Public SixInOneChkRespaWU As String * 136
Public SixInOneChkRespaTU As String * 136
Public SixInOneChkRespaRU As String * 136
Public SixInOneChkRespaSU As String * 136
Public SixInOneChkRespaXU As String * 136
Public SixInOneHeatID As String * 1
Public SixInOneHeatChar As String * 1
Public SixInOneHeatState As String * 20
Dim SixInOneHeatStateID As Long
''''''''''''''''''''''''''''''''''''''''''
Public PwrStripStatus As String * 64
Public PwrStripStatus2 As String * 64
Public PwrStripStates(8) As Float
Public PwrStripState As Long
Public PwrStripCmd As String

'Declare Aliases
Alias SixInOneMeasVals(1) = SerialAddress
Alias SixInOneMeasVals(2) = QueryCmd
Alias SixInOneMeasVals(3) = WindDir_deg
Alias SixInOneMeasVals(4) = WindSpeed_ms
Alias SixInOneMeasVals(5) = AirTemp_C
Alias SixInOneMeasVals(6) = RelHumid
Alias SixInOneMeasVals(7) = AirPres_Pa
Alias SixInOneMeasVals(8) = Rain_mm
Alias SixInOneMeasVals(9) = Hail_hitssqrcm
Alias SixInOneMeasVals(10) = SixInOneTemp_C
Alias SixInOneMeasVals(11) = SixInOneHeat_V
Alias SixInOneMeasVals(12) = SixInOneSource_V
Alias SixInOneMeasVals(13) = SixInOneRef_V
Alias SixInOneMeasVals(14) = Other

'Declare Units
Units WindDir_deg = deg
Units WindSpeed_ms = m/s
Units AirTemp_C = C
Units RelHumid = %
Units AirPres_Pa = Pa
Units Rain_mm = mm
Units Hail_hitssqrcm = hits/cm^2
Units SixInOneTemp_C = C
Units SixInOneHeat_V = V
Units SixInOneSource_V = V
Units SixInOneRef_V = V

'Define Data Tables
DataTable(MainTable,True,-1)
CardOut(0,-1000)
DataInterval(0,0,sec,DataTableLapses)
Sample(1,WindDir_deg,FP2)
Sample(1,WindSpeed_ms,FP2)
Sample(1,AirTemp_C,FP2)
Sample(1,RelHumid,FP2)
Sample(1,AirPres_Pa,FP2)
Sample(1,Rain_mm,FP2)
Sample(1,Hail_hitssqrcm,FP2)
Sample(1,SixInOneRef_V,FP2) 'reference voltage (should be 3.5 V)
Sample(1,SixInOneHeatStateID,FP2)
Sample(1,PwrStripState,UINT2)
EndTable

'Main Program
BeginProg

SDMSpeed(SDMSpeed_uS)

'Open six-in-one serial port
SerialOpen(SixInOnePort,SixInOneBaud,48,SixInOneDelay,SixInOneBuff)
'Set six-in-one sensor settings (commands cannot exceed 32 chars)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0WU,R=0100100001001000,I=1"+CHR(13)+CHR(10),"",0,5) 'pg.109
SerialIn(SixInOneResp(1),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0WU,A=1,G=1,U=M,D=0,N=W,F=4"+CHR(13)+CHR(10),"",0,5) 'pg.109
SerialIn(SixInOneResp(2),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0TU,R=1101000011010000,I=1"+CHR(13)+CHR(10),"",0,5) 'pg.114
SerialIn(SixInOneResp(3),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0TU,P=P,T=C"+CHR(13)+CHR(10),"",0,5) 'pg.114
SerialIn(SixInOneResp(4),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0RU,R=1001000010010000,I=1"+CHR(13)+CHR(10),"",0,5) 'pg.118
SerialIn(SixInOneResp(5),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0RU,U=M,S=M,M=T,Z=A,X=100"+CHR(13)+CHR(10),"",0,5) 'pg.118
SerialIn(SixInOneResp(6),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0RU,Y=100"+CHR(13)+CHR(10),"",0,5) 'pg.118
SerialIn(SixInOneResp(7),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0SU,R=1111100011111000,I=1"+CHR(13)+CHR(10),"",0,5) 'pg.124
SerialIn(SixInOneResp(8),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0SU,S=N,H=Y"+CHR(13)+CHR(10),"",0,5) 'pg.124 in manual
SerialIn(SixInOneResp(9),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0XU,A=0,M=P,C=3,I=0,B=19200"+CHR(13)+CHR(10),"",0,5) 'pg.61
SerialIn(SixInOneResp(10),SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0XU,D=8,P=N,S=1,L=0"+CHR(13)+CHR(10),"",0,5) 'pg.61 in manual
SerialIn(SixInOneResp(11),SixInOnePort,30,13,SixInOneBuff)
'Check six-in-one sensor settings
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0WU"+CHR(13)+CHR(10),"",0,5)
SerialIn(SixInOneChkRespaWU,SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0TU"+CHR(13)+CHR(10),"",0,5)
SerialIn(SixInOneChkRespaTU,SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0RU"+CHR(13)+CHR(10),"",0,5)
SerialIn(SixInOneChkRespaRU,SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0SU"+CHR(13)+CHR(10),"",0,5)
SerialIn(SixInOneChkRespaSU,SixInOnePort,30,13,SixInOneBuff)
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0XU"+CHR(13)+CHR(10),"",0,5)
SerialIn(SixInOneChkRespaXU,SixInOnePort,30,13,SixInOneBuff)
SixInOneHeatChar = Mid(SixInOneChkRespaXU,InStr(1,SixInOneChkRespaXU,"H=",2),1)
SixInOneHeatEnabled = IIF(StrComp(SixInOneHeatChar,"Y") = 0, True, False)

'Open power strip serial port
SerialOpen(PwrStripPort,PwrStripBaud,0,PwrStripDelay,PwrStripBuff)
'Turn outlets 4-8 off (change '0' to '1' to turn on)
SerialOut(PwrStripPort,"$A3 4 0"+CHR(13)+CHR(10),"",0,5)
SerialOut(PwrStripPort,"$A3 5 0"+CHR(13)+CHR(10),"",0,5)
SerialOut(PwrStripPort,"$A3 6 0"+CHR(13)+CHR(10),"",0,5)
SerialOut(PwrStripPort,"$A3 7 0"+CHR(13)+CHR(10),"",0,5)
SerialOut(PwrStripPort,"$A3 8 0"+CHR(13)+CHR(10),"",0,5)

'Start main scan
Scan(MainScanPeriod_s,sec,0,0) 'zero buffer helps avoid skipped slow seq. scans

NextScan

'*************************************************************************************
SlowSequence
'*************************************************************************************
Scan(FastScanPeriod_s,sec,0,0) 'buffers have no meaning in a SlowSequence

'Poll and receive data from WXT520 six-in-one sensor (0=address,R0=command)
'CHR 13 is a carriage return, CHR 10 is a line feed
If PollWXT520 = True
SerialFlush(SixInOnePort)
SerialOut(SixInOnePort,"0R0"+CHR(13)+CHR(10),"",0,5) 'Poll for measured data
SerialIn(SixInOneMeasResp,SixInOnePort,30,13,SixInOneBuff) 'Receive measured data
'If the last three chrs are "Hel", then the return string is likely valid
If StrComp(Right(SixInOneMeasResp,3),"Hel") = 0 Then
SplitStr(SixInOneMeasVals,SixInOneMeasResp,"",14,0)
SixInOneHeatID = Mid(SixInOneMeasResp,InStr(1,SixInOneMeasResp,",Vs",2)-1,1)
EndIf
EndIf
NextScan
EndSequence

'*************************************************************************************
SlowSequence
'*************************************************************************************
Scan(MainScanPeriod_s,sec,0,0) 'buffers have no meaning in a SlowSequence
'Read the state of all 8 of the power strip outlets
'(e.g., Mid(PwrStripStatus,8,1)=1 if relay 1 is on, or 0 if off)
'example response: $A0,00000111,0.05,XX
If PollPowerStrip = True Then
SerialFlush(PwrStripPort)
SerialOut(PwrStripPort,"$A5"+CHR(13)+CHR(10),"",0,5)
SerialIn(PwrStripCmd,PwrStripPort,30,13,PwrStripBuff) 'echo of command
SerialIn(PwrStripStatus,PwrStripPort,30,13,PwrStripBuff)
EndIf

'Call data tables
CallTable(MainTable)

NextScan
EndSequence

EndProg


aps Jul 17, 2014 08:27 AM

Can you please confirm that if you only read the WXT520 that all or some of the measurements are corrupted. If so please confirm the cable length and whether the sensors is powered from the logger or an independent power source.


MatthewBoyd Jul 17, 2014 06:05 PM

The WXT520 does return the occasional corrupt measurement (<1 of 100) when it is the only SDM-SIO1 connected instrument. The cable length is 70 m (230 ft) and it is powered from the same CH200 power supply that powers the CR1000, but it is not powered by the CR1000.

Log in or register to post/reply in the forum.