Teensy 4.0 First Beta Test

Status
Not open for further replies.
opps << This ended up on wrong thread ... https://forum.pjrc.com/threads/57441-Tensorflow-on-Teensy
BTW .. the YES/NO recognition takes 2.6 seconds on T4 ...

Seemed half done to have YES set LED high and then no indication of NO, so modified:
Code:
void RespondToCommand(tflite::ErrorReporter* error_reporter,
                      int32_t current_time, const char* found_command,
                      uint8_t score, bool is_new_command) {
  static bool is_initialized = false;
  if (!is_initialized) {
    pinMode(LED_PIN, OUTPUT);
    is_initialized = true;
  }
  static int32_t last_yes_time = 0;
  static int32_t last_no_time = 0;
  static int count = 0;

  if (is_new_command) {
    error_reporter->Report("Heard %s (%d) @%dms [ms lag=%d]", found_command, score,
                           current_time, millis()-current_time);
    // If we heard a "yes", switch on an LED and store the time.
    if (found_command[0] == 'y') {
      last_yes_time = current_time;
      digitalWrite(LED_PIN, HIGH);
    }
    if (found_command[0] == 'n') {
      last_no_time = current_time;
      digitalWrite(LED_PIN, LOW);
    }
  }

  // If last_yes_time is non-zero but was >3 seconds ago, zero it
  // and switch off the LED.
  if (last_yes_time != 0) {
    if (last_yes_time < (current_time - 3000)) {
      last_yes_time = 0;
      digitalWrite(LED_PIN, LOW);
    }
    // If it is non-zero but <3 seconds ago, do nothing.
    return;
  }
  if (last_no_time != 0) {
    if (last_no_time < (current_time - 3000)) {
      last_no_time = 0;
      digitalWrite(LED_PIN, HIGH);
    }
    // If it is non-zero but <3 seconds ago, do nothing.
    return;
  }

  // Otherwise, toggle the LED every time an inference is performed.
  ++count;
  if (count & 1) {
    digitalWrite(LED_PIN, HIGH);
  } else {
    digitalWrite(LED_PIN, LOW);
  }
}
 
Last edited:
@Paul:
Last code was TensorFlow - IDE still active - not much else. Doing a SIMPLE 1 print/sec sketch and IDE showing this on 5th or so IDE Upload with text selected in t_sermon window
{Win 10 machine, up 15 days - prob not relevant.}

BAD/Interesting thing: 'Autoscroll OFF' and with a single number printed per line there was ONE line/Number Selected for prior Copy to paste.
>> It does REPRO when value selected and IDE Upload executed, no item selected and No Error Spew in console.
>> Also watching the GUI the selection block crawls around BEFORE new incoming text as the error SPEW arrives. So it is the text selection of the prior instance trying to map on the restarted fresh text when buffer empty?
Code:
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
T:\arduino-1.8.9t4\arduino-builder -dump-prefs -logger=machine -hardware T:\arduino-1.8.9t4\hardware -hardware C:\Users\Tim\AppData\Local\Arduino15\packages -hardware T:\tCode\hardware -tools T:\arduino-1.8.9t4\tools-builder -tools T:\arduino-1.8.9t4\hardware\tools\avr -tools C:\Users\Tim\AppData\Local\Arduino15\packages -built-in-libraries T:\arduino-1.8.9t4\libraries -libraries T:\tCode\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10809 -build-path T:\TEMP\arduino_build_116394 -warnings=more -build-cache T:\TEMP\arduino_cache_60035 -verbose T:\tCode\FORUM\LoopSpeed\LoopSpeed.ino
errorPipeListener thread exit
[COLOR="#FF0000"]//...[/COLOR]
"T:\\arduino-1.8.9t4\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-size" -A "T:\\TEMP\\arduino_build_116394/LoopSpeed.ino.elf"
Sketch uses 12528 bytes (0%) of program storage space. Maximum is 2031616 bytes.
Global variables use 15424 bytes (1%) of dynamic memory, leaving 1033152 bytes for local variables. Maximum is 1048576 bytes.
T:\arduino-1.8.9t4\hardware\teensy/../tools/teensy_post_compile -file=LoopSpeed.ino -path=T:\TEMP\arduino_build_116394 -tools=T:\arduino-1.8.9t4\hardware\teensy/../tools -board=TEENSY40 -reboot -port=usb:0/140000/0/8/7 -portlabel=hid#vid_16c0&pid_0478 Bootloader -portprotocol=Teensy 
TeensyPipeMonitor open usb:0/140000/0/8/7
FifoDocument.getText *****NEGATIVE NUMBER ERROR*****
opened, dev=COM37, name=Serial
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:245)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:245)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:245)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:245)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:245)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:245)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
javax.swing.text.BadLocationException: beyond end
	at processing.app.FifoDocument.createPosition(FifoDocument.java:580)
	at javax.swing.text.DefaultHighlighter.changeHighlight(DefaultHighlighter.java:246)
	at javax.swing.text.DefaultCaret$Handler.insertUpdate(DefaultCaret.java:1676)
	at processing.app.FifoDocument.processAppended(FifoDocument.java:391)
	at processing.app.inputPipeListener$1.run(TeensyPipeMonitor.java:293)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Simple sketch:
Code:
int Counter = 0;
unsigned long TickCount = 0;

void setup() {
  Serial.begin(9600);
  TickCount = millis();
}

void loop() {
  Counter ++;
  if (millis() - TickCount > 1000) {
    Serial.println(Counter);
    TickCount = millis();
    Counter = 0;
  }
}
 
BAD/Interesting thing: 'Autoscroll OFF' and with a single number printed per line there was ONE line/Number Selected for prior Copy to paste.
>> It does REPRO when value selected and IDE Upload executed, no item selected and No Error Spew in console.
>> Also watching the GUI the selection block crawls around BEFORE new incoming text as the error SPEW arrives. So it is the text selection of the prior instance trying to map on the restarted fresh text when buffer empty?

I was able to reproduce this bug. Committed a fix on github.

https://github.com/PaulStoffregen/A...mmit/e203e8cfa87377d1d5839da852bc3a6ab62d880c

I also made some changes in the Mac version of teensy_serialmon to make it slightly more efficient (but sadly, still nowhere near the Windows & Linux versions) and hopefully more stable. Sadly, I just don't see any solution for the excessive CPU usage on Macintosh. It seems reading from the serial device uses quite a lot of CPU time on MacOS. :(

So far I have not managed to reproduce the freezing on windows resize issue on msg #4257. I've put it on my list of bugs to (later) investigate.

Rather than publish a 9th JAR file here, I'm going to put a day or two into porting libs and looking into other non-IDE reported issues, then publish 1.48-beta1 to roll up everything.
 
@PaulStoffregen - I put in a PR for SPI where I changed the Drive Strength and Speed values for the SPI pins for T4. It helped for some of our displays.

You might want to double check to see if you think these are the best settings for them or not.

Thanks
Kurt
 
I was able to reproduce this bug. Committed a fix on github.

https://github.com/PaulStoffregen/A...mmit/e203e8cfa87377d1d5839da852bc3a6ab62d880c

I also made some changes in the Mac version of teensy_serialmon to make it slightly more efficient (but sadly, still nowhere near the Windows & Linux versions) and hopefully more stable. Sadly, I just don't see any solution for the excessive CPU usage on Macintosh. It seems reading from the serial device uses quite a lot of CPU time on MacOS. :(

So far I have not managed to reproduce the freezing on windows resize issue on msg #4257. I've put it on my list of bugs to (later) investigate.

Rather than publish a 9th JAR file here, I'm going to put a day or two into porting libs and looking into other non-IDE reported issues, then publish 1.48-beta1 to roll up everything.

That fix looks like it felt, cool.

Odd the MAC being the odd one.

Scrolled from the above fix - any chance the resize error is catching in here and going to sleep to the next 'USB event' after a abort return without notice or - does that account for all the exceptions? - just wondering:
Code:
	[URL="https://github.com/PaulStoffregen/Arduino-1.8.9-Teensyduino/blob/e203e8cfa87377d1d5839da852bc3a6ab62d880c/app/src/processing/app/TeensyPipeMonitor.java#L291"]private void update_gui[/URL](int chars_added, boolean auto_scroll) {
		final Runnable do_update = new Runnable() {
//...		};
		int retry = 0;
		while (true) {
			try {
				SwingUtilities.invokeAndWait(do_update);				return;
			} catch (InterruptedException e) {
				if (output.debug) System.err.println("GUI update interrupted");
				if (output.program == null) return;
[B]				if (++retry > 4) return;[/B]
			} catch (Exception e) {
 
any chance the resize error is catching in here and going to sleep to the next 'USB event' after a abort return without notice or - does that account for all the exceptions? - just wondering:

Are you seeing "GUI update interrupted" print multiple times when the resize problem happens?

Resizing or moving the window shouldn't cause Java to interrupt the thread. Normally the listener thread is only supposed to be interrupted by the close() function.

https://github.com/PaulStoffregen/A...rc/processing/app/TeensyPipeMonitor.java#L156
 
Are you seeing "GUI update interrupted" print multiple times when the resize problem happens?

Resizing or moving the window shouldn't cause Java to interrupt the thread. Normally the listener thread is only supposed to be interrupted by the close() function.

https://github.com/PaulStoffregen/A...rc/processing/app/TeensyPipeMonitor.java#L156

No as noted ' nothing ever prints ' from the time it stalls including after it restarts. Though skipped reading that line in context … for the retry exit. So it isn't that code path.

Don't know Exception behavior - assuming any failed try would be caught in the second catch()? And uncaught it would fault otherwise and not just stay in while(1)?

If related to that code my other question would be related to note in prior post - if a message got lost or mishandled would this wait forever - until USB changes trigger restart? :: SwingUtilities.invokeAndWait(do_update);

Not sure why I can repro Stall so easily - and then it resumes with a USB [arrive,depart] from Windows core.
 
MacBookPro8,2 early 2011 4Gb ram, i7 2.2GHz, osx 10.14.6, arduino 1.8.9, td1.47

I managed to install Mojave on my 3th machine, which is NOT supported by Apple.
Everything freshly installed.

attempt 1: 11min
attempt 2: 6min
attempt 3: 50min
attempt 4: 58min
attempt 5: 17min
attempt 6: 4min
attempt 7: 40sec
attempt 7: 8min

@neurofun - Could I talk you into giving 1.48-beta1 a try on your Macs?

https://forum.pjrc.com/threads/57609-Teensyduino-1-48-Beta-1

I made some changes inside teensy_ports which might make it more stable. I ran for hours on my Macbook Air. But very hard to know how it'll do on other Macs...
 
@PaulStoffregen
MacBookPro8,2 early 2011 4Gb ram, i7 2.2GHz, osx 10.14.6, arduino 1.8.9, td1.48beta1

first run
attempt 1: 5m30s 40% cpu load arduino
attempt 2: 30s 40%
attempt 3: 1m35s 40%
attempt 4: 19m30s 40%
attempt 5: 3m40s 265%
attempt 6: 42m 400%
attempt 7: 88m 400%

second run
attempt 1: 50s 40%
attempt 2: 3m42s 40%
attempt 3: 9m 40%
attempt 4: 2m15s 40%
attempt 5: 9m 40%
attempt 6: 4m 220%
attempt 7: 46m 280%
 
Also it appears like I can no longer select and copy text in the Terminal Monitor when the cable is unplugged.
1.8.10, Windows 10 64 bit.
 
Also it appears like I can no longer select and copy text in the Terminal Monitor when the cable is unplugged.
1.8.10, Windows 10 64 bit.

I can confirm that @KurtE - no selection when offline.

Also BATCH #3 of Teensy 4.0 must have been a BIG one - and #1 and #2 none too small. SparkFun has this on that item::
Note: We have 995 incoming. We do not have an estimated date yet.
Incoming stock values are estimates, and subject to change without warning.
 
@PaulStoffregen

On a windows10x64 machine I just tested SerialPlotter with IDE1.8.9 and TD1.47beta1 with the following sketch:
Code:
float a, b, c;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  a = 0.5000;
  b = 0.7500;
  c = 0.2500;
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.printf("%f,%f,%f\n",a,b,c);
  //delay(1);
}
Running the sketch without the delay(1) will eventually hang IDE and have to use TaskManager to kill the process. This will occur after about a second. With the 1ms delay there is no problem with keeping up with the data stream.

To honest kind of expect this but wanted to let you know.
 
@Paul - Quick question:

Is it correct that the 'Host USB D-' pin will output a negative voltage? And would having a pin like #36 bridged to that USB D- pin in use be expected to perhaps impair future use of that pin (or worse)?


In testing seems #36 pin is intermittent from trying to solder the cable of the breakout board for T4 and having those small pitch pins connect under the cable.
 
Hi @defragster and @Paul - If I remember correctly the USB DN/DP pins don't go negative. They simply have to have a differential of voltage between the two pins.

Example in the web page: https://electronics.stackexchange.com/questions/190592/why-does-usb-have-vcc-5v-and-high-3-3v
As well as others... Again I could easily be wrong...

But I know I do see the two voltages on the Logic Analyzer...

Here shows a quick and dirty partial output from LA
screenshot.jpg
 
Thanks Kurt.

About to post on linked thread - Pulled off the metal Cover on the SD socket and my test is running more reliably now from 100Khz to 10 Mhz ? SD socket has #36 between 3V3 and GNS - USB not part of that once to that part. I did reflow the pins to that socket and wicked off some solder.

Need to reinstall the cover plate as it secures the SD card … and try again that test and then the actual SD test …

Going to be a bit - gotta make a road trip.
 
Is it correct that the 'Host USB D-' pin will output a negative voltage?

No. USB uses only positive voltage relative to GND.


And would having a pin like #36 bridged to that USB D- pin in use be expected to perhaps impair future use of that pin (or worse)?

If they were shorted together and both were in output mode and one tried to drive high while the other tried to drive low, that could cause a lot of current to flow through both pins. That puts a lot of stress on the chip. Usually it doesn't permanently damage the hardware. Usually.
 
No. USB uses only positive voltage relative to GND.
Good to see KurtE provides good test/answers too :)

If they were shorted together and both were in output mode and one tried to drive high while the other tried to drive low, that could cause a lot of current to flow through both pins. That puts a lot of stress on the chip. Usually it doesn't permanently damage the hardware. Usually.

Thanks Paul, that Pin #36 got 'shocked' somehow - unless my solder cleanup reduction reflow fixed something that was bridged - because it seems to be working now for PWM and Digital I/O testing where before it seemed weak to drive to 3.3V high. But all that testing clean - it won't work to @loglow's SDIO adapter yet :(
 
Anyone know how to trigger a reset of the Teensy4 in software?
I tried WDOG but not clear where the WDOG would be locked during startup code (I don't see in the code)

I also tried the arm v7 procedure

SCB_AIRCR = 0x5FA0004;
while (true) {
;
}

It does not work when this worked on the T3.6

Any help is welcome.
 
https://github.com/tonton81/Watchdog_t4/blob/master/Watchdog_t4.cpp

You posted on another thread that it doesn't work for you, and on a different thread you posted it's code is relevant to only 1052, not 1062, they both are identical to the watch dog accesses, can you explain what doesn't work, and did you remove the wtd.feed() from the loop to do your testing?

Happy that you reacted and sorry for the confusion.

Again, my gall is to generate a reset of the T4 by software (reboot the same flashed image)
I indeed tried your example on the Teensy4.0. I use the latest SDK on an official T4 where only the SD card is soldered.
If I feed the dog, the application keeps alive and I can flash it as much as I want from the Arduino IDE.
If I don't feed the dog and look at the serial monitor output, I don't see the callback but instead, the monitor output (printed in the setup) is greyed out.
After that, I cannot flash the teensy anymore. I need to press the button.
So the watchdog does not seem to create a reset but also I don't see the callback print on the monitor output.

As the project is quite old, I thought it had been tested on the T4b1.
Have you tried the code on T4beta2 or official one, with latest SDK?

Note that I don't use serial4 but just serial. Also in the callback.
So my setup() looks like this (just some stupid printfs to see if was reaching the end):
Serial.begin(115200);
Serial.println("1");
wdt.setPin(19); // pin that drives LOW when a wdt occurs.
wdt.setTrigger(5); // callback 5 seconds before final timeout
Serial.println("2");
wdt.callback(myCallback);
wdt.setTimeout(10); // reset timeout
wdt.begin(); // enable watchdog
Serial.println("3");
 
Some correction, I see the callback message but no reset occurs (monitor output greyed out)

also you have to adapt the code for the macro WDOG_WCR_WT as below I guess else it does not compile with latest SDK.:

void watchdog_class::setTimeout(float val) {
if ( val < 0.5f ) val = 0.5f;
else if ( val > 128 ) val = 128;
uint8_t value = (float)(( val / 0.5f) - 1);
WDOG1_WCR |= (WDOG1_WCR & ~WDOG_WCR_WT(255)) | value << 8;
}
 
Last edited:
Status
Not open for further replies.
Back
Top