Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Teensy and Visual Studio

  1. #1

    Teensy and Visual Studio

    Hi!
    So i'm working on a project that involves communicating a Teensy 3.2 with PC using USB.
    On the PC side is a Visual Studio App that read the serial information via serialPort.isOpen() then serialPort.bytesToRead() and finally serialPort.readLine().
    On the teensy side is just Serial.println().
    But the thing is, i cant communicate between the two.
    The app receives the first string, but it freezes after that.
    Does anyone know anything that could influenciate in this communication?
    Thank you!!

  2. #2
    Senior Member crees's Avatar
    Join Date
    Dec 2016
    Location
    Utah
    Posts
    216
    How often is the serial print line happening? In each loop?

  3. #3
    Quote Originally Posted by crees View Post
    How often is the serial print line happening? In each loop?
    I would say 2~3 times per second.
    It only communicates when a hope RF interrupts to receive the information from another RF.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,753
    Does Teensy println show on SerMon as expected?

    Does the Teensy keep running? Blinking LED or something showing it is running?

  5. #5
    What is SerMon? Serial Monitor? Just when I don't use the Visual Studio. After I open the Serial connection in the VS it stops working even after closing the VS.
    Sometimes yes, sometimes it justs freezes.

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,753
    Generally assumed there is a working Arduino IDE install on poster's machine for Teensy Code review and a common base system. Is the Teensy sketch compiled for USB Type: Serial - or other?

    In the IDE is a Serial Monitor or SerMon. If you have an alternate Serial Monitor that is good to see it work. If compiled as USB Serial only a single program can consume the that connection, the same connection has to drop to allow programming - either under software control or a Button push.

    If opening Visual Studio breaks the connection - that that may be pointing toward the problem.

  7. #7
    USB type: Serial
    I just used the serial monitor the first time I compiled the code to see if it was working. But after that I tried only the VS by recompiling it or pushing the reset button, but it didn't work. The app got the first or two lines correct, but after that it froze. I tried the same code (same string sending by serial.print) with an arduíno nano and it ran smoothly.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,753
    Not sure how to read : 'just used the serial monitor the first time I compiled the code'

    Does SerMon work if tried again? Teensy USB is unique - generally much better - though it may be sensing something odd as addressed from the PC code.
    Did you confirm the Teensy is still running when the output froze?

    Follow this link and install TyCommander as a trusted Serial Monitor. That post or the updated Post #1 will lead to released program. I get the ZIP and the unzip to a clean known directory and run TyCommander.exe from there. With the Teensy selected and the 'Serial' tab shown and the upper 'Serial <-\->' selected the Teensy output will appear in that window. If it cannot be selected then something has ownership of the USB port and needs to be released.

  9. #9
    Quote Originally Posted by defragster View Post
    Not sure how to read : 'just used the serial monitor the first time I compiled the code'

    Does SerMon work if tried again? Teensy USB is unique - generally much better - though it may be sensing something odd as addressed from the PC code.
    Did you confirm the Teensy is still running when the output froze?

    Follow this link and install TyCommander as a trusted Serial Monitor. That post or the updated Post #1 will lead to released program. I get the ZIP and the unzip to a clean known directory and run TyCommander.exe from there. With the Teensy selected and the 'Serial' tab shown and the upper 'Serial <-\->' selected the Teensy output will appear in that window. If it cannot be selected then something has ownership of the USB port and needs to be released.
    I just tested the first time with the serial monitor to see if the code on teensy was transmitting the right information. Then I closed the Serial Monitor and rebooted the teensy. Even so, the program on VS would freeze almost instantly. But the same code on an arduíno nano would work perfectly. After I open the VS, even if I close it, the serial Monitor would only work if I rebooted the teensy again.
    I think it keeps running, because I have an interrupt routine the blinks the led if the interruption occurs.
    Okay! I will try that, thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •