Does TyCommander handle FTDI? Or am I doing something wrong?

Sorry, not sure if this would help or not... But maybe a faster USB To Serial adapter?

If I am looking right, the FTDI document Appendix A for your cable I see:
View attachment 37885


You might try to find something that uses a Higher speed USB, like FT232H like:

View attachment 37886
Example: https://www.adafruit.com/product/2264

Not sure how well it works as I don't have any, but...
I'll check on a scope again, the actual bit rate achieved, maybe I'm mistaken. I know I got garbled output, but that may have been on minicom, which doesn't do auto negotiations. Was flailing a lot today, getting frustrated with a lack of progress. If it really is auto negotiating, it would be worth looking at a faster interface.

Thanks for a ray of hope.
 
but that may have been on minicom, which doesn't do auto negotiations
Sorry, I could be wrong, but my guess is that there are very few devices/setups that auto-negotiate...

For example, Take the UNO R4 The Wifi uses an ESP32 to handle it's USB (by default), If you don't setup the Arduino IDE with the correct
Baud rate, which then the ESP32, sets it's UART that talks tot he RA4M1 processor, you get garbage, versus the UNO R4 MINI which uses
USB Directly, the Baud rate you set in The Serial Monitor is mostly meaningless...

Now Potentially The app on the PC could send out a USB packet ( CDC_GET_LINE_CODING), which the FTDI respond to...

But not sure how the FTDI's baud rate would be updated to anything other than what the host specified. Although maybe it has
some other mechanism, like XBees did where there was some way to enter into a command mode and then tell it to change baud...
Don't remember any, but it has been a long time since

As for using TyTerminal, for this, I do for some things, but other times I use other apps, like PuTTy or Kitty on my PC, as they have some
rudimentary terminal emulation. And for example when I am working with Zephyr, I use one of these for the Kernel monitor as they
send out a lot of terminal stuff, and instead of seeing something like this on TyTerminal:
1752720952364.png

You see something like:

Code:
SDRAM test...
DMA Channel allocated 1
Buffer: 0 ADDR:0xc0000080 size:153600
Buffer: 1 ADDR:0xc00258a0 size:153600
Buffer: 2 ADDR:0xc004b0c0 size:153600
loop: 0(0)  DMA:  (65504 0 aa) (65505 0 aa) (65506 0 aa) (65507 0 aa) 88096
loop: 1(1)  DMA:  (65504 1 aa) (65505 1 aa) (65506 1 aa) (65507 1 aa) 88096
loop: 2(2)  DMA:  (65504 2 aa) (65505 2 aa) (65506 2 aa) (65507 2 aa) 88096
loop: 3(3)  DMA:  (65504 3 aa) (65505 3 aa) (65506 3 aa) (65507 3 aa) 88096
loop: 4(4)  DMA:  (65504 4 aa) (65505 4 aa) (65506 4 aa) (65507 4 aa) 88096
loop: 5(5)  DMA:  (65504 5 aa) (65505 5 aa) (65506 5 aa) (65507 5 aa) 88096
loop: 6(6)  DMA:  (65504 6 aa) (65505 6 aa) (65506 6 aa) (65507 6 aa) 88096
loop: 7(7)  DMA:  (65504 7 aa) (65505 7 aa) (65506 7 aa) (65507 7 aa) 88096
loop: 8(8)  DMA:  (65504 8 aa) (65505 8 aa) (65506 8 aa) (65507 8 aa) 88096
loop: 9(9)  DMA:  (65504 9 aa) (65505 9 aa) (65506 9 aa) (65507 9 aa) 88096
loop: 10(a)  DMA:  (65504 a aa) (65505 a aa) (65506 a aa) (65507 a aa) 88096
loop: 11(b)  DMA:  (65504 b aa) (65505 b aa) (65506 b aa) (65507 b aa) 88096
loop: 12(c)  DMA:  (65504 c aa) (65505 c aa) (65506 c aa) (65507 c aa) 88096
loop: 13(d)  DMA:  (65504 d aa) (65505 d aa) (65506 d aa) (65507 d aa) 88096

On my Ubuntu machine, I mostly now use Tabby.
 
It seems the host is controlled by TyTerminal, which is limited by the table in rygel/tytools/libhs/serial.h.
Obviously the Teensy can run serial at 3Mbaud, and I confirmed it on the scope, I get 1/dx = 2.91MHz, give or take. But TyTerminal can't connect.

So I should abandon TyTerminal for this application and use something else. What the something else is, I don't know yet, because I haven't found anything that doesn't stink yet for a Mac. Screen doesn't work at these rates. Minicom does, but it's a bear to wrestle with.

It seems homebrew has Tabby, I'll see if that's works out for me. Thanks for the tip.
Code:
$ brew install --cask tabby
ought to do it.

Fiddled with tabby. It only goes to 1.5Mbaud, but that's better than 230400. Weird.

It's identifying the device as /dev/tty.usbserial-FTxxxx, but on a mac it's known as /dev/cu.usbserial-FTxxxx. When I click on it I get X Error: Resource busy, cannot open /dev/tty.usbserial-FTxxxx.

edit: turns out it is known as both. And even thought TyTerminal can't connect to the device at 1.5Mbaud, it holds it hostage, preventing tabby from connecting. So I have to kill TyTerminal, which stinks as I have a separate serial console for simple commands. Groan, there's a solution, but why oh why does it have to be so messy...
 
Last edited:
Tabby will also connect to the usb serial, but it is limited to 1.5Mbaud there as well. So I could program using TyCommander, then kill it, and connect with tabby. What an ugly set up. This is getting me so far from what I need to do, which is to find the darned bug...

So far the best option I've experienced is minicom, which is an abomination, but seems to allow full bandwidth on FTDI, even with TyTerminal running. Now that I say that, maybe I ought to retest that bold assertion. It's easy to make mistakes, when you are flailing...
 
Does TyComm 'Serial Off' release the device? It does on Windows to allow IDE access.

Click the connect icon

Do you have a second Teensy for the USB<>UART ECHO?
 
Does TyComm 'Serial Off' release the device? It does on Windows to allow IDE access.

Click the connect icon

Do you have a second Teensy for the USB<>UART ECHO?
Yes, that seems to work, I discovered that this morning. I can use Tabby up to 1.5Mbaud that way.

Found a way to set up minicom at 3Mbaud to save to file. I'm going to try that. Hopefully it uses the default settings of 3000000 8N1.
Code:
$ minicom -C myfile.log
I still need to remember to disconnect, so that the file is closed... Juggling all this, while operating a lathe, it's going to take some doing, it's hard to program us humans! Especially while trying to keep all our fingers and toes.

Have a second Teensy, sort of. It's built up into a second electronic lead screw controller though. Hmm, wait a minute, I have a spare third one. It's plugged into a breakout board. Have any idea where I can get the 2mm header that's used for Ethernet? I don't know where that little header is hiding... But yes, USB<>UART echo is a possibility now.
 
But yes, USB<>UART echo is a possibility now.
That would be the Easy solution to have both on TyCommander. One Tabbed or two TyComm Windows would give full access to both with two USB cables and the Two Teensys sharing UART.

This also allows programming BOTH easily - well Easy with a change to the IDE adding a local.INI file to say use TyComm - but that is another post. (search 'delegate' ?)

Ideally the ECHO edited code posted back works as hacked here on the web - if not edit it - or start from the TeensyDuino Example. Once running it will not need attention.

On Windows here but never found any program that works as well as TyComm to connect and display - let alone the custom interface.

I suppose you've seen that TyComm saves to a file as well if that helps it can be located in the Temp folder under the one tab. File size can be controlled and it rolls from one file to another as they fill up for each device.
 
Is there some reason you're avoiding logging to SD? It's got plenty of bandwidth.
Yes. Primarily because I cannot access the SD easily. This is inside of a box enclosure, with connectors and stuff, sitting on top of a lathe, which occasionally throws metal chips around. The chips can be long and stringy, or they can be tiny comma like pieces, but they can fly far, and end up in lots of places. Not a friendly environment for open Teensy boards!

Because I'd like to know for the future, what's the maximum sustained write rate for the SD card. Some day, I may need that capability. Are we talking about MBytes/sec? Or Mbits/sec?
 
That would be the Easy solution to have both on TyCommander. One Tabbed or two TyComm Windows would give full access to both with two USB cables and the Two Teensys sharing UART.

This also allows programming BOTH easily - well Easy with a change to the IDE adding a local.INI file to say use TyComm - but that is another post. (search 'delegate' ?)

Ideally the ECHO edited code posted back works as hacked here on the web - if not edit it - or start from the TeensyDuino Example. Once running it will not need attention.

On Windows here but never found any program that works as well as TyComm to connect and display - let alone the custom interface.

I suppose you've seen that TyComm saves to a file as well if that helps it can be located in the Temp folder under the one tab. File size can be controlled and it rolls from one file to another as they fill up for each device.
Far easier than figuring out Ethernet on Teensy (not that it's terribly hard) and writing a custom program on my mac to read and save the stream... I'm really trying to stay on task, which is bug hunting, and finding out why there's synchronization loss. Profiling the code wouldn't hurt either.

I will need to modify my ELS enclosure to route out wires, and have to create a new case for the second Teensy to protect it from conductive debris. Neither are too difficult.

I do agree that doing two Teensy's would make life easier... And TyComm logs to file nicely, used that already, when I was logging USB serial, and USB serial1. Pity that USBserial is a bit too free and easy with global ISR blanking... Mucking with USB is far beyond my pay grade.

I've already done the changes for delegate, thanks to instructions on this forum.

Can TyComm handle binary data? It won't be able to display the binary, but will it properly save the data, so it can be parsed with a different tool? Binary data is like doubling the data rate, at least compared to ascii.
 
Yes. Primarily because I cannot access the SD easily. This is inside of a box enclosure, with connectors and stuff, sitting on top of a lathe, which occasionally throws metal chips around. The chips can be long and stringy, or they can be tiny comma like pieces, but they can fly far, and end up in lots of places. Not a friendly environment for open Teensy boards!

Because I'd like to know for the future, what's the maximum sustained write rate for the SD card. Some day, I may need that capability. Are we talking about MBytes/sec? Or Mbits/sec?

You can transfer files from the SD over the USB connection to your host, at least on Windows, using MTP, so you don't need physical access to the SD card. The SD data rate can be as high as 20 MB/sec, but the higher the data rate, the more of your CPU will be used. It sounds like your data rate is not very high. If you can limit it to 1 MB/sec, you can do that with only about 1% of the CPU. That requires 2048 x 512-byte writes every second, or one write approximately every 0.5 ms. Each write takes about 5 us, but interrupts remain enabled during that time.
 
You can transfer files from the SD over the USB connection to your host, at least on Windows, using MTP, so you don't need physical access to the SD card. The SD data rate can be as high as 20 MB/sec, but the higher the data rate, the more of your CPU will be used. It sounds like your data rate is not very high. If you can limit it to 1 MB/sec, you can do that with only about 1% of the CPU. That requires 2048 x 512-byte writes every second, or one write approximately every 0.5 ms. Each write takes about 5 us, but interrupts remain enabled during that time.
Since I'm fishing for errors and clues, I can send far more data than the links can take. There's no trouble saturating the link if I want. Since there's no ICE for this board, I'm left with print statements, trying to figure out what, if anything, is wrong.

Behaviorally, there's a problem, a physical cut thread doesn't start in the same place, every time and it should. That's the whole raison d'etre for the work. Perhaps there's an algorithm error, or an implementation error, or who knows what else. Likely a combination of things. The basic ELS works fine, I have 3 years of experience with that, (it works very well) but this feature of synchronization, it's eluding me to date. I know it can be done, because other CNC systems do it and have done it.

So unfortunately, I'm scatter gunning it to find clues. That means filling the comm link, and post processing the data stream looking for unexpected events or values. Then I can zoom in on that problem area and see what is happening in more detail. There's over 3000 LOC in 9 files, over 6 ISRs, so the errors are not easy to find.
==================================================================================
Are you saying you can access the Teensy SD card via the Teensy USB cable? Without writing code to do so?
 
If you can add MTP to your build, YES. The Teensy SD card will appear in a connected device Explorer window for file transfer.

Given there was a wired FTDI device I was picturing the Teensy taking its 'safe space' without knowing the environment - metal chips bad.

TyComm Delegate is Cool - that and the baud selection were added by @Koromix when I found the need for them. It can take total upload control - until Paul sent Beta LOCKED Teensy units years back.

It seems like TyComm will NOT do binary - as any odd ascii character it gets now is ignored or misinterpreted. Even a cut and past when a NULL is printed breaks the output.
 
If you can add MTP to your build, YES. The Teensy SD card will appear in a connected device Explorer window for file transfer.

Given there was a wired FTDI device I was picturing the Teensy taking its 'safe space' without knowing the environment - metal chips bad.

TyComm Delegate is Cool - that and the baud selection were added by @Koromix when I found the need for them. It can take total upload control - until Paul sent Beta LOCKED Teensy units years back.

It seems like TyComm will NOT do binary - as any odd ascii character it gets now is ignored or misinterpreted. Even a cut and past when a NULL is printed breaks the output.
How does one add MTP to a build? Serial & MTP disk? Not clear that my Mac can do MTP without some help...

Yeah, I needed to tell people about where the testing is taking place. The main unit (not the desktop development version) is working in a shop, on a real lathe. Stuff happens there. Once I had a chip fly into a power outlet. It made a loud bang, the chip had hit the hot wire and ground. The chip was vaporized in a bright blue flash. It's not open bread board friendly environment! The three phase lathe spindle motor is powered by a VFD which can generate all sorts of EMI.

Pity on the binary. It could be useful to have, that's 2x data compression compared to text.
 
I hacked two Teensy's together, with one of them running @defragster 's little code. I'm getting numbers across the link, but at the moment, my eye isn't great at interpreting the data.
Code:
System started
0
0
10
13
83
116
97
114
116
32
116
105
109
101
32
61
32
52
50
51
51
52
56
54
54
49
10
13
What's being transmitted is more like this:
Code:
Loop = 2.380351667 msec
Loop = 2.380358333 msec
Loop = 2.380591667 msec
Loop = 2.380791667 msec
Loop = 2.381605000 msec
Loop = 2.383483333 msec
Loop = 2.380238333 msec
Loop = 2.380111667 msec
Loop = 2.380091667 msec
Loop = 2.380525000 msec
Loop = 2.381471667 msec
It would be nice to convert the ints back to characters, so the file is readable. I was thinking of having a little buffer waiting for a \n\r or something like that, then converting everything to ascii. Is there an easier way to do it?
 
I'm getting numbers across the link
Opps - that is what the example does - and I paired it down removing verbose 'comments' per character - but it is printing each character as ascii# one per line.

I have a minute to revisit if you don't see the fix.
 
Does this help?

Code:
void loop() {
    char incomingByte;
        
    while (Serial.available() > 0) {
        incomingByte = Serial.read();
        // HWSERIAL.print("USB received:");
        HWSERIAL.print(incomingByte);
    }
    while (HWSERIAL.available() > 0) {
        incomingByte = HWSERIAL.read();
        // Serial.print("UART received: ");
        Serial.print(incomingByte);
    }
}
 
That should do it.

I added a same Teensy Serial2 printf to test and it works - just replace the loop() code from prior post.

Code:
// set this to the hardware serial port you wish to use
#define HWSERIAL Serial1

void setup() {
    Serial.begin(9600);
    HWSERIAL.begin(2000000); // T_4.x might go to 5Mb, but higher will bring more interrupts on 1st
    Serial2.begin(2000000); // T_4.x might go to 5Mb, but higher will bring more interrupts on 1st
}

elapsedMillis aTime;

void loop() {
    char incomingByte;

    if ( aTime > 2000 ) {
      Serial2.printf( "Loop = %lu\n", millis());
      aTime=0;
    }
        
    while (Serial.available() > 0) {
        incomingByte = Serial.read();
        // HWSERIAL.print("USB received:");
        HWSERIAL.print(incomingByte);
    }
    while (HWSERIAL.available() > 0) {
        incomingByte = HWSERIAL.read();
        // Serial.print("UART received: ");
        Serial.print(incomingByte);
    }

    while (Serial2.available() > 0) {
        incomingByte = Serial2.read();
        // Serial.print("UART received: ");
        Serial.print(incomingByte);
    }
}
 
I needed to strip out the \n\r stuff to make things more compact.
This is what I came up with. I need to put in a delay to wait for the device to become active.
C:
// set this to the hardware serial port you wish to use
#define HWSERIAL Serial5

void setup() {
    Serial.begin(3000000);
    HWSERIAL.begin(3000000); // T_4.x might go to 5Mb, but higher will bring more interrupts on 1st
    Serial.printf("System started\n");
}

void loop() {
    char incomingByte;
        
    while (Serial.available() > 0) {
        incomingByte = Serial.read();
        // HWSERIAL.print("USB received:");
        HWSERIAL.println(incomingByte);
    }
    while (HWSERIAL.available() > 0) {
        incomingByte = HWSERIAL.read();
        // Serial.print("UART received: ");
        if ((incomingByte =='\n')) {
          Serial.print(incomingByte);
        }
        if ((incomingByte !='\n')&&(incomingByte!='\r')) {
          Serial.print(incomingByte);
        }
    }
}
Output looks more reasonable, except for the binary I haven't stripped out yet.
Code:
Start time = 394536081
Start time = 0.6575679483 seconds
Hello, FTDI is up!
|O�0, 516, 478957436
Loop = 6.291746667 msec
Loop = 2.379838333 msec
Loop = 2.379425000 msec
Loop = 2.380105000 msec
Loop = 2.379845000 msec
Loop = 2.379711667 msec
Loop = 2.379925000 msec
Loop = 2.380151667 msec
Loop = 2.380691667 msec
Loop = 2.379958333 msec
Loop = 2.380345000 msec
Loop = 2.380245000 msec
Loop = 2.379525000 msec
 
IIRC the included PJRC '.println' sends both \r and \n - so that may be why it is there when only '\n' is needed - very annoying when cut and paste double taps them ... as bad a MSFT WORD default to non-single line spacing :(

Glad it is working as promised. Seems you did edits as the incoming serial pasted still has println to the UART - if you don't send any input there that is no issue and that Serial.available() clause could be removed,
 
IIRC the included PJRC '.println' sends both \r and \n - so that may be why it is there when only '\n' is needed - very annoying when cut and paste double taps them ... as bad a MSFT WORD default to non-single line spacing :(

Glad it is working as promised. Seems you did edits as the incoming serial pasted still has println to the UART - if you don't send any input there that is no issue and that Serial.available() clause could be removed,
It's sufficient for what is needed at the moment. Who knows, I may be forced to figure out MTP on a Mac.

I thought I'd start this debug journey by putting in markers in my code, just for profiling. So file number, line number and timestamp. This should at least tell me roughly where the time is being spent. Does this make sense? Maybe some state variables.

Also a marker for when the sync angle has been detected and one for when the first following stepper pulse is issued. How I actually know which pulse is which actually is an interesting issue. For all I know there's a significant delay, which might be the whole sync problem in a nutshell.
 
It's sufficient for what is needed at the moment. Who knows, I may be forced to figure out MTP on a Mac.

I thought I'd start this debug journey by putting in markers in my code, just for profiling. So file number, line number and timestamp. This should at least tell me roughly where the time is being spent. Does this make sense? Maybe some state variables.

Also a marker for when the sync angle has been detected and one for when the first following stepper pulse is issued. How I actually know which pulse is which actually is an interesting issue. For all I know there's a significant delay, which might be the whole sync problem in a nutshell.
I know your using a MAC but if you can use Windows on it you might consider looking at VisualMicro (VM) with Visual Studio.
VM gives you run time debugging, though I must admit I have not tried using that feature.
 
I know your using a MAC but if you can use Windows on it you might consider looking at VisualMicro (VM) with Visual Studio.
VM gives you run time debugging, though I must admit I have not tried using that feature.
I have a newer Mac. (M3) Windows doesn't run on it, nor do I wish to use some solution to allow it. Windows has run it's course in my home... Both my wife and I transitioned away from it around 2005. Did the Linux thing until late 2024, then went to a Mac. Every OS has it's issues, seen most of them.

I have used Visual Studio on a Mac, that works, although I've yet to compile Arduino stuff with it. Apparently you need VisualMicro? Dunno, this is just hobby use. Don't know if VisualMicro runs on a mac. Their FAQ page says:

Does Visual Micro work with Visual Studio for Mac?

Sadly the Visual Studio for Mac is a different product which does not support the C++ programming environment required for Visual Micro.


I've compiled C++ on a Mac, not sure what the problem they have. But it appears they don't support a Mac. That's the end of that.
 
Back
Top