For p#2 referred to this: arduino.cc/reference/en/language/functions/communication/serial/print/
Didn't look into sources for either. The FORMAT param is noted for 'Arduino' - but not given complete coverage beyond...
Sorry, didn't try when you noted it worked, I got moved to other tasks here ...
Wondering if there is anything telling or unique about the 'new found' malloc code that might point to a solution or change for the...
Last doe posted with .yield() ending the alloc was not safe with mutex, but assume it finished that to yield before time slice ended preventing multiple callers - and then counter var only allowed one thread to alloc at...
If KEY.PEM was not created using the tools - there will not be one on the system. This is only used when an encrypted T_4.x is in use.
Also seems the local copy of teensy_secure.exe exists, but is not allowed to run...
The Teensy LED PIN 13 is on the SPI SCK - clock pin.
So, during transmission over SPI using pin 13 the LED will blink - very fast appearing ON.
Depending on the driver and the use the SPI transmission may be...
None, except a sketch typically includes Arduino.h by default in the IDE
This works to build and upload:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial &&...
@Paul: just created Teensy-4-x-Hooks-before-setup()
> note the time added for PSRAM:
#ifdef ARDUINO_TEENSY41
configure_external_ram();
#endif
@CollinK: also there are notes on startup timing and while looking...
Below is a sample sketch that shows creation of local hook() functions called before entry to setup as the Reset process proceeds.
It makes some notes on what can be expected to work in each of the three hooks and...
Did a quick edit to setup for Alloc/Free and no diff now in current code - except the indication of TThreads data issues.
Works with 80 and fails with 100 stack DWord edits.
...
Thread 0 malloc 1024. Addr =...
Based on this note code was added when threads start:
void thread_loop( int threadID )
{
//bool fail = false;
uint32_t fCnt = 0;
#define STK_CHK_SIZE 80
int stkSig;
for ( int ii = 0; ii < STK_CHK_SIZE;...
Did a quick edit to store strings for thread 0 to print - and had each thread yield after one try and only try in turn if their number was up - then pass turn to next thread ... in the process it went odder at each step...
Okay that is the last code I started with - but minor edit to remove 'warning' and (void*)i+1
for (int i=1; i<=threadCount; i++)
threads.addThread(thread_func, (void*)i, threadStackSize); // stack alloc'd from...
Not looked deeper but: Problem seems malloc expects to own the RAM space as it understands it based on that first call setting the base pointer - and the main and threads have unique views with regard to stack and the...
Something odd for sure. Seemed all 4 threads were doing Alloc with post #29 - then some change and only thread 0 and 4 made repeat calls. Then the change indicated in p#30 and then only thread 0 and 1 are active?
...
Just added: ftrias/TeensyThreads/issues/38
It was not giving threadsInfo on LAST thread.
Something isn't working as expected? I added int* me in code below - output changed drastically and makes no sense - how does...
If all instances of Wire have been changed to Wire2 this could be removed: #define Wire Wire2
Has this been tested to work on Wire with the appropriate changes?
> proper pullups and wiring?
Some i2c Devices...
As noted p#11 the first caller to malloc() sets baseline ptr* brkval - that is the 'logic' behind the main thread alloc 'hack':
if (__brkval == 0)
__brkval = __malloc_heap_start;
cp = __malloc_heap_end;
if...
Please provide a complete/short example showing incorrect function.
If usage was in error forum may help clarify, if the code really is in Error then it needs to be corrected.
Setting this seems essential: InChar = 0; // Added to fix crash after updating to IDE 1.8.19
When called without any Serial.available() if the prior exit was with:: if (InChar == 10)
It will enter that...
Opps - I hesitated asking the obvious ... are there any interrupt functions involved that should not be in FLASHMEM.
The Teensy's 1062 has 32KB code cache - so maybe it can get away with it for some time if it stays...
WORKING - back on Windows 11!
Now Com18 instead of COM6.
Found a BLUETOOTH ??? device also on COM6
Device Mgr remove of the Com6 devices didn't do it.
Used RegEdit to search "COM6" ignored Bluetooth ......
Looking at TeensyThreads.cpp, no malloc - just :
threadp = new ThreadInfo();
stack = new uint8_t;
Added threads get default 1K or specified Stack and Thread0 main loop() gets 10K.
Not sure what...
Malloc seems to have the idea there is one HEAP - but each Thread seems to have some reserved space from RAM - how that is allocated would be shown in TeensyThreads? Does it do malloc() for the requested Stack space?
...
Opps - too long since then. Thanks for detail reminder
Suppose 15s Wipe was working - but prior times Loader was open with code to reinstall
Still have to go back to Win 11 and see if it can get cleared to work...
Fun Update - On the porch with Win 10 Laptop that probably hasn't seen the old T_3.5
OLD_T_3.5 seems to work NORMALLY here
Tried three 15s Restores - finally wiped the code - but not running factory Blink
Next...
I saw similar funny # for Remains
This MIGHT be a work around - but it might just give way to another issue later on.
The malloc code uses those fixed points for REF and it isn't clear they are valid when...
BTW: In testing I made a LARGE Flash code test and that worked. So, it has to be some specific problem code that runs from Flash when it conflicts
That code github.com/Defragster/T4LockBeta/tree/main/Code4Code was...
Also - OLD_T_3.5 is ignoring the 15 second Restore as that was timed and tried about 6 times. with timer at 14,15,16 seconds.
It seems 'something failed' on OLD_T_3.5 - except it worked when I went to DUAL Serial, so...
Pulled out a T_3.5 - used quite a bit in past for past testing - not used in Months++
- Once cut VIN<>VUSB - now soldered again
- Top side Female headers in place
- No problems when last used
>> This is Win 11...
Thought that might be the case - and if it isn't auto restarting then CrashReport code may not get called in this case.
And if the Button won't go into Program mode it seems the MCU is 'offline'?
If there is a...
I didn't post the code - but the p#9 alloc_func() was just called from setup() in the existing code - then it no longer acted the same when called from the Thread.
The malloc code has some dependencies that may not...
Indeed, the malloc() code does do something on first call with regard to finding and using a HEAP to build on?
Adding this to setup before starting the thread - whatever is allocated here is then available for alloc...
Good to know it is TSET and not just this system.
It is probably path inclusions of: "%LOCALAPPDATA%\Arduino15\..."
> in : ...\TSet\TSet.cmd2
> the same one that BREAKS when that folder fails to exist.
echo...
Have not seen that reported before.
Does the Teensy do a Restart after the 'freeze'? If there is some 8 seconds delay and a restart it may be from a usable gathering of Crash Data.
Try using CrashReport to see if...
@KurtE - my computer didn't stop my getting to the post #20 'downloader' (and didn't see an obvious attack) it displayed an HTML that won't attach as a file. Here is a TEXT copy of the content.
USB-Verbundgerät
...
@KurtE / @mjs513 : using TSET CMDLINE build is this seen?
The UnZip install of TD 1.57 was done - and The IDE 2.0 is installed - but cannot run to update?
Not sure of the relationship of TD IDE 1.89 .vs. 2.0 -...
Thanks @Neal for the DOC link - that is the one searching on 'AN12253' found on this prior Jan 2021 thread: pjrc.com/threads/65768-Teensy-4-1-CPU-Heat-Limits
With the SAVED HEX file safe in a known location the Teensy Loader can 'File / Open HEX File' - that was the context of Post #25
Sorry, did not document the IDE : 'Sketch / Export compiled Binary' { Ctrl + Alt + S }...
Thanks for the nice review! Yes, all pin ports 6,7,8,9 - when 1062 Teensy in FastIO mode - are mapped to one _isr vector.
Code as posted with CHANGE on PWM was running at freq=100K {200K changes/sec}, and times went...
With a saved .HEX file - restart the system.
Open Teensy.exe the loader, and use the menu to open the hex file.
Plug in the Teensy and push the Button.
Perhaps open Help / Verbose info to watch Teensy captured...
No scope here, though tried to get interrupt response time, in CPU cycles counts, for fun and show some of the code.
> like NVIC_SET_PRIORITY(IRQ_GPIO6789, 30);
Here PWM triggers p#34 wired from p#18, and toggles...
You must be bdlabitt@github ... I posted there with reinstall as an option.
... bummer the linux version in use upgrade breaking TyCommander ... it will be missed ...
Great that it is running.
@Paul's p#5 gave some indication about loss of USB. If the code goes awry and trashes memory the USB Stack can get disabled.
If the code was writing to that array without a limit on...
There is another older thread where some fewer intermittent issues were noted. I got out a new one or two {from early production} and had some odd pins - but they went away swapping across boards so none seemed faulty...
Does the computer have Teensy Loader open with a Teensy LC compatible program built and ready to upload?
The Button on a Teensy is not Reset or 'boot' - but puts the Teensy into Program mode.
If Teensy Loader is...
Odd. If it were a typical crash that CrashReport would handle, the device would go offline 8 seconds and restart.
Wondering if the WDT was interfering with CrashReport - it does not seem to. With no WDT or not...
@was-ja : sorry just seeing you replied to this.
Attempting to pinpoint which instruction was causing the fault it was modified as below.
NOTE: The code below initially tested on a T_4.1 with only 8MB PSRAM, running...
There is a: Serial.printf( "\tdeg C=%u\n" , (uint32_t)tempmonGetTemp() );
That will report the temp measured in the processor, if USB Serial montior is available.
145F is 63C and that is where (at or above) it...
Will depend on if storage is in RAM1 or RAM2. See T_4.1 product page if details needed.
Both at 512KB - But RAM1 is filled with CODE and default program Data - and runs at Processor speed. RAM2 typically unused but...
I started with ZIP install and saw the Auto Update work as well - very cool, except for Update it then runs the MSI Installer leaving the ZIP install orphaned and now running form the Arduino install location.
pjrc.com says: "Update, July 30, 2022: We expect to have Teensy 4.0 in stock by August 8."
and: "Update: August 1, 2022: We have only Teensy 4.1 without ethernet right now. Many Teensy 4.1 with ethernet recently...
@PaulStoffregen might make something useful of the Verbose output
It shows linux in use. Wonder if some OS update recently is breaking Teensy connection?
Do you have access to another computer?
That looks like a nice program and assembly with the display!
Safe to assume since it was soldered to that PCB as pictured it has been programmed some number of times after that?
When USB is connected, and Teensy...
RE #1: Would also be helpful perhaps to show the link to the active Forum DEV thread for MTP {54 pages!}:
> pjrc.com/threads/68139-Teensyduino-File-System-Integration-including-MTP-and-MSC
RE #2: for sure best to...
Pushing the button would have a different RED LED response.
The 2 Blink suggests it restarted (after power loss?) - and the (external?) power was not suitable in current supply and rise time.
The 2 Blinks is on...
The diagnostic RED LED flashes are noted on this page: 2 Blinks = NXP JTAG Not Responding
The note for that is:
How is the Teensy being powered? Standard USB or external supply?
Had it worked before and been...
Bummer - no time to lose chips.
Some number have been produced before with PJRC bootloader and they worked?
Now altered layout and first one assembled not acting right?
Not a wide audience for help much, or...
@Paul should give a look then.
Indeed, the CARD image shows a wire trace going directly towards VIN - so functionally it replicates the VUSB pad - but would seem to bypass the fuse if installed above board inline...
Indeed, you did - and the somewhere in above "examples" demonstrates setting the RTC ... perhaps not as desired with the one indicated that does refer to DS1307RTC ...
Indicated forum search - or better - should find...
Yeah - PTC ... wasn't sure that was the proper TLA ... so 'soft' fuse ... i.e. not a fuse that 'blows' as noted.
Correct - looking now - there is a second VUSB 'pad' that replicates the connector pad to expose it in...
This example seems to replicate the above code - maybe adding the offset from UTC?
>> {local install}\hardware\teensy\avr\libraries\Time\examples\TimeGPS\TimeGPS.ino
But that doesn't appear to set the RTC clock.
...
Not a schematic reader ... but there are two VUSB tags showing. The tag labelled near 'WRONG'/'CORRECT' has no connection except to the Device connector - appears to be labelling the line for orientation and location...
T_4.x has a RED LED that will blink AFAIK when USB is not connected when the Button is pushed.
This works on a production T_4.1, but does not work the same way when Lockable T_4.1 is Locked:
Not sure if this is...
Aug 3, 22 : MalwareBytes Support got the teensy_secure.exe program removed from unsafe list.
Going back and forth with MalwareBytes on False Positive detection for Quarantine of Teensy_Secure.exe in %appdata% folder...
Teensyduino 1.57 has been released << Release change notes here
pjrc.com/teensy/td_download.html
Quick summary: 1.57 adds USB host support for disk drives, audio input by analog input pin, fixes a MacOS crash...
When TeensyDuino installed there is a copy of the EEPROM code for the Teensy4 family directory. It is not a simple matter of directly writing.
That code is non-trivial, it works with the processor reserved area...
@Paul - BreadCrumb is noted as added - a lin kto the example might help it get use:
github.com/PaulStoffregen/MyFault/tree/main/examples/BreadCrumb
Though it is really short:
// MyFault - collection of examples...
There is a FAULT occuring on entering loop() it seems. THere is an 8 second wait and then a restart.
Add this to setup:
while (!Serial && millis() < 10000 );
Serial.println("\n" __FILE__ " " __DATE__ " "...
How long is the break in the beam?
This line: delay(1000);
Will only allow one INSTANT check every second.
The SENSORPIN is set PULLUP - so that assume the sensor when triggered will drop the pin to LOW?
...
That was just for sanity - would have been nice if it cleaned it up. Promising the Teensy working as RAW_HID ...
basic\Blink sketch doesn't have any print()'s ... Typically here a Serial.println( micros() ); in the...
Tested here on a T_4.1 that has a larger EEPROM space.
Didn't do the math - not sure if the initial math may be running off the end? The addr++ method versus the i+1*(n+1) math would push farther into the addr space?...
Yes, the posted code worked here.
For better code that would not have hardcoded work/hack look into replacing with indicated get() and put() that are designed to work with such Structs or other declared types.