Search results

  1. V

    Interrupt on Serial Data receive Teensy 4.0 USB port

    ericscottf, another option would be to use TeensyThreads library and have one thread be your main (with the code you currently have inside loop) and other thread keeps checking the USB Serial for available data. Keep in mind that TeensyThreads is buggy and unmaintained. I also don't recommend...
  2. V

    Suggestion to get maximum accuracy when reading frequency of external crystal

    Thank you all for the replies and suggestions! Ok, now I got the general idea. I will try this out in the future depending on the outcomes of my current test setup. So as far as I understand, in order to achieve this I would need to have an external oscillator and an external clocked...
  3. V

    Suggestion to get maximum accuracy when reading frequency of external crystal

    Hi mborgerson and Paul! Thanks for the insightful replies as always. I ended up ordering two different external oscillator: Pletronics 1ppm VCTCXO and Connor Winfield 5ppb OCXO My first attempt was to remove the standard Teensy 24 Mhz crystal and connect the output of the external Pletronics...
  4. V

    Suggestion to get maximum accuracy when reading frequency of external crystal

    That's great advice, Paul! If a TCXO has enough temperature stability for my use case, what would be the specs I should look for when selecting the part? For example, input voltage, output signal form and voltage. Maybe if you could provide the exact part number of the current 24 MHz crystal...
  5. V

    Suggestion to get maximum accuracy when reading frequency of external crystal

    I'am working on a project using Teensy 4.1 where I read the frequency of a Quartz Crystal Microbalance (QCM) using the FreqCount library. My goal is to be able to detect very small changes on the QCM frequency (natural frequency around 5 MHz) caused by deposition of material (added mass) over...
  6. V

    Teensy 4 Arduino 2.0.3 addr2line tutorial

    Doesn't seem to be your case, because you are using Arduino IDE, but I had the same problem when using VSCode + PlatformIO and the solution was to include the compilation flag "-g" when compiling the sketch. Make sure Arduino IDE is including this. Another thing to keep in mind is that you may...
  7. V

    Unintentional HIGH when uploading code to the Teensy 4.1

    I just stopped using pin 48 and moved to another pin. I am not planning on changing the default startup code, and would have to do this every time we update Teensyduino. It seems like adding a pulldown resistor to pin 48 wouldn't help either, because it is being actively driven high. Thanks...
  8. V

    T4 CrashReport Debugging on a Mac

    @jmarsh Applying this patch solved the issue for me! Many thanks. Now if the crash happens inside the thread, the correct place is show in addr2line and the .lst file.
  9. V

    Unintentional HIGH when uploading code to the Teensy 4.1

    Thanks jmarsh! I decided to change from pin 48 to other pin and this fixed the issue for me. As for pin 36, I placed a pull-down using a 1K ohm resistor and was also able to solve the issue with this pin. Still not able to understand why it only happens with certains pins, thou.
  10. V

    Teensy 4 Arduino 2.0.3 addr2line tutorial

    Great post! Helped me a lot when I was getting started with CrashReport functionality :D
  11. V

    Unintentional HIGH when uploading code to the Teensy 4.1

    I am currently facing a similar issue but with different pins: 36 and 48 (back) on Teensy 4.1. My situation is very similar to the one from @mwolters. I have chosen 8 different digital pins to control 8 relays, and pins 36 and 48 always started HIGH during Teensy startup, even if it was just a...
  12. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    My final solutions - still using those As this thread became long, I will add to phorton1 solution above and try to summarize my final solution to both problems related with TeensyThreads (non-reentrant code and malloc/new). I hope that someone finds this useful. Problem: malloc() does not...
  13. V

    T4 CrashReport Debugging on a Mac

    Thanks @defragster and @jmarsh for the tips! I will modify my code to start using the CrashReport.breadcrumb functionality to help better track the crashes. Also, just a quick question: Is the location where CrashReport stores information to be displayed when Teensy reboots different than the...
  14. V

    T4 CrashReport Debugging on a Mac

    The breadcrumbs functionality seem very nice. However, I am still not sure which strategy to use to help me pinpoint unknown crashes that I have no idea where could have happened (think a 40000+ lines program that crashes intermittently, with 4 cooperative threads). Maybe if I at least knew...
  15. V

    T4 CrashReport Debugging on a Mac

    Hello all! Sorry for commenting on this old thread but I am facing a very similar issue regarding debugging a crash in a Teensy sketch that uses threads (TeensyThreads library). I have noticed that every time the crash occurs inside a thread, the crash report will report the "yield()" function...
  16. V

    issues with USB mass storage function within TeensyThreads

    The main thread is usually thread ID 0. You can check it by running threads.id() function. To create other threads, you will use threads.addThread(thread_function), which creates the thread and will return the thread ID of the created thread. There are many ways to use TeensyThreads, as it...
  17. V

    issues with USB mass storage function within TeensyThreads

    Not exactly the answer for your specific problem, but I do have my two cents related to the issue with TeensyThreads, which may or may not be helpful to you. I have a very large program (30k + lines of code) which use dozens of different libraries, none of them directly thread safe. In the...
  18. V

    teensy 4.1 analogRead inconsistenct

    That's great! Thanks for sharing the results. That's exactly my case, a code port from a Teensy 3.5 to 4.1 and this ADC pinMode config change was going completely unnoticed. Glad I read this post out of curiosity while scrolling through the forum.
  19. V

    teensy 4.1 analogRead inconsistenct

    Hi lokki, were you able to fix the problem adding pinMode(xx, INPUT_DISABLE) to setup()? I was not aware of this issue and will probably need to fix all my T4.1 projects if that's the case.
  20. V

    Ethernet Teensy 4.1 connection problem - NativeEthernet bug?

    1+ for using QNEthernet. It uses more RAM, but it's more stable and has more options than NativeEthernet. I had better luck with QNEthernet in my projects. Also, it's more actively maintained.
  21. V

    QNEthernet using 80k RAM

    Just a quick update. I have tested with the last version which integrates the "buffers-in-RAM2" modification and everything seems to be working great. Gained extra 15K bytes of RAM1 space, which is precious for my application. Many thanks!
  22. V

    QNEthernet using 80k RAM

    That's amazing! Thanks again shawn and Paul for all the support. Looking forward to the next QNEthernet release :D
  23. V

    QNEthernet using 80k RAM

    Hi Shawn, I built with the later compiler and it did in fact help. The RAM1 usage went down by 40kB. As for reducing the lwIP pre-allocates, I didn't have much success. Setting LWIP_MDNS_RESPONDER to 0 did not affect my RAM usage. Changing MEMP_NUM_UDP_PCB to 2 instead of 8 and MEMP_NUM_TCP_PCB...
  24. V

    QNEthernet using 80k RAM

    Hello @shawn, first of all, thank you for creating and maintaining this awesome library! I had better luck with QNEthernet than the NativeEthernet library and recently started using it on my project. However, I noticed that in my case, the RAM1 consumption for this library is 100 kB higher than...
  25. V

    Teensyduino File System Integration, including MTP and MSC

    @KurtE and @defragster thanks for all the info! I have tried many things and I think I managed to "solve" my issue regarding slow USB Serial initialization times. I just need to remove the Serial.begin() function. Than magically everything starts up fast again, both MTP and SERIAL. The other...
  26. V

    Teensyduino File System Integration, including MTP and MSC

    Wow, I didn't know that it was possible. Thanks for showing me that thread! For Teensy 4, would the procedure be similar? And also, in that example, the EEPROM was checked right after the startup, so the desired behavior was to just delay the USB initialization to be able to choose which...
  27. V

    Teensyduino File System Integration, including MTP and MSC

    @KurtE , first of all, thank you very much for developing this library, it's super useful! :D I have been using the latest version from the repo and TD1.57. I would like to be able to only activate the MTP functionality when the user sends a specific "Switch MTP ON command", which would begin...
  28. V

    CryptoAccel library use with T4.1 for encryption/decryption

    Ecodrone, I have also written a very basic and incomplete "library" based on the dcptst.ino code by Manitou. So far it seems to work when I use the same settings as the example function do_aes(); When I tried to explore some other options, like using a different kind of key such as OTP key or...
  29. V

    AES Encryption & Decryption on Teensy 4.x

    Hello guys, it's been a while... If I used the OTP key or Unique key options, which are factory defined, stored inside the processor, unchangeable and unreadable from software as far as I know (I do not have access to the security manual of the processor), would it be more secure? I ended up...
  30. V

    AES Encryption & Decryption on Teensy 4.x

    Thanks again, Paul! I will study this possibility and try to improve my current security scheme.
  31. V

    AES Encryption & Decryption on Teensy 4.x

    Thanks again, Paul! I've read the Teensy Code Security page some months ago and found the information really useful. I agree that a lockable Teensy would be the best option for me in this use case. Unfortunately, I already have a stock of standard non-lockable Teensy 4.1 bought in high quantity...
  32. V

    AES Encryption & Decryption on Teensy 4.x

    Thanks a lot defragster, Paul and manitol for the help! Paul, without a lockable Teensy (which is my case), would any encryption library be vulnerable to an attacker with a JTAG and access to the non-encrypted flash memory or it is just the case of dcptst.ino? The reason why I am using AES is...
  33. V

    AES Encryption & Decryption on Teensy 4.x

    I think https://github.com/manitou48/teensy4/blob/master/dcptst.ino was just a test that manitou48 performed, but it is not yet developed into a functional library. With time, I think that I might me able to convert this code to an easy to use lib. However, my use for the cryptography functions...
  34. V

    AES Encryption & Decryption on Teensy 4.x

    I am currently adapting a huge application which was originally developed on Teensy 3.5 to the newer Teensy 4.1 platform. So far, I was able to find a replacement for almost all the libraries which I used and were exclusive for Teensy 3.x. Unfortunately, I couldn't find an substitute to the...
  35. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Yep, I think not only malloc(), but also the other shared resources I was protecting with locks such as Serial, EEPROM, SD and the command queue don't need to be protected anymore, as one thread always starts and concludes the operation before the other starts. I have checked my code and there...
  36. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    I was using 5 ticks (5 ms) for the main thread and the comm thread. For the led blink thread I was using just one tick. I wasn't aware that the SPI and I2C communication was non-reentrant, so my reasoning for those short timeslices was that the user would feel more like it's three parallel...
  37. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Just an quick update. I currently have 3 different Teensy 3.5 running my full application (with huge slice times for each thread and the threads stack placed on the main thread's stack). No crashes or reboots yet! :)
  38. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Wow, we are following the same line of thought. That is exactly the thing I am trying today. I have set the time slices to 100000 milliseconds and used only yield() and delay() to switch context. The application with this modification has been running for 7 hours now and so far no problems. I...
  39. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    No problem! So, I am already testing this in my application and so far it is working. However, I am not confident about it yet. This is the full story: I have some occasional reboots in my application where the program is saved by the watchdog. Sometimes the code runs for two days in a row...
  40. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Also Joe, could you please tell which exact lines you commented out in the code from my post #51 which made not work at all? I have tried to reproduce in my code here, commented many different sections but the allocations were still working. Many thanks!
  41. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    The main thread 0 can send some commands to be executed on the comm thread 1, but not the other way around. In order to to this, I have created an thread safe command queue, with all operations protected by mutexes. The main thread (which generates the commands) can place new commands on the...
  42. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Sorry, I forgot to answer this. I use the main thread 0 (loop) to perform most of the operations needed such as data logging, mathematical computations, sensor data acquisition, SD card manipulation, USB command parsing, etc. Thread 1 is an communication thread. It works like an second loop...
  43. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Joe, sorry for the delay, I didn't have access to my Teensy and computer during the weekend. I was not able to reproduce the error mentioned by you when we check for stack corruption. I tried to comment out many different combinations of lines and none that I've tried seems to have crashed my...
  44. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Sure that the concurrent access to malloc() calls from multiple threads is a problem that should be addressed. However the main problem looks to be related to how malloc understands the RAM. From my testing, if I place the threads stacks inside the main thread stack (that is, above the heap)...
  45. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Hi Joe! The reply I am referring is the one where I end with Does this code also works for you? I stopped using printf as it seems to cause many problems and in my full code I have already started to use the arduino-printf library, which is malloc free. . This one doesn't use mutexes (for...
  46. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    That's correct. While I agree that it would be possible to just use malloc from the main thread, it would require drastic changes in my code because Strings are used. And sometimes when they grow in size, realloc() is used to create an bigger buffer on the heap. Nowadays, if I would rewrite the...
  47. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    That's another very interesting library I will definitively check. Once again, thanks Joe. I am already using the arduino-printf library which was your suggestion and so far it fits my code like a glove. Barely had to make any changes to the original code. Unfortunately, the biggest problem I...
  48. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Defragster, I tried to run the code with the modifications you mentioned in your last post (#48) and could also reproduce the behavior you have shown. Very weird. I have no idea what caused this. That's interesting. I modified my last code (post #46) to memset all allocated heap and also use...
  49. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Ok, so I was thinking about this: And came up with an crazy ideia that (at least in my testing) worked: What if all the threads stacks were above the top of the heap, like it is natural for a stack to be? What I did was to allocate the stack for the threads as an local (stack) buffer in the...
  50. V

    Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    I have tested all the codes posted previously but haven't had success in being able to reliably malloc() from any thread at any time, without needing to malloc() from the main thread in order to "unlock" the malloc to the other threads again. Just to confirm, did you happen to discover any way...
Back
Top