Asynchronous serial input with an sbRIO FPGA

Background:
As part of my capstone project, I'm trying to read data transmitted serially from an IMU. The host is an sbRIO 9602.
As far as I'm aware, the protocol is not exactly standard: data is sent asynchronously in packets. Each packet consists of 12+ bytes in immediate sequence, each having a start and stop bit, and then the line goes idle [high] until the next packet. Each data byte is preceded by a frame bit, and only contains 7 bits of actual data, so the packet has to be further processed to get actual useful data.
I've seen the FPGA serial I/O example program floating around. The code I inherited was actually based on it, but it's overly complex for this application, and I'm not convinced it would actually work for this protocol at all. I couldn't get it to work, at any rate. I rewrote the sampling code in its entirety twice trying to get it to work, but haven't made a lot of progress. -On the bright side, the current VI is much simpler and more straight forward than my first attempt...
The problem:
I can read the first 70 or so bits of a packet fine, then the program skips a bit. That throws off the start/stop bits, and basically renders everything after meaningless. In this screenshot the data is as read in, in order from top to bottom:
I'm fairly certain this means my sampling interval isn't perfect [this suggests about 1.4% too long], but I'm totally stumped on how to avoid it. What's worse, this is actually on the lowest possible output setting from the IMU, 2400 baud. Realistically, we're hoping to have it working at either 230.4k or 460.8k baud.
The prior version of my code had the packet being read in 10-bit [1 byte] chunks, processing, then reading the next chunk. I encountered exactly the same error. I assumed that having too much code in the sampling process was causing the timing to be thrown off, so I changed it to read off the entire packet into a bit array and then process it afterward [while no data is coming in]. I've attached this version of the code for reference. It's cleaner, but no change as far as the error is concerned.
Am I correct in my evaluation, or is there something else going on? More to the point, is there a way of fixing or working around the problem so that I can get reliable samples [even at 100-200x the bit rate]?
As an aside, I've only been working with LabVIEW for a couple weeks; please tell me if I'm using poor habits or doing anything incorrectly.
Any help will be immensely appreciated. Thank you.
Attachments:
IMU_serial_in.vi ‏61 KB

Hi Ryan,
I have a suggested methodology, but I don't currently have any example code to share that would get you started.
The challenge you have is even if you sample at the exact right baud rate of your incoming signal, the phase of the FPGA clock will not be exactly the same as the source signal.  Now complicate that with your sample frequency and baud rate will always be slightly different, and you will get the sampling drift effect you described where data eventually is clocked in wrong.  On short transmissions, this may not be a problem because the sampling can be re-aligned with a start bit, but for long, continuous streaming, it eventually fails as the sampling and source signals drift out of phase.
I would suggest over-sampling the DIO line, using a debounce filter if necessary, and use a measured time between edge detections to constantly adjust your sampling period and phase to keep your sampling aligned with the incoming data.
The proposed LabVIEW code I imagine would be a single-cycle timed loop based state-machine.  Essentially the state machine could detect edges that occur near the baud rate you expect to receive, and then would adjust the sampling period to ensure you are sampling the data inbetween transitions while the incoming waveform is stable.
With this method running at 40MHz, you would essentially have ~43 clock ticks/samples of each clock cycle at 921.6kbps, and you should be able to pull out the right samples at the right time in the waveform.
Hope this helps, and if I find a good example of this, I'll send it your way.
Cheers,
Spex
National Instruments
To the pessimist, the glass is half empty; to the optimist, the glass is half full; to the engineer, the glass is twice as big as it needs to be...

Similar Messages

  • Asynchronous serial com with DAQ6034E

    Hello,
    I am a new CVI programmer, and i would like to submit a problem.
    I use a DAQ6034E card with LabWindows/CVI. I would like to communicate with devices via an asynchronous serial bus. Is it possible to do such a thing with a digital I/O, and how can I do (especially for reception) ?
    Thank's for your help !
    Franck...

    Frank,
    You could use the DIO lines on the 6034E. But keep in mind the limitations of the DIO lines on this card. These DIO lines are programmed IO only. That means, that data transfers (in or out) can only be done via software timing. You cannot do any hardware timing on the DIO lines for this card. If you need hardware timing on this operation, you will need to use a DIO card.
    But, if you can work with only software timing, you have the advatage in this card of being able to configure line direction on a line by line basis, which I think can be very beneficial in serial communication.
    Nick W.

  • Loss serial input with re install of Labview

    I have an existing VI that is trying to connect through Com 1 to an Emveco testing machine. The hard drive crashed and I am trying to re install LabView on a new hard drive. When I run the VI in the new installation, it does not seem to communicate to the testing machine. I have opened hyperterminal and can see the data coming in the serial port. I am not sure if I loaded the correct driver for serial communications and also I not not sure how to check to see if the serial comm. settings are right in LabView

    Hello -
    It appears that your hardware is working, as verified by hyperterminal. Therefore, the problem most likely is with the software.
    Are you receiving any error messages? Or does the serial port just appear to not communicate when the VI is run?
    What version of LabView are you using? Did you install the same version on the new hard drive?
    Does your program use VISA? You may not have VISA installed on the new machine and this may be causing the problem. You can verify that VISA is installed by opening Measurement and Automation Explorer and expanding the software list in the left column by clicking on the "+".
    Have you tried to verify serial communication in LabView by running one of
    the example VIs? Try to run the LabVIEW <-> Serial.vi found in the Example Finder >> Hardware Input and Output >> Serial folder.
    Additional Resources:
    The current serial driver for your Operating System is located here.
    This KnowledgeBase discusses some common problems with serial communication and possible solutions.
    Let me know if any of these suggestions solve your problem. If not, please provide more information and I will continue to research the issue. Have a great day!
    Becky B.
    Applications Engineer
    National Instruments
    Becky Linton
    National Instruments
    Field Engineer
    Office: 734-464-2463
    Cell: 248-709-2822
    Email: [email protected]

  • Access to serial and ethernet port in FPGA for cRIO-9068

    hi
    i want to know if i can Access to serial and ethernet port in FPGA for cRIO-9068 like camera IP
    thanks for help

    dalyto wrote:
    thanks
    but how i can i acquire image with IP camera and fpga ???
    The Ethernet hardware interface in the cRIO is not directly connected to the FPGA backplane in a way that you could directly access it. Even if you could it would be a pretty bad idea to try to do. A fully operational TCP/IP network stack implementation in the FPGA would not leave much resources for anything else even on the biggest FPGAs available. That doesn't include support for the typical image compression algorithmes which are even more complicated to implement on FPGA. Even if you would go to highly optimized VHDL code directly it would be a pretty difficult thing to do!
    In fact implemenintg the MAC and PHY of an ethernet interface on the FPGA is totally trivial in comparison. The IP level could also be implemented fairly easily in the FPGA but anything above that is going to give you bad headaches and still will be very limited in number of connections and packet sizes it can support.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Scanning of analog inputs in PXI 7831R FPGA

    Hi all,
    I am new to Labview FPGA Module. I am using Labview 7.1.1 and Labview FPGA Module 1.1 . I am using PXI 7831R FPGA Card.
    I developed a program which is used to scan analog Inputs with given scan rate for given scan duration. I gave input as pulse signal with 1Sec period and 2 V amplitude.
    If I scan one analog Input with 10ms scan rate for 1000ms scan duration I am getting correct values. But if I use 2 or more analong signals to scan at the same time then I am getting Multiple of periods. And also If I increase or decrease scan rate I am getting strange values. Could any body please check my code and help me.
    Thanks in Advance.
    Regards,
    Sashi
    Attachments:
    AnlogIn_FPGA.zip ‏247 KB

    customise your front panel with advanced picture creation metods
    Attachments:
    SUF.ctl ‏20 KB

  • Serial port with msp

    Hello
    I have a clock board with serial inputs. I want to send in numbers to the board with MSP to set the frequency of the msp clock. i want to make a nice interface in labview that takes number from the user and sends it to the serial input of the board. i have tried looking at the examples and when i tried it is giving me errors and i am not that familiar with lab view. the documents in the fourum were created in labview version 8 and i have version 7 so i couldn't open them, could you please help me solve my problem.
    Thanks in advance

    Hi,
    What do you mean with MSP a MSP430 from Ti ?
    Is there a application running on this board ? Did already tried something in LV ?

  • My 3rd iphone. 3GS I did not buy from an apple store, how do I register this serial number with my apple account? it is already sync to it and will preform every function except email to my home computer. It says apple ID disabled

    My 3rd iphone is a 3GS. I did not buy this one from the apple store, how do I register this serial number with my apple account? it is already sync'd and it and will preform every function except email to my home computer. It says apple ID disabled, also will not update my apps, same promt apple id disabled.
    anyone know where I can go to register this phone? Thanks

    https://register.apple.com

  • Synchroniz​ing two counter frequency inputs with multiple analog inputs

    Hello all,
    I'm fairly new to LabVIEW and I'm trying to collec​t data from multiple sources with synchronized tim​ing on the acquisition but I'm having trouble figu​ring it out. My problem is that I've got two count​er frequency inputs, one optical tachometer readin​g one pulse per revolution, and a max machinery fl​ow meter with a k factor of 12000. I can't seem to​ figure out how to sync the timing with my multiple analog inputs. I've be​en attempting to get the tachometer  to sync with ​the analog inputs first by following the example l​inked here. (https://decibel.ni.com/content/docs/DOC-10785) So far each time I run it I either get a timeout e​rror on the DAQmx read or a "Multiple sample clock​ pulses were detected" error (see attached image).  It seems if I slow the sampling rate way down to ​say 10 hz and ensure that the tachometer signal is​ over 800-1000 RPM (13-17 Hz) before starting the VI then the program will run without errors until ​the RPM drops below that threshold then the "Multi​ple sample clock pulses" error occurs.  The code is attached below.
    Does anyone know of a more effective way of syncin​g counter frequency inputs with analog inputs?  I'd like to have a VI that can show 0 RPM (and ev​entually 0 flow as well, but I think I need to fig​ure out the timing of one counter before I add ano​ther as it seems I can't have two counters in the ​same task). Any help on this would be greatly appr​eciated.
    LabVIEW version 13.0
    cDAQ-9178 Chassis with NI 9401 for the two counter inputs and NI 9205 for the analog inputs.
    Thanks!
    Richard
    Solved!
    Go to Solution.
    Attachments:
    SimpleDAQ.vi ‏44 KB
    LV_Error.JPG ‏31 KB

    Maybe third times the charm? 
    So I've finally got a good handle on why the VI is having problems at low RPM though I'm somewhat embarassed how long it took me to do that
    Because I have the counter time synced to my Analog input task if it doesn't see at least two pulses between the two clock pulses set by the analog input task I get the -201314 "Multiple sample clock pulses" error. This seems fine at first as it just sets a minimum RPM that I can measure and it's well below the area I'm interested in so no problems there.  I tried a simple error handler that would clear the error when it happend assuming the loop would keep iterating until the RPM went above that minimum at which point I would get a signal again. This is not the case, the read function just continues to spit out the -201314 error even after the RPM is back in the readable range. So then I tried adding two case structures so that when the error occured it would stop the task, clear the error, and then start the task again on the next loop iteration (Code Attached). This also doesn't work as the error shows up again on the stop task and then AGAIN on the start task on the next loop iteration. It seems this error is not actually being cleared and once it happens it stays with the task regardless of what the error cluster is carrying. 
    Anyone have any ideas?  The only solution I can think of is to just clear all tasks and recreate them each loop iteration until the RPM is readable again but that strikes me as a horribly clunky solution.
    Richard 
    Attachments:
    SimpleDAQ_1_Start Stop.vi ‏48 KB

  • I have bought Adobe Photoshop Elements 13 and I try to get my serial number with my activation ID but I get a message that my ID is not good. What can I do?

    Where can I get a serial number with my activation ID if it dosen't work on the ADOBE site?

    Well, for your ID just use the ID and password you're using here. If you meant your redemption code rather than your ID, try this:
    Redemption Code Help

  • Batch input with objects

    Hi,
    Exists a standard class to develop a batch input????
    Any ideas???
    Is it possible to create a batch input with objects??

    Hi there
    Why not
    just define your class in the normal way
    decide what variables you need to pass
    in the methods of your class call the fm modules bdc open, bdc dynpro etc etc.
    Incidently the following include will have a decent amount of code for the BDC bits.
    include bdcrecx1.
    A good way is to start sm35 to record what you are doing on the screen. When you've finished  go to your recording in SM35 and click on CREATE PROGRAM - it will create most of the code for you including the screen fields -- you'll need to edit a bit of course as you don't need everything that will be shown.
    Debugging in the CREATE PROGRAM might show you a decent generic way of generating BDC's which you could easily do via a class.
    Note however using BDC's is the LEAST PREFRERRED WAY of performing work and should only be used as a LAST RESORT if there really is no other way. A lot of new BAPI's and Classes are now available which can do away with the need for BDC's  in most cases.
    job done.
    cheers
    jimbo

  • Need formula to take text from one cell, add that to a serial number with leading zeros

    I'm trying to create a spreasdheet cell that simplifies creating videotape Numbers from a job name in cell and appends a serial number with leading zeros, and that would survive an export to EXCEL.
    The result would look like
     A Column
    Job Name
    B ColumnTape #
    Formula needed for B
    ClientName-TapeType-
    ClientName-TapeType-001
    =
    ClientName-TapeType-
    ClientName-TapeType-002
    =
    I've tried using a custom cell format that had the text in front of the (Integer) drag and drop, with three integers and leading zeros.
    That worked, but requires recreating the custom cell format for each client and tape type.
    So, I've used the formula =A2& in order to play around with different things, but haven't hit on something that adjusts for increased numbers and retains the leading zeros.
    I don't mind doing a starter for the first row and then adding +1 in the formulas for the rows below.
    I've done that using the custom cell formats for the first B cell and then using =Bx+1 in the following cells.  It works, but I'm hoping to find something simpler or that can be copied and pasted in multiple rows on one paste.
    Thanks in advance.
    Suggestions much appreciated!
    Ted

    Ted,
    This expression in B will give you the pattern I believe you are looking for:
    =A&RIGHT("00"&ROW()-1, 3)
    Here's a screen shot...
    Jerry

  • Hi,  I lost my serial number for PS Elements11 following computer crash. Os is W7. I have the cd installation disc but there is no serial number with it or in the envelope  ..  How can I obtain the serial number please?     Thanks

    I lost my seriel number for PS Elements 11 following computer crash. Os is W7
    Peter Jones Aug 27, 2014 5:36 AM   
    Hi,
    I lost my serial number for PS Elements 11 following computer crash. Os is W7. I have the cd installation disc but there is no serial number with it or in the envelope
    How can I obtain the serial number please?
    Thanks

    If you registered the software you should be able to find the serial number thru your Adobe account online.
    To locate the serial number:
    http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • I'm trying to associate my iphone serial num with my apple profile, but the system say that the number is not good !

    I'm trying to associate my iphone serial num with my apple profile, but the system say that the number is not good !

    it is correct in this link;
    but in the https://supportprofile.apple.com/PramAddRegisterProduct.do
    the message indicate the (same) number is not valide

  • Simulate camera input with Java Media Framework

    I'd like to ask, if there is a way to simulate camera input with JMF?
    I'd like to write a program that registers (somehow) in Windows a new camera device, and I can create a video stream in Java that supplies data of what is "visible" through that "software camera".
    Is it even possible with pure Java (with JMF)?

    Bump!
    The question is sill open and Dukes are waiting.

  • How to keep the field open for input with error message in report program

    Hi,
      Need a help in solving the below issue.
    "How to keep the field open for input with error message in report program"
    Regards,
    C.Shasiraj.

    Hi...
    you have to use the event:
    <b>AT SELECTION-SCREEN ON <FIELD> EVENT.</b>
    u have to give an error message in this event.
    Consider the following <b>Example:</b>
    <b>PARAMETERS : NUMBER TYPE I.
    AT SELECTION-SCREEN ON NUMBER.
      IF NUMBER = 10.
        MESSAGE 'Number vakue is 10' TYPE 'E'.
      ENDIF.
    START-OF-SELECTION.
      WRITE NUMBER.
    </b>
    in this if u give the value of number = 10, it will not proceed further, if u give some other value other than 10 you will proceed further...
    Execute this program once u will understand....
    also Consider the following links :
    <b>Regarding events:</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a237d9b511d1950e0000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a23ad9b511d1950e0000e8353423/frameset.htm
    <b>Regarding messages:</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
    This is very useful.......
    Reward points if useful....
    Suresh....

Maybe you are looking for

  • Time Machine not showing backups

    Time Machine stopped backing up earlier this month and I have done numerous things to get backups again. Yesterday after upgrading memory on my iMac, not as a fix for Time Machine, I restarted Time Machine and it appeared to be backing up just fine.

  • Question On 16x9 Aspect Ratio

    I set Easy Setup to DV-NTSC Anamorphic and captured my 10 hours of underwater video from Mini-DV that was shot in 16x9 (not HD). I then created my video, including stills, title text etc. When I watch my project, my titles and still pictures take up

  • Copy back of Prodution Error on Org Structure

    Please can any of you guru's out there help. We have just done a copyback from production to SR2 (QA system) and there is an error with the org structure. We use extended Classic Scenrio and we replicate the org structure from ECQ to SRQ. (integrated

  • Can't get simple Automator actions (services) to work

    I've been trying to get very simple Automator services to work in 10.6.2 but I can't. Here's an example. I launch Automator, and hit Services, then choose: Service receives selected: audio files in: any application. Then add an action: Set Info of iT

  • Where can i find the JRE Forms is using

    Hi, Where can i find the JRE my Forms 10.1.2.3 is using ?? is this defined in a configuration file?? and how can i change it ?? :) The problem is that when trying to import a java class which one has been made with JDK 1.6 is throwing a "Unsupported