Forum Rule: Always post complete source code & details to reproduce any issue!

Search:

Type: Posts; User: VictorFS

Search: Search took 0.00 seconds.

  1. @KurtE and @defragster thanks for all the info! I...

    @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...
  2. Wow, I didn't know that it was possible. Thanks...

    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...
  3. @KurtE , first of all, thank you very much for...

    @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...
  4. Ecodrone, I have also written a very basic and...

    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();...
  5. Replies
    12
    Views
    416

    Hello guys, it's been a while... If I used...

    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...
  6. Replies
    12
    Views
    416

    Thanks again, Paul! I will study this possibility...

    Thanks again, Paul! I will study this possibility and try to improve my current security scheme.
  7. Replies
    12
    Views
    416

    Thanks again, Paul! I've read the Teensy Code...

    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....
  8. Replies
    12
    Views
    416

    Thanks a lot defragster, Paul and manitol for the...

    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...
  9. Replies
    12
    Views
    416

    I think...

    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...
  10. Replies
    12
    Views
    416

    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...
  11. Yep, I think not only malloc(), but also the...

    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...
  12. I was using 5 ticks (5 ms) for the main thread...

    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...
  13. Just an quick update. I currently have 3...

    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...
  14. Wow, we are following the same line of thought....

    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...
  15. No problem! So, I am already testing this in my...

    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...
  16. Also Joe, could you please tell which exact lines...

    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...
  17. The main thread 0 can send some commands to be...

    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...
  18. Sorry, I forgot to answer this. I use the main...

    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,...
  19. Joe, sorry for the delay, I didn't have access to...

    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...
  20. Sure that the concurrent access to malloc() calls...

    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...
  21. Hi Joe! The reply I am referring is the one where...

    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...
  22. That's correct. While I agree that it would be...

    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...
  23. That's another very interesting library I will...

    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...
  24. Defragster, I tried to run the code with the...

    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.

    ...
  25. Ok, so I was thinking about this: And came up...

    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...
  26. I have tested all the codes posted previously but...

    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...
  27. I don't understand. What do you mean by "nothing...

    I don't understand. What do you mean by "nothing magic"? In my testing, if I comment out the preliminary allocation from the main thread, it doesn't work. If I let it there, it works. Isn't it...
  28. One other thing I tested was to sometimes free...

    One other thing I tested was to sometimes free the heap space allocated by the threads and check if new allocations were able to use the empty spaces left on the heap. As far as I could see, it...
  29. Hello defragster and joepasquariello! I have...

    Hello defragster and joepasquariello!

    I have been experimenting with your codes and making some small modifications to try to isolate the problem and find the root cause. Thanks very much for your...
  30. Thanks again, defragster. I will test many allocs...

    Thanks again, defragster. I will test many allocs and frees from different threads and check the pointers to see where the memory is being allocated in the ram.
  31. You are correct! That's the exact same behavior I...

    You are correct! That's the exact same behavior I was noticing. In my case I have tested with only the main thread + 1 created thread. Sometimes the thread 1 is unable to allocate memory, but if the...
  32. Yes, TeensyThreads uses "new", which maps...

    Yes, TeensyThreads uses "new", which maps directly to malloc(). But there is also the option to provide an already existing buffer to serve as stack for the newly created thread. In my full code, I...
  33. Please correct me if I am wrong, but my...

    Please correct me if I am wrong, but my understanding is: the heap and the main thread stack are placed at opposite ends of the memory. The heap grows up and the stack grows down. We don't even know...
  34. One of the tests I performed was to provide...

    One of the tests I performed was to provide static (global) char buffers to the addThread function to use as the stack. It didn't change my results :(
  35. That's a very interesting take! So a "quick and...

    That's a very interesting take! So a "quick and dirty" workaround for the issue would be to allocate "X" bytes of RAM using malloc in the main thread before adding any new thread, which will...
  36. Exactly! I have performed some of those tests...

    Exactly! I have performed some of those tests myself and also couldn't find any clear relationship between the stack size of the threads and how many bytes could be allocated using malloc() inside...
  37. Mjs513, that's correct. The issue of memory...

    Mjs513, that's correct. The issue of memory leakage, calling malloc() without calling free() would crash the sketch anyway under any circumstance. My ideia was just to show that malloc() fails after...
  38. Thanks Joe! I will definitely give this library a...

    Thanks Joe! I will definitely give this library a try.. I think the whole code will benefit from it. Unfortunately, I will still need to use malloc() or new for things like Strings and objetc...
  39. HI Mark, thanks for the answer. I don't have...

    HI Mark, thanks for the answer. I don't have access to the code during the weekend, but I didn't change any compilation flags or settings, they are all default. I used platformIO and later installed...
  40. I was playing around with the code and was able...

    I was playing around with the code and was able to actually make the program crash with a much simpler code:



    #include <Arduino.h>
    #include "TeensyThreads.h"

    void thread_func()
    {
    ...
  41. Multiple issues using TeensyThreads on T3.5. Dynamic heap allocation problems.

    Hello all!

    I am recently started using the TeensyThreads library in order to have two different tasks working concurrently. Everything was working fine until I started using dynamic memory...
Results 1 to 41 of 41