Teensyduino 1.21 Test #2 Available

Status
Not open for further replies.

Paul

Administrator
Staff member
Here is a test version for Teensyduino 1.21:


EDIT: old links removed. Please use this newer version.



Please give this a try and report any bugs. Try to include a sample program that reproduces the problem!

This test version has a newer 4.8.4 toolchain for Teensy 3.1 and improvements to the Arduino Serial Monitor.
 
Just installed it and loaded my current project which compiled without issues. Could not yet shoot it towards the teensy since I'm at work and not at home. Will report problems later in case there are.
 
Paul, is there any more detailed changelog available somewhere?

Sure. Here's all the details. 1.20 was released on Oct 7th, so ignore commits before that date.

https://github.com/PaulStoffregen/cores/commits/master

https://github.com/PaulStoffregen/Arduino-1.0.6-Teensyduino/commits/master

https://github.com/PaulStoffregen/SPI/commits/master

As you can see, pretty minor stuff and small fixes. The toolchain upgrade and edits to the serial monitor are the only major changes.
 
Last edited:
I'm really hoping you'll give the improved serial monitor a try. That's the big new change.

The tricky part to watch is whether is always manages to automatically reopen the connection to your Teensy after an upload.
 
The tricky part to watch is whether is always manages to automatically reopen the connection to your Teensy after an upload.

Oh, that's a new feature which I consider as being important. Can't wait to go home after work and give it a try!
 
I'm really hoping you'll give the improved serial monitor a try. That's the big new change.

The tricky part to watch is whether is always manages to automatically reopen the connection to your Teensy after an upload.

Thanks Paul, will try that for sure. I'm also glad that the memory leak with auto scroll disabled was addressed. I think that was reason why the serial monitor became non-responsive sometimes after long logging session.
 
Hi Paul, just a quick note of thanks for the update and so far it seems to coexist very nicely with the xCode environment. I was able to build a program for my device and run it too, with the serial output now coming via a Terminal shell vs. the Arduino Serial Monitor. So far, it looks like it works great.

Thanks Paul, will try that for sure. I'm also glad that the memory leak with auto scroll disabled was addressed. I think that was reason why the serial monitor became non-responsive sometimes after long logging session.

The memory leak is something I also encountered. Though I didn't know what it was, I just noted that the computer itself would become unstable. :p
 
Yes, this is supposed to fix the memory leaks and also allow most PCs and Macs to keep up with maximum rate printing. It put the GUI update of the serial monitor on a 30 Hz schedule, so no matter how fast Teensy prints, Java only has to redraw the window contents at 30 Hz.

But I can't possibly test on a wide range of PCs and Macs... which is the main reason for this test release.
 
Just installed on my OSX 10.9.5 and the RawHID does not print anything to serial monitor now. Sketch:

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


void loop()                     
{
  Serial.println("Hello World");
  delay(1000);
}
 
Not sure if you want to add any more corrections in this release, but I've noticed that some of the examples (especially the ones for SD and SPI) are missing some CS pin description for Teensy 3.x. Also in other examples (e.g. where built in LED is used) there is only reference to Teensy 3.0 but not 3.1). These are minor things but in examples which are meant for newcomers may be important.

Here are some examples:
CardInfo.ino
Datalogger.ino
DumpFile.ino
Files.ino
listfiles.ino
ReadWrite.ino

But I'm sure there is more...
 
I really hope the serial monitor will work with RAWHID because compiling with Serial crashes my computer still!
 
I can't get sprintf to work with floating point - neither float nor double. It worked this morning before I installed 1.21 Test #2.
Teensy3.1 on 64-bit Windows 7 Pro.
A sample program which demonstrates the problem and shows that sprintf still works with integers.

Code:
#include <stdio.h>
#include <stdlib.h>

float e = 2.7f;
double p = 3.14159;
char tmps[64];
void setup(void)
{
  Serial.begin(9600);
  while(!Serial);
  Serial.println("Start");
  
  // sprintf of double and float doesn't work at all.
  sprintf(tmps,"%8.5f, %8.5lf",e,p);
  Serial.println(tmps);
  
  // printing a float with Serial works
  Serial.println(e,2);
  // and sprintf of an integer is OK
  sprintf(tmps,"%6d",12345);
  Serial.println(tmps);
}

void loop(void)
{
}

Output is:
Code:
Start
, 
2.70
 12345

Can anyone reproduce this or have I made a dumb mistake?

Pete
 
Last edited:
ok, not trying pile on but it seems after printing data very fast to serial monitor it crashes (freezes) the IDE when you try to upload while its printing.

OS: OSX 10.9.5
Teensy: 3.1, Serial, 48MHz, 1.21(#2)
Arduino: 1.0.6
Sketch to reproduce this: same as before just changed the delay for fast printing let it go awhile ~(2 minutes) then try to upload the same or any code without closing the serial monitor. The IDE will freeze and I have to Force Quit it.
Code:
void setup() {                
  Serial.begin(38400);
}


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

Edit:
It also seems that if you just upload this code and then try to upload again very soon after a couple of times it freezes also. I know this is a bit neurotic but just want this serial monitor stuff working good so I'm trying to see where it breaks:D
 
Last edited:
Edit agin: Don't care about what I wrote before (in italics below).

A fresh install of Arduino 1.06, then Teensyduino 1.20, then Teensyduino 1.21#2 solved all problems. The serial monitor remains open, clears its content when uploading code, and starts displaying again!

Thank you for this fine update!

OK, all that does NOT work for me after upgrading from 1.20 to 1.21#2 ... :-(
a) The serial monitor window remains blank, no output is seen.
b) It does not reopen automatically after uploading code to the teensy.
Thus I'll have to revert to teensyduino 1.20 - hope that this will work for me

(OSX 10.10.2, Arduino 1.06)

Edit: Gave it another try. Did a fresh install of Arduino 1.06 and Teensyduino 1.21#2. Same problem. No output on the serial monitor. No automatic (re-)opening of the serial monitor. Now doing a fresh install of 1.06 again with 1.20 and hope that things will art least work as they did before.
 
Last edited:
I get "deprecated" warnings with

bool findUntil(char *target, char *terminator); (Stream.h)

If the strings are "const". I don't know if this is normal (did not test with TEENSYDUINO120).
Maybe it should be bool findUntil(char const *target, char const *terminator); ?

Regards,
Frank.
 
use of double and "lf" in sprintf... does Teensy 3 software floating point support doubles in math as well as the DEFAULT clib formatter for doubles (versus single/float)?
 
With version 1.20 of Teensyduino, this code on a Teensy 3.1:
Code:
void setup(void)
{
  char tmp[32];
  Serial.begin(9600);
  while(!Serial);
  delay(1000);
  
  sprintf(tmp,"%18.12lf",sin(3.14159/4));
  Serial.println(tmp);
}

void loop(void)
{
}
prints:
Code:
    0.707106312094

But it doesn't work with 1.21 test#2. It doesn't print anything.

Pete
 
Pete, it is not true that it doesn't print anything, it does print - a CRLF... ;-)

Apparently, what you see is the "normal" behavior. See this link

It would rather be interesting to understand why this worked in 1.20, though...
 
Just discovered another issue: Even the "simple" Serial.println() does some unexpected and weird variable casting.

printing a int8_t (signed byte) which contains a negative value gives a int32_t output. WHY???

void setup(void) {
Serial.begin(57600);
while(!Serial);
delay(1000);
Serial.println("Started");
int8_t i = -2;
Serial.print("DEC");Serial.print("\t");
Serial.print("size");Serial.print("\t");
Serial.print("HEX");Serial.print("\t");
Serial.println("BIN");
Serial.print(i,DEC);Serial.print("\t");
Serial.print(sizeof(i));Serial.print("\t");
Serial.print(i,HEX);Serial.print("\t");
Serial.println(i,BIN);
}

void loop(void) {
}

Output:

Started
DEC size HEX BIN
-2 1 FFFFFFFE 11111111111111111111111111111110

instead if the expected

Started
DEC size HEX BIN
-2 1 FE 11111110
 
Last edited:
Just discovered another issue: Even the "simple" Serial.println() does some unexpected and weird variable casting.

printing a int8_t (signed byte) which contains a negative value gives a int32_t output. WHY???

That is because there is no version of the Print class that takes signed char (i.e. int8_t) as a type, and the compiler does the standard conversions to one of the types that have alternates in Print.h. The C/C++ languages first convert signed char/short to int. On the arm platform, int is a 32-bit type. On the AVR platform (like the Arduino), int is a 16-bit type.

Code:
        size_t print(unsigned char n, int base)         { return printNumber(n, base, 0); }
        size_t print(int n, int base)                   { return (base == 10) ? print(n) : printNumber(n, base, 0); }
        size_t print(unsigned int n, int base)          { return printNumber(n, base, 0); }
        size_t print(long n, int base)                  { return (base == 10) ? print(n) : printNumber(n, base, 0); }
        size_t print(unsigned long n, int base)         { return printNumber(n, base, 0); }
 
Thank you, MichaelMeissner!

I was just trying to accelerate some of my code, replacing floats by integers as pseudo-floats and doing some bitwise operations and bit shifting, which can be dangerous with signed numbers. I need also to use deliberately some rollover effects. All that can be useful when emulating harmonic oscillators with resonating filters.

So, I wanted to check out some of my "ideas" with the famous "Serial.print debugger" and was really confused by its outputs...
 
Thank you, MichaelMeissner!

I was just trying to accelerate some of my code, replacing floats by integers as pseudo-floats and doing some bitwise operations and bit shifting, which can be dangerous with signed numbers. I need also to use deliberately some rollover effects. All that can be useful when emulating harmonic oscillators with resonating filters.

So, I wanted to check out some of my "ideas" with the famous "Serial.print debugger" and was really confused by its outputs...
Sounds like fixed-point math. There are libraries for fixed-point arithmetic, written in C.
 
Ran into an error compiling a known good program, and I've found why.
I don't know when Adafruit_SSD1306 was changed, but the version supplied by the installer doesn't match the version on Paul's github.

The compile fails due to a prototype not having a matching function definition;
the header declares
Code:
void dim(uint8_t contrast);
but in the source we have
Code:
void Adafruit_SSD1306::dim(boolean dim) {
  uint8_t contrast;

  if (dim) {
    contrast = 0; // Dimmed display
  } else {
    if (_vccstate == SSD1306_EXTERNALVCC) {
      contrast = 0x9F;
    } else {
      contrast = 0xCF;
    }
  }
  // the range of contrast to too small to be really useful
  // it is useful to dim the display
  ssd1306_command(SSD1306_SETCONTRAST);
  ssd1306_command(contrast);
}

Bringing the prototype in line with the definition removes the error being thrown, but I can't vouch for the functionality.
 
Last edited:
Status
Not open for further replies.
Back
Top