Serial Issue with Teensy

Status
Not open for further replies.
Ok then, let's try digging deeper to see where the problem is really happening.

Here's a copy of arduino-core.jar which prints the number of bytes it's actually getting for each serial event.

https://www.pjrc.com/teensy/beta/arduino-core.jar

MD5 = 32c3ae4c34c320b0d16f2ba16738568d

Here's how it looks when I run it.

View attachment 12200

To use this, download the JAR file. I recommend running "md5 arduino-core.jar" in a Terminal window, to make sure you have the right file.

Quit Arduino, if it's running. Control-click Arduino and click "Show Package Contents". Then navigate to Contexts/Java. Replace the copy of arduino-core.jar with this one.

When you run Arduino again and open the serial monitor, you should see the messages printing in the console panel. The big question is whether Arduino on your Mac really is receiving all the incoming bytes and somehow losing them internally, or perhaps they're not ever coming into the serial event handler. This test should let us know.

done
md5 check is correct.

Bildschirmfoto 2017-12-09 um 09.49.58.jpg
 
every time the Serial monitor shows new data, your debugging Line does as well.

My Mac does for sure receive all data! I can check with Screen command as well as with TYCommander.
It is very interesting that Arduino loos only complete Lines??!!

for example see Line "Serial readBytes 6"
in the Serial monitor you can clearly see " arduino-core.jar replaced" is missing.

Bildschirmfoto 2017-12-09 um 10.03.45.jpg
 
Last edited:
At least we now know the data isn't getting lost within the Java stuff.

I must confess, I don't really know much about the code that is between the unix/iokit API and serialEvent....
 
At least we now know the data isn't getting lost within the Java stuff.

I must confess, I don't really know much about the code that is between the unix/iokit API and serialEvent....

What is the difference between USB Type "RAW HID" and "Serial"? because RAW HID works 100% reliable!
Maybe this question can point us a direction?
 
Last edited:
I managed to restart in safe mode now.
Arduino does not recognize the teensy board at all.
Does somebody know which processes I have to start, and may can also tell me how?

thanks
 
Just a quick followup on this old thread. I haven't forgotten. In fact, I'm working now on major improvements to how Teensy communication is done through Arduino. I hope to have something for testing next week.
 
Hey Paul, Thank you for this Information.

I haven't find out any more details. Problem is still the same.
let me know if there is something to test. I can still reproduce the bug. So we should know quickly if it is fixed with the update.

best regards, Peter
 
I've posted 1.42-beta1 with the new serial monitor code.

https://forum.pjrc.com/threads/49831-Teensyduino-1-42-Beta-1

Please give this a try. I'd really like to know if it solves this elusive Mac serial issue?

While using 1.42-beta1, the new serial monitor stuff is only used when you select the board from the "Teensy" ports. If you select it from "Serial Ports", the old serial monitor using the Java JSSC library is used.
 
hey Paul,

Does not work on my machine:

Build options changed, rebuilding all
Archiving built core (caching) in: /var/folders/w9/c8t26_712cs3gfghqhhhyyr40000gn/T/arduino_cache_753021/core/core_teensy_avr_teensy35_usb_serial,speed_120,opt_o2std,keys_en-us_cee3a1d70ca5f7f18ab44a012a95ee10.a
Sketch uses 13204 bytes (2%) of program storage space. Maximum is 524288 bytes.
Global variables use 4892 bytes (2%) of dynamic memory, leaving 191716 bytes for local variables. Maximum is 196608 bytes.
/Applications/Arduino.app/Contents/Java/hardware/teensy/../tools/teensy_post_compile -test -file=sketch_feb19a.ino -path=/var/folders/w9/c8t26_712cs3gfghqhhhyyr40000gn/T/arduino_build_669318 -tools=/Applications/Arduino.app/Contents/Java/hardware/teensy/../tools -board=TEENSY35 -reboot
An error occurred while uploading the sketch
teensy_serialmon, loc = 14600000
USB add callback
usb_add: location=14600000
USB remove callback
USB remove callback
USB add callback
usb_add: location=14600000
teensy_serialmon, loc = 14600000
USB add callback
usb_add: location=14600000
USB remove callback

Bildschirmfoto 2018-02-19 um 11.55.18.jpg

"No device"Serialmonito =offline

the teeny 3.5 is only detected while programming.... see pic.

Bildschirmfoto 2018-02-19 um 11.57.14.jpg
 
Looks like I still have more work to do here!

This week I've been putting quite a bit of work into improved logging. Thanks for taking the time to do this testing. Hopefully the next attempt will be able to give us much better info.

I really do want to find & fix this elusive Mac problem!
 
Another new beta is available. This one fixes several problems with High Sierra.

https://forum.pjrc.com/threads/50254-Teensyduino-1-42-Beta-3

Any chance you could give this new beta a try on your machine? I'm determined to fix this strange Mac serial problem, but it doesn't happen on any of the Macs I use.

This new beta also features much better logging, which you can access from Teensy Loader's Help > Verbose Info menu. If it still doesn't work, hopefully we'll get some useful info about what's going wrong.
 
Of course!!!
The affected machine still has the same setup.
I have tried to leave the system as unchanged as possible in order to be able to reproduce the error.
I will test it tomorrow or on Wednesday.

best regards.
 
Thanks for keeping with this. It's a huge help, since I don't have any Macs that reproduce this problem.

When you try this, you should see Teensy appear twice in the Port menu. If you select under "Serial", the old code is used. You should see the exact same problem.

If you select under "Teensy", the new code is used to talk to the serial port. Hopefully this will work better?
 
Bildschirmfoto 2018-03-14 um 15.22.02.jpg

Hey Paul Beta 3 still does not work. Yes I have pressed the PROGRAM Button.
Port = no device.
The old way is still working with Beta 3.

Teensy did not respond to a USB-based request to enter program mode.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
An error occurred while uploading the sketch
teensy_serialmon, loc = 14600000
USB device add callback
loc=14600000, vid=16C0, pid=0483, ver=0200, ser=2397460
actual serailnum=239746
USB device remove callback
Serial add callback
name=/dev/cu.usbmodem2397461, loc=14600000, vid=16c0, pid=0483, ver=0200
Serial remove callback
HID Manager started
errorPipeListener thread exit
 
update....

after a system restart I can select the "new" Port option.
I'm currently testing with 64bit Version Beta4-pre1.

After some seconds the Serial monitor just stop printing.
I tried with 1ms delay instead of 100ms, a delay of 1-4ms works, but some lines are still lost, (with both Port settings. (old Arduino Serial monitor and new Teensy one))
A delay greater then 4ms doesn't work, (Serial monitor stop printing after a few seconds).


An error occurred while uploading the sketch
teensy_serialmon, loc = usb:14600000
USB device add callback
loc=14600000, vid=16C0, pid=0483, ver=0200, ser=2397460
actual serailnum=239746
USB device remove callback
Serial add callback
name=/dev/cu.usbmodem2397461, loc=14600000, vid=16c0, pid=0483, ver=0200
Serial remove callback
HID Manager started
serial_event write
serial_event read error -1

I will downgrade again to Beta 3 and try again.
 
Let's focus on testing with the "Teensy" entry in the Ports menu.

These new betas collect a lot more info. It's in Teensy Loader's Help > Verbose Info. That windows has a Log menu to save the data to a file. Any chance you could save that log file on the next attempt?
 
I'm looking at the logs now. The first strange thing I notice is there seems to be 2 instances of "teensy_ports" running. That's not supposed to happen. Any chance you could look with activity monitor, or "top" or "ps -aux" in the terminal to check if there really are 2 copies running?
 
I have closed Teensy Loader and Arduino via activity monitor.
If I restart Arduino, there are two teensy_ports processes showing up again.

Edit:

Closed an restarted again, now there are 3 processes called teensy_ports.
 
Status
Not open for further replies.
Back
Top