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

Thread: COM-Port problem

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    8

    COM-Port problem

    Hey there,

    I am new here and have no experience with Teensys.

    Whatīs the problem:
    I have written this little Sketch, which should just return "Hello World" at the serial monitor and uploaded it to my Teensy 3.6.
    But it said me: "No serial port, please select with Tools > Port"
    So I went to Tools, but couldnīt select Port.
    Then I went to the device manager. There I have seen that my Teensy is connected to the PC, but no COMs.

    Code/Sketch:

    void setup() {
    Serial.begin(38400);
    }

    void loop()
    {
    Serial.println("Hello World");
    delay(1000);
    }

    Hardware:
    Teensy 3.6
    Arduino IDE 1.8.5
    Windows 10

    It would be nice, if someone could help me
    Thank you

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,700
    If this is a nice new and Shiny Teensy 3.x, which you have not programmed before, the Teensy has been reprogrammed simple blink program that does not create a USB serial port and as such does not show up as a COMxx

    What you should try is with your simple program, choose Teensy 3.6 as the board type. And have USB Type as Serial.
    Choose the Verify/Compile command, which should compile your program and should bring up the Teensy program.
    Now go to your teensy and press the program button on the board. You should then see the Teensy program show a download progress and at that time you should see your computer say something like setting up new device and then assign a COMxx port to your teensy. As long as your Teensy has a program on it with a USB type that includes Serial, you can then just choose the Upload command in the Arduino IDE to program it again

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Teensy uses HID protocol, not serial, for uploading. So the first big question is whether you're able to upload that sketch at all?

    The Tools > USB Type menu sets which type of USB device Teensy becomes when it runs your program. It's supposed to default to "Serial", but if it's changed to some other setting without serial, then Teensy isn't supposed to ever appear as a serial device. Double check that it's set to Serial.

    If things aren't working, it's entirely possible something has gone wrong in the Windows registry regarding the USB device detection. Windows 10 is much better than 8, 7 & XP, but it still can happen. As a first sanity check, try setting USB Type to MIDI or RawHID and upload. Then open the serial monitor. It uses HID to emulate serial, so you should see the printing "just work" without selecting any port. HID is detected automatically.

  4. #4
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    Thank you for your Reply!

    @KurtE
    I have tried this way, but nothing happens. I also tried it with a simple blink sketch, to make sure that my teensy isnīt faulty.

    Code:
    const int led = LED_BUILTIN;

    void setup() {
    pinMode(led, OUTPUT);
    }

    void loop() {
    digitalWrite(led, HIGH);
    delay(100);
    digitalWrite(led, LOW);
    delay(100);
    }


    The LED is blinking, so the communication between PC - Teensy is working, but in this case i donīt need the serial monitor.


    @PaulStoffregen
    1) Yes I can upload sketches.
    2) It has always been set to serial and I have not changed anything.
    3) This is exactly the problem. The Teensy is mentioned in the device manager as HID and as USB controller but no COM.

    The interesting thing is that I can upload sketches, but canīt use the serial monitor, because of no port.

  5. #5
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,803
    you must enable the usb serial port in setup --> Serial.begin(300); <-- the value doesnt matter as it runs full speed 12mbit, then the port will show on the pc...

    next, sketches are not uploaded via serial, its uploaded via HID, so not weird at all, just very fast

  6. #6
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    I think there is an obvious mistake which I always do again.

    So I have changed the BAUD rate. Uploaded it to my Teensy. Started the sketch. Nothing happens.
    Just: "No serial port, please select with Tools > Port" but I canīt select Port. Here we go again.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Did you try this (from message #3)

    As a first sanity check, try setting USB Type to MIDI or RawHID and upload. Then open the serial monitor. It uses HID to emulate serial, so you should see the printing "just work" without selecting any port. HID is detected automatically.

  8. #8
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    Yes, when I open the serial monitor comes this: "no Connection".
    And I have tried both USB types MIDI and RawHID.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    This is very strange. When you have uploaded a sketch using RawHID, the serial monitor uses HID protocol which is the exact same driver the Teensy Loader uses to program your board. It really should "just work".

    Please try again. Make sure the serial monitor is closed, and USB Type is RawHID. Then upload and watch Teensy Loader to make sure the upload worked, so you can be sure the Teensy really is using RawHID. Then open the serial monitor again.

    Be careful to follow ALL those steps in the correct order.

    If it *still* does not work after those steps, please post a screenshot so we can see the error.

  10. #10
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    So, I have tried all steps in the correct order like you have said it.
    The IDE says me "no connection".
    Click image for larger version. 

Name:	Unbenannt.jpg 
Views:	52 
Size:	88.5 KB 
ID:	12142Click image for larger version. 

Name:	Unbenannt3.jpg 
Views:	32 
Size:	87.9 KB 
ID:	12145Click image for larger version. 

Name:	Unbenannt2.jpg 
Views:	45 
Size:	90.9 KB 
ID:	12143Click image for larger version. 

Name:	Unbenannt4.jpg 
Views:	50 
Size:	90.8 KB 
ID:	12144Click image for larger version. 

Name:	Unbenannt5.jpg 
Views:	61 
Size:	90.2 KB 
ID:	12146

  11. #11
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,700
    Ok,

    Check your Tools/Port menu and see if there is now a valid item to select.

    After you upload the program using RAW HID, I showed a similar issue, when I first tried it, if I had unplugged the board after it had been programmed as RAW HID.

    That is I took a T3.6 board that had been programmed with USB: Serial which showed up as COM6. I then created program like yours, Set USB to RAWHID and uploaded the program to the Teensy... It worked. I then unplugged the Teensy, exited, the Arduino IDE... I then plugged in the Teensy and reloaded the Arduino IDE. I then uploaded the program again, which worked, but the Arduino monitor would not open... It still said for COM6 and the closed message.

    However, I then looked at the Serial port menu and it now had a COM15 like object listed, I choose that one and now the serial monitor opens and my hello world messages show up.

  12. #12
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    I have tried it with different USB Types (serial, MIDI and RAW HID), but no one works.
    I have also tried to use different USB cables and plugged them into different ports.
    Is it possible that the connection couldnīt be found because of the USB port version?
    All my ports are USB 3.0, not USB C. Could this maybe be the problem?

  13. #13
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    The memory usage summary in your screenshot looks very wrong. When I compile here, I get this:

    Code:
    Sketch uses 13364 bytes (1%) of program storage space. Maximum is 1048576 bytes.
    Global variables use 5028 bytes (1%) of dynamic memory, leaving 257116 bytes for local variables. Maximum is 262144 bytes.
    Click image for larger version. 

Name:	sc.png 
Views:	30 
Size:	30.5 KB 
ID:	12162

    Your screenshot shows *much* less memory usage, far below what's needed for the USB code to run on Teensy 3.6. The HEX file you're actually loading onto your Teensy is almost certainly not functional. It doesn't matter if your PC's USB port and your USB cable are good if you program Teensy with bad code that can't possibly make its USB port communicate.

    I do not understand how this is even possible. Maybe your installation of Teensyduino is somehow corrupted?

    Please try reinstalling Arduino and Teensyduino from a fresh download. Please pay close attention to any errors during install. Sometimes an overly aggressive anti-malware program can interfere with the installer writing all the files.

  14. #14
    Senior Member
    Join Date
    Jul 2014
    Posts
    109
    @Tony31, did you ever figure this out? I have similar problems when I use my laptop and I always end up trying different ports or restarting my computer until it works again. Very annoying.

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    I too would really like to know what went wrong. This looks very different from the normal Windows issues. Arduino was successfully compiling the code, but ending up with a memory summary that's obviously wrong.

    It's tempting to think perhaps the core library files in hardware/teensy/avr/cores/teensy3 got corrupted. Or maybe anti-virus software interfered with the installer writing some of the files? But how that could happen and result in an error-free compile is very mysterious!

    @Tony31 - Is there any chance you or someone using your machine edited those files? Or maybe other changes were made to the installation? I just can't understand how Arduino managed to successfully compile your code without all the normal code that makes USB work.

  16. #16
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,700
    @BuffaloFan32 - maybe need additional information, like are is this Windows/Mac/Linux....

    Some of Tony31 builds looked bad as the size of the executable was too small... That is for example if I build for T3.5 on Linux with 1.8.5 RawHid Faster ...
    My build with yesterdays Beta build is 13064 bytes in size. If I remember his showed 2k?

    If I ran into issues like this, I would probably try exiting Arduino and then delete all the temp files.
    On my Linux machine under /tmp I would delete all of the directories that had names like:
    arduino_build_* arduino_* untitled*.tmp

    Then restart Arduino and try a new build and see if the results work better...

  17. #17
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,084
    On Windows - watching my TEMP folder where the IDE drops the folders - they go away as the IDE exits each time. If any part of the IDE was open or failed a clean exit they may remain - but I haven't seen that in recent days as I was testing new machine and new install and parallel builder etc.

    I have seen on Windows that compiling as RAW HID may/will not show a PORT for Teensy. However TyCommander does detect and provide reliable connect to RawHid - TyCommander links and more info posted here.

    As noted in that linked post IDE SerMon currently takes 2 or more seconds to reconnect in Windows. When you get a proper sized file (Teensy 3.6 compiled 'Faster' with USB Type "Serial"):
    Sketch uses 14292 bytes (1%) of program storage space. Maximum is 1048576 bytes.
    Global variables use 4944 bytes (1%) of dynamic memory, leaving 257200 bytes for local variables. Maximum is 262144 bytes.
    Perhaps with this code where a programmed wait for SerMon was added and text to USB SerMon:
    Code:
    const int led = LED_BUILTIN;
    
    void setup() {
      pinMode(led, OUTPUT);
      while ( !Serial && millis() < 4000);
      Serial.print( "Hello World! @ millis ==" );
      Serial.println(millis());
    }
    
    void loop() {
      digitalWrite(led, HIGH);
      delay(900);
      Serial.println(millis());
      digitalWrite(led, LOW);
      delay(100);
    }
    TyCommander output starts like this:
    Hello World! @ millis ==424
    1324
    2324
    3324
    4324

  18. #18
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    Sorry, that I donīt replied quicker but I wasnīt home last week.

    So Iīm glad, that somehow I have fixed my problem.
    What do I have done?
    1) Deleted my Teensy in the device manager
    2) Uninstall the Arduino IDE and deleted the Arduino folder
    3) Cleaned everything with CCleaner
    4) Installed the Arduino IDE and the TeensyduinoInstall
    5) Started the Ardunino IDE and opened my "Hello World" Sketch
    6) Clicked verify and then the pushbutton on my teensy
    7) Selected the port and opened the serial monitor

    I donīt know if it is important or not, but after you install the "TeensyduinoInstall" there is written:

    First use: Click Verify and then the pushbutton
    Later: only the upload

    I think my fault was, that I have always pressed the button, so the Teensy went off and wasnīt "available" anymore.

    I donīt know what exactly was the problem, fortunately it is working.
    But it is interesting to know, what triggered this problem.

  19. #19
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    @Tont31 - Do you make backups of your computer? Is there any chance the corrupted copy of the Arduino IDE may still be on any of your old backups? If so, and if you can make a big ZIP file of everything from C:\Programs Files (x86)\Arduino and upload it somewhere like dropbox, maybe I can take a look and try to see what went wrong.

  20. #20
    Junior Member
    Join Date
    Dec 2017
    Posts
    8
    @PaulStoffregen
    No Iīm sorry.
    When I have deleted the Arduino IDE, I have also deleted the old Arduino folder.

  21. #21
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Looks like we'll never know what really happened here.

    But nonetheless, I'm considering adding some sort of check that the core lib files are intact for future versions. I might also have the installer re-read everything to check it all got installed correctly. It seems things are becoming less and less reliable for Windows users has anti-virus programs take stronger measures to interfere with programs writing too much data (assuming they're ransom-ware which is encrypting all your files).

Posting Permissions

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