Teensy 3.1 Serial Break?

Status
Not open for further replies.

Mark

Well-known member
Still working on LIFA, but found a question of a more general nature.

When LabVIEW sends a break terminated string to the Teeny 3.1's serial port, I get an I/O error. Without the break, or on Teensy 2.0, no problem.

Thoughts? Suggestions?
 
what is a break terminated string?
There are null terminated strings as in C.
And there are strings that are objects that have no literal terminator- the length is an object property.

There are UART break signals meaning you force the UART hardware to send a very long "start" bit to tell the other uart that a "line break" occurred. This is from the TTY era is not used (much) these days.
 
Last edited:
There are UART break signals meaning you force the UART hardware to send a very long "start" bit to tell the other uart that a "line break" occurred. This is from the TTY era is not used (much) these days.

Arduino Uno and Teensy 2.0 work ok with a break sent to their 'serial port'. Teensy 3.0 doesn't appear to - at least the way LabVIEW implements it.

Is this a known Teensy 3.1 limitation?
 
It very well may be a Teensy 3.x limitation. This is the first I've heard of anyone needing this feature.

Odds are very good I can fix this issue, but only if I can reproduce it here. The trouble is I've never used Labview. I've watched other people use it a couple time, but I have zero experience with Labview.

Some time ago I saw NI has an eval version. Can I use that to recreate the problem here? If so, I'm going to need someone to give me very specific steps... pretty much every mouse click needed to recreate the problem with absolutely zero Labview experience. The instructions need to work on a clean PC with a fresh eval Labview install.

One other thing that's not perfectly clear is whether this is by the USB port with USB virtual serial (eg, "Serial") or if it's a hardware serial port (eg, "Serial1", "Serial2", or "Serial3") and what type of PC serial port of USB-Serial converter is being used. Those details, and perhaps any other details, like the version of Windows and other software setup, can be important for recreating the problem.

If I can make the problem happen here, and observe something on the PC running Labview to know if it worked or not, then I can investigate and probably come up with a fix. That's the easy part. Recreating the problem is the tough part.
 
Some time ago I saw NI has an eval version. Can I use that to recreate the problem here? If so, I'm going to need someone to give me very specific steps... pretty much every mouse click needed to recreate the problem with absolutely zero Labview experience. The instructions need to work on a clean PC with a fresh eval Labview install.
you can download 30 day eval here for windows (1.38 GB)
 
Thanks for the link.

Now all I need is very detailed step-by-step instructions for recreating the problem without any Labview experience. Without that, I'm afraid the 30 day eval will be only a waste of bandwidth & disk space.

Answers to those questions about the system and hardware setup would be nice too....

I really do want to get to the bottom of this and fix or add whatever's needed in the software, but to do so I really need some hand-holding on how to run Labview and reproduce the problem here.
 
The install should be straight forward, it should guide you through the setup process and install all the drivers you would need to work with USB Serial or Hardware Serial. I use the Mac version found here, but once you have it installed on either a mac or windows the Serial examples are the same.

Some labview terminology for you:

1. Programs are called VI's

2. "Front Panel" is where you interact with the program:
Screen Shot 2014-03-18 at 8.02.39 PM.png

3. "Block Diagram" is where you do the programing
Screen Shot 2014-03-18 at 7.02.08 PM.png

4. Once installed there are examples for basic Serial communications and setting Serial Breaks, if you select "Help" drop down, then "Find Examples..." this should show up:
Screen Shot 2014-03-18 at 7.11.56 PM.pngThen search for serial. These screen shots are my Mac but should be the same for windows.

5. To run the VI, select the right COM port and just click the Run button, I outlined them in red:
2.png

As far as the Serial Break, I haven't used that feature in Labview so Mark would have to upload the vi and any arduino libraries & sketches that has the problem. I can help on this also in a "Mac" environment once he uploads his VI and points us to the Library and sketches.

I can say that just using the USB Serial with the basic labview examples works fine.
 
Last edited:
Paul, thanks up front!

I can send you the vi, which works for an Uno & 2.0, but breaks for a 3.1. Same for the simple firmware, which works for all. Let me know if you want me to post them here, PM you, or send via email.

If you'd prefer, I can create a 'LabVIEW binary' to send you which won't require a LabVIEW install, but might require a runtime engine. I haven't done this yet, but no time like now to try it! Downside <?> is you won't be able to play with the LabVIEW code.

The test case is very simple.

COM write-break-read-vi.PNG

EcoString.ino - as posted on the ni.com LIFA forum.
Code:
const int led = LED_BUILTIN;

void setup (){
  Serial.begin(9600);
  Serial.flush();
  pinMode(led, OUTPUT);
  digitalWrite (led, HIGH);      //turn on debugging LED
}

void loop (){

  int i=0;
  char commandbuffer[100];

  if(Serial.available()){
     delay(100);
     while( Serial.available() && i< 99) {
        commandbuffer[i++] = Serial.read();
     }
     commandbuffer[i++]='\0';
  }

  if(i>0)
     Serial.println((char*)commandbuffer);

}
 
Last edited:
The LIFA LabVIEW libraries use a Serial Break during the initialization. Why? Dunno. That's just where I found it breaks.

On some test equipment, I believe it's the equivalent of 'Attention!', but I don't know that. I've always been more of a GPIB guy rather than RS232 serial. Why it's used in this case, see above.
 
The Serial Break is actually a VISA function (vi) used in LIFA. I dug down into that and found where it broke. To simplify it, I wrote a sample vi to test it.

Playing with VISA.PNG

Digging down into the VISA Break vi gives a slightly more complex version of the "COM read-write.vi". Same error at the same place of both vi's. Mostly my simplified version doesn't have an adjustable break time (250msec by default). I didn't see changing the time make any difference during my tests.

Easiest way to get the latest LIFA is to load the VI Package Manager and get it thru there. VIPM info:
https://decibel.ni.com/content/docs/DOC-22337 // at ni.com
http://jki.net/vipm // home web site

System requirements:
http://jkisoft.com/vipm/docs/2013/index.html?turl=systemrequirements.htm

I did have to massage the old LIFA firmware here on PJRC a bit from 2.0 to 3.1 to get a compile. The VISA serial break error is where I'm stuck now. I think I posted those mods in another thread. <off to look now>

Here 'tis. AFmotor changed to recognize the 3.x makefile:
http://forum.pjrc.com/threads/25066...EW-amp-teensyduino-amp-LIFA?highlight=labview
 
Last edited:
Paul, thanks up front!

If you'd prefer, I can create a 'LabVIEW binary' to send you which won't require a LabVIEW install, but might require a runtime engine. I haven't done this yet, but no time like now to try it! Downside <?> is you won't be able to play with the LabVIEW code.

Hi Mark,
I think this could be a good idea indeed, to avoid Paul the pain of installing all the LV stuff, that are a bit "invasive" in the PC, and maybe overkill for just a simple test...
I can help in the process of creating such .exe : for once it's something I'am familiar with :) feel free to ask if you need. (and FYI, you need a " LV application builder licence" to do so...)

BTW, if you go this way, I would recommend to create an installer instead of just the executable you mentionned : it's just as simple to create, and it could package together the LV runtime engine as well as the visa runtime, that will also be required for this applications.

Even more straightforward for Paul, the install and test process will only need a few clics...

Again, I can create this installer if you like (or if you don't have the licence), just send me the .vi

regards

antoine
 
Last edited:
couple of questions?

Are you using the Teensy USB Serial?

What is giving you the "i/o" error, labview?

does the teensy lock up?

Yes, yes and no. I can turn the break off, and the echostring.ino returns the written string just fine.
 
LV invasive? It's amazing how bloat-y it feels that way, isn't it?

I'd forgotten about the installer option. I just upgraded to Developer so it's supposed to be in there. I gotta learn it sometime.

Paul, after I've done that I'll PM you the size and you can tell me how you want to get the files.
 
I reimaged my test machine with a fresh & clean copy of Windows 7, then downloaded Labview's installer, which downloaded 1.3 GB of data, then unextracted itself, and then wanted to install .net 4.0, which needs a reboot, and now Windows 7 is installing 25 updates (this clean install image is from a couple months ago).

If there's any files I need, please post there here in zip files (click "Go Advanced" and then you can attach files to your message). If they're too big for the forum's limits, I guess a service like Dropbox needs to be used.

I'm going to give this a try, probably only once, so if there's anything else I need, please post it now.

Edit: after *many* things installed and several reboots, looks I might finally be ready to give this a try. Also, it looks like the eval period is only 7 days, not 30 as mentioned on the website.
 
Last edited:
@Mark - if you have some files you want me to use, or any other info to help me recreate the same problem you've seen, NOW is the time to post. (actually, in a matter of hours or minutes, it'll be too late)

I'm going to try, but only today, using whatever info is on this thread.
 
@Paul: Wow! Too much work! To think I was appalled at the 217MB installer I generated. It didn't work first try, natch.

You'll of course need the Teensy drivers installed, and load the EcoString.ino onto the Teensys (Teensies?) or Arduino. I think <uh oh> that's all you'd need. Let me try it on my end first before I waste ?more? of your time.

@mknix: I'm enclosing the vi (17kB) here since it's small. Is that all Paul would need other than LabVIEW and NI VISA? We have a server I use to share the code where I need it, so going to a totally new computer is new to me.

I've got a test machine here I'm trying the installer on. I'm thinking I should have a working one ready today. I'll pop it onto Dropbox if that's where you'd like it. I'm going to generate the installer, even if it's just for my own gain in experience with it.
 

Attachments

  • COM Write-Read Test.zip
    12.9 KB · Views: 167
Ok, I got Labview installed and loaded your vi. I clicked "Run Continuously". I typed COM3, but I can't seem to get it to do anything.

Here's what I've got on my screen?

sc1.png

Am I missing "NI VISA"? Or did I do something wrong?

Edit: I found this page about NI-VISA. I'm downloading it now. Was I supposed to also install this? Remember, I have never used Labview before (and I rarely use Windows either)
 
Last edited:
Ok, I got Labview installed and loaded your vi. I clicked "Run Continuously". I typed COM3, but I can't seem to get it to do anything.
Am I missing "NI VISA"? Or did I do something wrong?

select "visa resource name" and click the com port the teensy's on.
Screen Shot 2014-03-20 at 4.24.52 PM.png mine is mac so "COM?" is different.

Click the "Break Enable" button. It should turn green like the pic below.
Screen Shot 2014-03-20 at 4.27.29 PM.png

then type something into "write buffer" and hit Run or Run Continuously, you should see what you typed in the "read buffer". I don't see any errors on my machine.
Screen Shot 2014-03-20 at 4.28.43 PM.png
 
@duff: Interesting. I guess that's not the first time Mac and PC don't act the same :)

@Paul: If it's not giving you an error, the demo install probably already installed NI-VISA by default. To check go to Control Panel, Programs and Features. Select "National Instruments Software" and click "uninstall / change" (win7). You should see NI-VISA in the listing if it's installed.

NI_VISA.PNG

When mine runs, it looks like this with break on:

COM write-break-read-vi _running.PNG

Break off:

COM write-break_off-read-vi _running.PNG

I'd like to see what mknix gets...
 
Mark, where is the error hitting on, turn on "Highlight Execution" or put some probes on the error line.
 
Status
Not open for further replies.
Back
Top