# Running OLA with an USB FTDI device : RX buffer problem ?



## RenZO (Aug 3, 2012)

Hello,

First, I need to explain what is OLA : Open Lighting Architecture.
OLA is a framework for lighting purposes, so it provides a way to use DMX and RDM protocols (used in theaters and many shows).
Transport could be over IP or USB devices. More infos and code on the website:
http://www.opendmx.net/index.php/OLA

I already use OLA under Linux systems, and I decided to try it on FreeBSD 9.0-RELEASE.
OLA build was made easily, thanks to some ajustments by Simon (OLA's author).
All seems to be working, but I encounter a problem with USB devices.
I have two different devices : Enttec USB Pro and Jese TRI. Both are based on FTDI chipset, and used through:
/dev/ttyU0

The detection is like:

```
ugen0.2: <ENTTEC> at usbus0
uftdi0: <DMX USB PRO> on usbus0
```

When using the Enttec device, OLA can send data without problem (TX only), but will stop quickly when using RDM (TX + RX).
When using the TRI device, OLA can only send 15 frames (TX with Return Code) before stop, and will stop when using RDM (TX + RX) too.

So I tried to change the port speed:

```
# stty -f /dev/ttyU0.init speed 115200
```

Then, I restart OLA and the TRI can now send 170 frames (the returned code for each frame is about 2 bytes), and RDM exchanges can go further than before, but it finally stops. So, it seems to be a buffer problem, but only in RX transmission (because TX works with Enttec, without returned code).

Maybe you'll want to read some OLA code (about the TRI plugin):
http://code.google.com/p/open-lighting/source/browse/plugins/usbpro/DmxTriWidget.cpp

Anyway, if I restart OLA, I can use it again until the next stop ; so it doesn't seem to be a system problem.
Here are the settings when olad is running:


```
localhost# stty -f /dev/ttyU0
speed 115200 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost -onlcr tab0
cflags: -cread cs5 -parenb -hupcl
discard dsusp   eof     eol     eol2    erase   erase2  intr    kill    
^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      
lnext   min     quit    reprint start   status  stop    susp    werase  
^@      0       ^@      ^@      ^@      ^@      ^@      ^@      ^@
```

Is there a setting which allows a "duplex usage" of this kind of port?
I've tried these options without success:

```
stty -f /dev/ttyU0.init ixoff ignbrk igncr
```

I'm ready to try anything 

Thanks
RenZO


----------



## wblock@ (Aug 3, 2012)

Does it make any difference to use /dev/cuaU0?  I admit to not being clear on the difference, but have only used cuaU0.


----------



## RenZO (Aug 3, 2012)

With /dev/cuaU0, it's exactly the same behavior.


----------



## RenZO (Aug 5, 2012)

Finally, Simon found the solution. It's because of the cflag CREAD.
And I didn't figure out that the minus(-) in '-cread' means it's disabled (I was thinking of -argument) !

So, 'cread' needs to be enabled, because as said in stty manual: Enable the receiver.
Since olad is running, we can enable the flag with:

```
# stty -f /dev/ttyU0 cread
```

Then, we don't see '-cread' in the settings:


```
localhost# stty -f /dev/ttyU0
speed 115200 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost -onlcr tab0
cflags: cs5 -parenb -hupcl
discard dsusp   eof     eol     eol2    erase   erase2  intr    kill    
^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      
lnext   min     quit    reprint start   status  stop    susp    werase  
^@      0       ^@      ^@      ^@      ^@      ^@      ^@      ^@
```


Now everything works fine, even if using TX or RX.
Simon has made a change in OLA in order to have the flag set automatically:
http://code.google.com/p/open-lighting/source/detail?r=e90253fd2ac5da4a87a3674fe012df81e8a9bdc7

Now we can enjoy OLA with FreeBSD !
RenZO


----------

