Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: CReese on July 16, 2014, 02:01:24 PM

Title: Device Driver Error on STREAMIN
Post by: CReese on July 16, 2014, 02:01:24 PM
Hello,

What are possible sources of error for the following error?

Device Driver Error - $DriverError ST143

I get it when I increase the data length on a stream in on @IntSerial from 2 to 3 bytes. I should be getting at least 10.

Thanks,
Colin
Title: Re: Device Driver Error on STREAMIN
Post by: plcnut on July 16, 2014, 02:46:22 PM
Try checking the .inqueue to see what the actual length is that DMD sees in your in-coming stream.
Title: Re: Device Driver Error on STREAMIN
Post by: CReese on July 16, 2014, 03:04:21 PM
It is totally unclear from the help how to do this. Which object has the inqueue property?
Title: Re: Device Driver Error on STREAMIN
Post by: CReese on July 16, 2014, 03:06:27 PM
got it. $serio_002_A.inqueue . but where is @IntSerial?
Title: Re: Device Driver Error on STREAMIN
Post by: franji1 on July 16, 2014, 03:52:46 PM
got it. $serio_002_A.inqueue . but where is @IntSerial?
IntSerial is the image register heap item (note the missing leading "@"; @IntSerial is the device name).  The Device is not the heap item and vice versa.

Some devices have corresponding heap-items, but not all of them do.  If you look on the Device Configuration page of the System Configuration dialog, the last column is labeled Heap Item.  This is the memory-based structure with helpful fields that you can reference in your program or in a Data View or Trend View (like .Inqueue).

See the attached screen shot.
Title: Re: Device Driver Error on STREAMIN
Post by: CReese on July 16, 2014, 04:36:50 PM
So does a timeout raise a serial device error on STREAMIN?
Title: Re: Device Driver Error on STREAMIN
Post by: franji1 on July 16, 2014, 04:49:42 PM
So does a timeout raise a serial device error on STREAMIN?

Yes.  When you have the Network Timeout "Complete when..." checked, and you timed-out, that means you did NOT meet any of the other criteria for "completion", which means that you have NOT received any data in your STREAMIN buffer.  Since you have no data in your data buffer upon completion of the operation, STREAMIN considers this an "error".

Agreed, some protocols, the lack of data does not necessarily mean an "error" per se, but we leave that up to you.

An alternative is to look at the .Inqueue member and wait until it reaches a known level, THEN perform the STREAMIN WITHOUT the "Network Timeout" as one of the "Complete when" options (you can actually have the Length is Complete when... parameter set to the IntSerial.Inqueue value itself!).
Title: Re: Device Driver Error on STREAMIN
Post by: CReese on July 16, 2014, 08:05:26 PM
This is good information.

My problem comes, however, with a device that delivers a data payload that is of varying length and ends with a CRC, rather than any terminating character. In this case, I want the timeout but to still retain the buffer data, which will be of variable length. On timeout, however, no data is transferred to the buffer. It seems as though 'transfer to buffer on timeout' should be an option.
Title: Re: Device Driver Error on STREAMIN
Post by: BobO on July 16, 2014, 11:49:47 PM
So you are getting a payload that is neither terminated nor of a known length? That's odd to me. I didn't design it with the intention that the timeout itself would be the delimiter.

It would be pretty easy to create that function however. Use .InQueue in a delta contact on the reset leg of a timer. Set the preset to the timeout. Timer will fire when it has been idle for the specified timeout. That really might be cleaner than using the timeout of STREAMIN.
Title: Re: Device Driver Error on STREAMIN
Post by: plcnut on July 17, 2014, 08:09:44 AM
It sounds like you may need something like this:

Title: Re: Device Driver Error on STREAMIN
Post by: BobO on July 17, 2014, 09:17:25 AM
It sounds like you may need something like this:



Yep.
Title: Re: Device Driver Error on STREAMIN
Post by: CReese on July 17, 2014, 11:32:42 AM
So you are getting a payload that is neither terminated nor of a known length? That's odd to me. I didn't design it with the intention that the timeout itself would be the delimiter.

It would be pretty easy to create that function however. Use .InQueue in a delta contact on the reset leg of a timer. Set the preset to the timeout. Timer will fire when it has been idle for the specified timeout. That really might be cleaner than using the timeout of STREAMIN.

It IS odd; I agree. I can see how to program it, but thought I'd ask. Good to know how it works, in any case.