Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9161847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:04:05+00:00 2026-06-17T14:04:05+00:00

I’m trying to communicate with the Enttec USB DMX Pro. Mainly receiving DMX. They

  • 0

I’m trying to communicate with the Enttec USB DMX Pro. Mainly receiving DMX.

They released a Visual C++ version here, but I’m a little stumped on what to do to convert to Obj-c. Enttec writes, “Talk to the PRO using FTDI library for Mac, and refer to D2XX programming guide to open and talk to the device.” Any example apps for Objective-C out there? Is there an easy way to communicate with the Enttec DMX USB Pro?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:04:06+00:00Added an answer on June 17, 2026 at 2:04 pm

    I’ve done a significant amount of work with the FTDI chips on the Mac, so I can provide a little insight here. I’ve used the single-channel and dual-channel variants of their USB-serial converters, and they all behave the same way.

    FTDI has both their Virtual COM Port drivers, which create a serial COM port on your system representing the serial connection attached to their chip, and their D2XX direct communication libraries. You’re going to want to work with the latter, which can be downloaded from their site for various platforms.

    The D2XX libraries for the Mac come in a standalone .dylib (the latest being libftd2xx.1.2.2.dylib) or a new static library they started shipping recently. Included in that package will be the appropriate header files you need (ftd2xx.h and WinTypes.h) as well.

    In your Xcode project, add the .dylib as a framework to be linked in, and add the ftd2xx.h, WinTypes.h, and ftd2xx.cfg files to your project. In your Copy Bundled Frameworks build phase, make sure that libftd2xx.1.2.2.dylib and ftd2xx.cfg are present in that phase. You may also need to adjust the relative path that this library expects, in order for it to function within your app bundle, so you may need to run the following command against it at the command line:

    install_name_tool -id @executable_path/../Frameworks/libftd2xx.1.2.2.dylib libftd2xx.1.2.2.dylib
    

    Once your project is all properly configured, you’ll want to import the FTDI headers:

    #import "ftd2xx.h"
    

    and start to connect to your serial devices. The example you link to in your question has a downloadable C++ sample that shows how they communicate to their device. You can bring across almost all of the C code used there and place it within your Objective-C application. They just look to be using the standard FTDI D2XX commands, which are described in detail within the downloadable D2XX Programmer’s Guide.

    This is some code that I’ve lifted from one of my applications, used to connect to one of these devices:

        DWORD numDevs = 0;
        // Grab the number of attached devices
        ftdiPortStatus = FT_ListDevices(&numDevs, NULL, FT_LIST_NUMBER_ONLY);
        if (ftdiPortStatus != FT_OK)
        {
            NSLog(@"Electronics error: Unable to list devices");
            return;
        }
    
        // Find the device number of the electronics
        for (int currentDevice = 0; currentDevice < numDevs; currentDevice++)
        {
            char Buffer[64];
            ftdiPortStatus = FT_ListDevices((PVOID)currentDevice,Buffer,FT_LIST_BY_INDEX|FT_OPEN_BY_DESCRIPTION); 
            NSString *portDescription = [NSString stringWithCString:Buffer encoding:NSASCIIStringEncoding];
            if ( ([portDescription isEqualToString:@"FT232R USB UART"]) && (usbRelayPointer != NULL))
            {           
                // Open the communication with the USB device
                ftdiPortStatus = FT_OpenEx("FT232R USB UART",FT_OPEN_BY_DESCRIPTION,usbRelayPointer);
                if (ftdiPortStatus != FT_OK)
                {
                    NSLog(@"Electronics error: Can't open USB relay device: %d", (int)ftdiPortStatus);
                    return;
                }
                //Turn off bit bang mode
                ftdiPortStatus = FT_SetBitMode(*usbRelayPointer, 0x00,0);
                if (ftdiPortStatus != FT_OK)
                {
                    NSLog(@"Electronics error: Can't set bit bang mode");
                    return;
                }
                // Reset the device
                ftdiPortStatus = FT_ResetDevice(*usbRelayPointer);
                // Purge transmit and receive buffers
                ftdiPortStatus = FT_Purge(*usbRelayPointer, FT_PURGE_RX | FT_PURGE_TX);
                // Set the baud rate
                ftdiPortStatus = FT_SetBaudRate(*usbRelayPointer, 9600);
                // 1 s timeouts on read / write
                ftdiPortStatus = FT_SetTimeouts(*usbRelayPointer, 1000, 1000);      
                // Set to communicate at 8N1
                ftdiPortStatus = FT_SetDataCharacteristics(*usbRelayPointer, FT_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE); // 8N1
                // Disable hardware / software flow control
                ftdiPortStatus = FT_SetFlowControl(*usbRelayPointer, FT_FLOW_NONE, 0, 0);
                // Set the latency of the receive buffer way down (2 ms) to facilitate speedy transmission
                ftdiPortStatus = FT_SetLatencyTimer(*usbRelayPointer,2); 
                if (ftdiPortStatus != FT_OK)
                {
                    NSLog(@"Electronics error: Can't set latency timer");
                    return;
                }                   
            }
        }
    

    Disconnection is fairly simple:

            ftdiPortStatus = FT_Close(*electronicsPointer);
            *electronicsPointer = 0;
            if (ftdiPortStatus != FT_OK)
            {
                return;
            }
    

    Writing to the serial device is then pretty easy:

        __block DWORD bytesWrittenOrRead;
        unsigned char * dataBuffer = (unsigned char *)[command bytes];
        //[command getBytes:dataBuffer];
        runOnMainQueueWithoutDeadlocking(^{
            ftdiPortStatus = FT_Write(electronicsCommPort, dataBuffer, (DWORD)[command length], &bytesWrittenOrRead);
        });
    
        if((bytesWrittenOrRead < [command length]) || (ftdiPortStatus != FT_OK))
        {
            NSLog(@"Bytes written: %d, should be:%d, error: %d", bytesWrittenOrRead, (unsigned int)[command length], ftdiPortStatus);
    
            return NO;
        }
    

    (command is an NSData instance, and runOnMainQueueWithoutDeadlocking() is merely a convenience function I use to guarantee execution of a block on the main queue).

    You can read raw bytes from the serial interface using something like the following:

    NSData *response = nil;
    DWORD numberOfCharactersToRead = size;
    __block DWORD bytesWrittenOrRead;
    
    __block unsigned char *serialCommunicationBuffer = malloc(numberOfCharactersToRead);        
    
    runOnMainQueueWithoutDeadlocking(^{
        ftdiPortStatus = FT_Read(electronicsCommPort, serialCommunicationBuffer, (DWORD)numberOfCharactersToRead, &bytesWrittenOrRead);
    });
    
    if ((bytesWrittenOrRead < numberOfCharactersToRead) || (ftdiPortStatus != FT_OK))
    {
        free(serialCommunicationBuffer);
        return nil;
    }
    
    response = [[NSData alloc] initWithBytes:serialCommunicationBuffer length:numberOfCharactersToRead];
    free(serialCommunicationBuffer);
    

    At the end of the above, response will be an NSData instance containing the bytes you’ve read from the port.

    Additionally, I’d suggest that you should always access the FTDI device from the main thread. Even though they say they support multithreaded access, I’ve found that any kind of non-main-thread access (even guaranteed exclusive accesses from a single thread) cause intermittent crashes on the Mac.

    Beyond the cases I’ve described above, you can consult the D2XX programming guide for the other functions FTDI provides in their C library. Again, you should just need to move over the appropriate code from the samples that have been provided to you by your device manufacturer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.