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

Search:

Type: Posts; User: luni

Page 1 of 10 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    21
    Views
    940

    1.3Mb is quite large, but lets see... I'll be...

    1.3Mb is quite large, but lets see...
    I'll be traveling tomorrow but I can have a look on Thursday
  2. Replies
    21
    Views
    940

    Thanks for the input Kurt, but the 0x6000000...

    Thanks for the input Kurt, but the 0x6000000 issue was the first I stumbled over when I extended the code for the T4 :-) So that should work. Anyway, should be easy to fix as soon as the hex file is...
  3. Replies
    21
    Views
    940

    Can you post the hex file which shows the problem?

    Can you post the hex file which shows the problem?
  4. Replies
    16
    Views
    497

    Reserve returns false if it can't reserve. So...

    Reserve returns false if it can't reserve. So just check the return value...



    No, reserve uses malloc which can not throw....
  5. He, he, that's cool indeed. Thanks for checking. ...

    He, he, that's cool indeed. Thanks for checking.
    So, still the same conclusion right? If you want to check for out of memory condition use new(std::nothrow).
  6. I wouldn't call it a bug. Actually, I expected...

    I wouldn't call it a bug. Actually, I expected the crash since new is supposed to throw a bad_alloc exception which clashes with the fact that the sketch is compiled with -fno-exceptions (which is...
  7. Allocating memory with 'new', new(std::nothrow), testing -fcheck-new

    Triggered by this https://forum.pjrc.com/threads/68201-Is-using-a-quot-String-quot-still-a-bad-idea?p=288694&viewfull=1#post288694 I was doing a few experiments with detecting out of memory...
  8. Replies
    16
    Views
    497

    Yes this can be confusing. Maybe it is possible...

    Yes this can be confusing. Maybe it is possible to change the default behavior somehow? Need to goolgle this on a rainy Sunday afternoon...
  9. Replies
    16
    Views
    497

    I'm confused ?!? What do you expect that this...

    I'm confused ?!? What do you expect that this code should do? You are allocating memory in loop without ever releasing it and not checking if the allocation was successful. Since the Teensy doesn't...
  10. Replies
    11
    Views
    859

    . No deep deep thought behind that. I'm just used...

    . No deep deep thought behind that. I'm just used to pass structs by address into functions. Passing by reference would work the same of course. (and, probably the real reason: on a german keypboard...
  11. Replies
    11
    Views
    859

    As you also suspect, this sounds like an error...

    As you also suspect, this sounds like an error somewhere else. Just to exclude some unknowns, here a version which doesn't use the chrono clocks at all. It simply reads out the RTC, calculates...
  12. Replies
    11
    Views
    859

    There is a lot of template magic but AFAIK no...

    There is a lot of template magic but AFAIK no pointer magic. TimePoint::now simply returns a 'duration value' which consists of the value of the RTC counter (number of crystal periods) multiplied...
  13. That's definitely correct, thanks for spotting...

    That's definitely correct, thanks for spotting it. Without volatile, the compiler can assume that nothing was ever written to 'count' and could optimize the reading in 'println(count)' away. In this...
  14. You need to google for "lambda expression". They...

    You need to google for "lambda expression". They come in handy for such short functions and usually give the compiler more optimizing options (if you call a function through a function pointer the...
  15. I was interested if the T4 is able to count 10ns...

    I was interested if the T4 is able to count 10ns pulses. According to the measurements shown here: https://forum.pjrc.com/threads/57185-Teensy-4-0-Bitbang-FAST?p=212248&viewfull=1#post212248 a simple...
  16. Looks like you are interested in this stuff :-)...

    Looks like you are interested in this stuff :-) Here some code which utilizes the seldom used RTC interrupt to update it every second....
  17. That's true of course. The snippet defragster...

    That's true of course. The snippet defragster copied is from a software timer where this is called from yield() so this shouldn't be a problem (if the timer isn't ticked much faster the whole...
  18. Maybe I'm over cautious but one never knows what...

    Maybe I'm over cautious but one never knows what spikes are on such signals. I'd rather destroy a cheap buffer than the expensive controller.


    I'd simply count the pulses for a start. I don't...
  19. No, I'd stick with the step controllers, that...

    No, I'd stick with the step controllers, that ensures that you end up with the right position. Just precalc the speed of each motor that they reach their target at the same time.


    Yes, as soon...
  20. Sounds interesting indeed. Your detector...

    Sounds interesting indeed. Your detector generates 50ns pulses which should be long enough to trigger a pin interrupt. Voltage ranges also look OK. I'd consider to not directly connect the teensy to...
  21. Hm, that was not what I meant. I was interested...

    Hm, that was not what I meant. I was interested in a minimal example. Anyway, I extracted the info I needed from your huge sketch and did this:



    #include <TeensyStep.h> // library for...
  22. Can you please post a full sketch including the...

    Can you please post a full sketch including the setup of the controller and the steppers?
  23. Replies
    8
    Views
    267

    Here the float version. Just realized that you...

    Here the float version. Just realized that you only need the lower 32bit of the counter which simplifies it even more:




    void setup()
    {
    while (!Serial) {}
    pinMode(0, HIGH);
    }
  24. Replies
    8
    Views
    267

    AFAIK the built in RTC can only generate...

    AFAIK the built in RTC can only generate interrupts at 1s, 1/2s, 1/4s.... so that wont help. But you can easily read out the RTC clock period counter and use this for your timing:

    Here an...
  25. Replies
    68
    Views
    1,704

    Disclaimer: If I'm not a sleepwalker somebody...

    Disclaimer: If I'm not a sleepwalker somebody else must have said that :-)
  26. Makes a lot of sense. Tested your additions,...

    Makes a lot of sense.

    Tested your additions, works fine for me.
  27. Adding this: template bool...

    Adding this:


    template<typename T>
    bool write(T b){
    static_assert(std::is_trivially_copyable<T>::value,"You can not write this type to File" );
    return File::write(&b, sizeof(b));
    }

    to...
  28. Replies
    16
    Views
    343

    Yes, and people are stumbling over it:...

    Yes, and people are stumbling over it: https://arduino.stackexchange.com/questions/81253/teensy4-1-with-2x-8mb-psram-chips-external-psram-size-0-but-extmem-char-works/81271#81271

    He tested this in...
  29. Much better now but it still has ambiguity issues...

    Much better now but it still has ambiguity issues when writing single integral types. Looks like a lot of additional write(xxx) overloads are required. Maybe a templated approach might work without...
  30. @Frank: I'd say if you have a function intended...

    @Frank: I'd say if you have a function intended to write c-strings it should terminate them with a \0. But I'm more concerned with the non working write('\0') and the problem reusing the File...
  31. IMHO, this datalogger example is doing too much...

    IMHO, this datalogger example is doing too much for debugging. I therefore did a very simple test sketch which works in principle:



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

    void...
  32. Something is wrong with the file pointer...

    Something is wrong with the file pointer maintained in the littlefs file class. Looks like it gets set correctly on opening a file. But when you try to write the file the pointer is null so it never...
  33. Not even copy paste, I wrote it simply down which...

    Not even copy paste, I wrote it simply down which will ALWAYS be wrong :-) Thanks for spotting.

    After adding your fixes from above this example seems to work. At least it pretends to write...
  34. Tried the same example In FS.h class File ...

    Tried the same example

    In FS.h class File


    operator bool() {
    return (f) ? (bool)*f : false;
    }

    seems to be a left over from the union thing ?
  35. I gave that a try. I cloned LittleFS from...

    I gave that a try. I cloned LittleFS from https://github.com/PaulStoffregen/LittleFS, changed File to FileImpl in the class declaration, removed Stream from the inheritance list and commented using...
  36. Frank, I think we are taking past each other....

    Frank, I think we are taking past each other. IMHO your implementation of MemFile is a valid implementation of File, it provides all methods it needs to provide. I can write a function which takes a...
  37. Because then you can write code which just takes...

    Because then you can write code which just takes a 'File' and does not depend on the actual implementation of this file?
    Here a funny to read stackoverflow answer on this topic:...
  38. Not necessarily. As you wrote elsewhere the API...

    Not necessarily. As you wrote elsewhere the API of the File class is pretty well defined and users expect a 'File' to have exactly this interface. So I'd make the methods required by the interface...
  39. I played a bit with the code from FS.h and agree...

    I played a bit with the code from FS.h and agree with Paul that separating the File class in an abstract interface (class FileAPI) and the File class is a good idea. The 'new' file class then only...
  40. Here we say "buy cheap and you'll buy twice" ;-)...

    Here we say "buy cheap and you'll buy twice" ;-)

    Anyway, sounds like an interesting problem. For the fun of it I can try to work out an alternative solution for discussion. Any (non obvious)...
  41. I'm probably missing something here but, if...

    I'm probably missing something here but, if derived classes must override all virtual functions, couldn't you simply define them as pure virtual in the base class?
    I.e.:


    class myBase
    {
    ...
  42. Replies
    11
    Views
    859

    Couldn't you simply print the timestamp to the...

    Couldn't you simply print the timestamp to the sermon before copying it to the message? This would show you if the problems come from your generation algorithm or some later stage.
  43. Replies
    11
    Views
    859

    Addendum: You can also directly use the RTC...

    Addendum:
    You can also directly use the RTC values to feed the predefined chrono::system_clock. To use the system_clock on a controller all you need to do is overriding the system_clock::now()...
  44. Replies
    11
    Views
    859

    I can't help you with the ms readout of the RTC...

    I can't help you with the ms readout of the RTC registers but, some months ago I investigated the possibilities of the new (c++11) std::chrono facility of c++. For fun I implemented a std::chrono...
  45. Thread: TeensyTimerTool

    by luni
    Replies
    294
    Views
    28,487

    Just for fun, a very quickly hacked version using...

    Just for fun, a very quickly hacked version using a PIT directly. This gives rock solid 40kHz pulses and no jitter. Let me know if you need explanations...



    #include "Arduino.h"
    ...
  46. Thread: TeensyTimerTool

    by luni
    Replies
    294
    Views
    28,487

    The FTMs are a bit tricky since the 8 channels...

    The FTMs are a bit tricky since the 8 channels share one timer. In the ISR the TimerTool adds the channel reload value to the current counter which of course takes some time so that the actual period...
  47. Yes, it's a pity. This event stuff can come in...

    Yes, it's a pity. This event stuff can come in handy from time to time but without any (findable?) documentation it is hard to use.
  48. If you simply want to call something at regular...

    If you simply want to call something at regular intervals but not from an interrupt context you can also use the TeensyTimerTool. In addition to hardware timers it provides software timers (TCK)...
  49. I never understood how event responder is...

    I never understood how event responder is supposed to work (didn't find any documentation on this feature). But I definitely know that yield is also called by delay while it spins. So, even if you...
  50. Thread: TeensyTimerTool

    by luni
    Replies
    294
    Views
    28,487

    Just saw that you switched to a T4. The only...

    Just saw that you switched to a T4. The only thing you need to change in the code above is to use TMR4 instead of FTM0. Reducing the prescaler is also suggested. I.e., change it from PSC_128 to...
Results 1 to 50 of 500
Page 1 of 10 1 2 3 4