Welcome, Guest. Please login or register.
November 22, 2024, 01:42:19 PM

Login with username, password and session length
* Home Help Arcade Login Register
.
+  Forum
|-+  Homebrew Player Tracking and EFT Systems.
| |-+  NLG Homebrew Player Tracking and EFT Systems.
| | |-+  It is not possible to do a reliable SAS interface with Windows API
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: It is not possible to do a reliable SAS interface with Windows API  (Read 10745 times)
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« on: March 06, 2012, 03:15:57 AM »

Ok folks, so I have spent a couple of weeks playing around with SAS protocol and 9 bit comms whilst waiting on approval for my next project. I was convinced that it was possible to make a reasonably reliable solution using just the windows API and not having to move into Windows Kernel land, but alas I now know better.

The problem is thus. When you send a SAS command, it uses a wake up bit. This needs to be set for the first byte, and cleared for subsequent bytes.

A general poll is a singe byte to the poll address of the machine, so I set the parity bit to emulate the wake up bit, send the general poll, then clear the parity bit. However, the serial driver in Windows does not set the parity immediately (it waits for an interrupt). Because of this delay, the parity bit does not get cleared immediately, but machine then sends back its response to the general poll immediately, and it has a parity error, so I can't determine if its a chirp or a poll response.

Now this method worked fine on the IGT machine I had before, but it does not work on the WMS machine, so its definitely timing issue that is specific to individual machines.

IF you are not worried about chirps, you can get away with this by not looking for parity errors, which is fine for home use but no good for commercial use (sorry guys). Unfortunately, I need something for commercial use.
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #1 on: March 06, 2012, 04:36:44 AM »

What chirps are you worried about and why do they occur?
If it is the link broken or host not polling fast enough chirps then do these 2 things
1 if the link is broken, the host is not going to see the chirps until the link is fixed anyways and figure out with IT and security how to prevent it.
2 if is because the host is not polling fast enough then more or faster hosts need to used.

If it keeps happening at particular property then something is not right.
Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
jay
Global NLG Site Moderator
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 483
Offline Offline

Gender: Male
Posts: 3178


if you cant afford to lose you cant afford to win


« Reply #2 on: March 06, 2012, 05:28:37 AM »

Linuix !
Logged

The only way to beat the casino is to own it
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #3 on: March 06, 2012, 09:47:12 AM »

What chirps are you worried about and why do they occur?
If it is the link broken or host not polling fast enough chirps then do these 2 things
1 if the link is broken, the host is not going to see the chirps until the link is fixed anyways and figure out with IT and security how to prevent it.
2 if is because the host is not polling fast enough then more or faster hosts need to used.

If it keeps happening at particular property then something is not right.

The point is, they can happen, and you need to deal with them. The reason why they are happening is irrelevant. Welcome to commercial programming, to make things reliable we have to deal with all circumstances.  hissy fit

Linuix !

Yeah yeah... I have to do all this stuff in linux too, but how many people here use linux?  propeller



The point of all this is that my original concept is no good. This project is pretty close to getting the clients approval, so now I have to move into commercial mode. I am still going to work on a cheap way to do this, but it means I need to move into windows kernel space. This means a dedicated device driver, which will be serial.sys, or the default windows serial driver. No USB. bawling
Logged
Foster
The S2000 GURU
Contributing NLG Member
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 345
Offline Offline

Gender: Male
Posts: 2872



« Reply #4 on: March 06, 2012, 08:49:57 PM »

You can use a different DLL with C++, C# and VB access by class that can handle any serial including USB

The work around for bug in the SerialPort Class in frameworks actually creates almost the same functions in SerialPort class but all calls are to the kernel.
The Code Project website has posts and articles about it.


 
Logged

A Slot Machine and Coca-Cola Addict!!
"If it is not broke do not fix it" I keep forgetting that!
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #5 on: March 06, 2012, 08:58:14 PM »

You can use a different DLL with C++, C# and VB access by class that can handle any serial including USB

The work around for bug in the SerialPort Class in frameworks actually creates almost the same functions in SerialPort class but all calls are to the kernel.
The Code Project website has posts and articles about it.
 

Does not matter what DLL you use, its how the standard microsoft serial driver works that is the problem. Because it queue's all operations for a hardware interrupt, its not possible to rely on it to get the timing right. What you have to do is change serial.sys so that the operation is not queued, or if it is the handling of the parity bit is done in the same operation as the write.
Logged
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #6 on: March 06, 2012, 09:02:38 PM »

BTW. This is what you need http://www.ncon.com/9bit.shtml
Logged
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #7 on: March 06, 2012, 10:44:13 PM »

That guy who owns that driver is on leave till 26th of this month, bugger. Started rolling my own driver, looks pretty easy at this stage, but I am guessing that it will get a lot harder Scratch Head
Logged
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #8 on: March 08, 2012, 02:36:45 AM »

Well I managed to get the driver working. Not bad going considering a week ago I knew nothing about windows drivers!! Its now working a treat. Driver is pretty badly hacked, but it works. DLL is working the best it has, and I would say that it is now at a commercial standard!

Now that part is done its time to fully learn the intricacies of the SAS protocol!
Logged
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #9 on: April 04, 2012, 08:14:45 PM »

Well I had another idea folks, but this one will still require real serial ports, and in fact would require 2. Now I came up with this idea as I was modifying the driver for our fibre optic serial port PCI card to work with sas.

with the standard 16550 UART, there is no way to tell if a byte has been transmitted, even if talking directly to the UART. The problem with this is we need to set the partiy bit, and we need to be able to tell when the first byte is sent before we turn parity off.

There is couple of ways to tell if a byte has been transmitted.
  • Work out how long it takes to send out one byte. This is not possible using win API, as all serial port writes are deferred for an interrupt.
  • Use a daisy chain (or loop), where all data is sent to all machines and is received back on the serial port.
  • Use a second serial port to monitor what is being sent on the first serial port.

It is infact, a combination of the second and third that are used in out commercial fibre card. Each port actually uses 2 UARTS. One UART has the transmit looped back into the receive on the PCB, and the second UART is used purely to receive data. So you basically have a dedicated transmit UART, and a dedicated Receive UART. Because the fibre is daisy chained, you also receive all data back into the receive UART.

When I have finished my current SAS work, I might have a crack at doing this, and I might even do it all in c#. I need to think hard about this though, the reason I used a c++ dll initially was because a). its easier for low level message handling and b) because it abstracts away the stuff that encompasses my NDA with IGT.

Logged
jay
Global NLG Site Moderator
Sr.Tech NLG Member 1000+ Post
*

Total Karma Storms: 483
Offline Offline

Gender: Male
Posts: 3178


if you cant afford to lose you cant afford to win


« Reply #10 on: April 05, 2012, 02:54:32 AM »

Andy,

While I understand the reliability of serial, fewer and fewer PCs have this technology available.
SO with a look to the future may I suggest a direct USB (not USB to serial) interface. There is lots of programming support for USB drivers available.
This will give you direct access to kernal interrupts.
Logged

The only way to beat the casino is to own it
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #11 on: April 05, 2012, 03:36:31 AM »

Andy,

While I understand the reliability of serial, fewer and fewer PCs have this technology available.
SO with a look to the future may I suggest a direct USB (not USB to serial) interface. There is lots of programming support for USB drivers available.
This will give you direct access to kernal interrupts.

Just more complication though. To do it direct with USB requires a roll your own solution with DSP or Micro. All possible, just not sure if I want to do it.

Serial cards (PCI, PCI-X etc) are cheaply and easily had.

Logged
SlotSpecialist
New NLG Member 1 to 100 Post
**

Total Karma Storms: 0
Offline Offline

Posts: 3



« Reply #12 on: May 14, 2012, 09:35:59 AM »

Hi,

I used following library:
http://www.wcscnet.com/Products/CdrvNT/CdrvNTDownloads.htm

With that I succeeded with the implementation of the SAS protocol - including the wakeup bits ;-)

Logged
zarobhr
Contributing Gold NLG Member
Sr.NLG Member 501 to 1000 Post
*

Total Karma Storms: 178
Offline Offline

Gender: Male
Posts: 622



« Reply #13 on: May 14, 2012, 11:33:00 AM »

Hi,

I used following library:
http://www.wcscnet.com/Products/CdrvNT/CdrvNTDownloads.htm

i tried that one and could not get it to work with my serial card. and the never responded to my support requests


With that I succeeded with the implementation of the SAS protocol - including the wakeup bits ;-)


Logged
SlotSpecialist
New NLG Member 1 to 100 Post
**

Total Karma Storms: 0
Offline Offline

Posts: 3



« Reply #14 on: May 14, 2012, 11:55:35 AM »

Oh really?
They had an exceptional support when I called them ...
I am sorry .
Logged
AndyP
NLG Member 101 to 500 Post
***

Total Karma Storms: 127
Offline Offline

Posts: 212



« Reply #15 on: May 14, 2012, 07:07:39 PM »

Hi,

I used following library:
http://www.wcscnet.com/Products/CdrvNT/CdrvNTDownloads.htm

With that I succeeded with the implementation of the SAS protocol - including the wakeup bits ;-)



I did write a driver myself, that works ok.

The part I dont like is that you have to use timing to work out when the first byte is transmitted, because the UARTS (or at least the UARTS on my PC) dont give a reliable indication of when the data has actually been clocked out of the tx register.

I should do some more work on this actually, things are quiet at the moment.
Logged
SlotSpecialist
New NLG Member 1 to 100 Post
**

Total Karma Storms: 0
Offline Offline

Posts: 3



« Reply #16 on: May 14, 2012, 11:22:25 PM »

 This sounds tough...
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


If you find this site helpful, Please Consider Making a small donation to help defray the cost of hosting and bandwidth.



Newlifegames.com    Newlifegames.net    Newlifegames.org
   New Life Games    NewLifeGames  NLG  We Bring new Life to old Games    1-888-NLG-SLOTS
Are all Copyright and Trademarks of New Life Games LLC 1992 - 2021


FAIR USE NOTICE:

This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner.
We make such material available in an effort to advance awareness and understanding of the issues involved.
We believe this constitutes a fair use of any such copyrighted material as provided for in section 107 of the US Copyright Law.
In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit to those
who have expressed a prior interest in receiving the included information for research and educational purposes.

For more information please visit: http://www.law.cornell.edu/uscode/17/107.shtml.

If you wish to use copyrighted material from this site for purposes of your own that go beyond fair use,
you must obtain permission directly from the copyright owner.

NewLifeGames.net Web-Site is optimized for use with Fire-Fox and a minimum screen resolution of 1280x768 pixels.


Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Loon Designed by Mystica
Updated by Runic Warrior
Page created in 0.102 seconds with 20 queries.