luni
Reaction score
14

Latest activity Postings About

    • luni
      If you switch the standard library from the default newlib to newlib-nano your size difference shrinks down to a few 100 bytes. Here some info about the two versions of the standard library...
    • luni
      I recently stumbled over std::optional which comes in handy for such situations. Of course, changing an already published API is a no-go, but std::optional seems to be a nice tool for the toolbox... #include <optional> std::optional<unsigned>...
    • luni
      luni replied to the thread Very high code RAM usage.
      Instead of SMALLEST_CODE you could also try to add --specs=nano.specs which will switch to newlib-nano (same as SMALLEST_CODE does) but keeps the optimization level.
    • luni
      luni replied to the thread Very high code RAM usage.
      Looks like you don't compile for gnu++17. Make sure -std=gnu++17 is set in your build options
    • luni
      You are right of course. To be on the save side one should use DMAMEM alignas(A) uint8_t buf[sizeof (A)]; // statically allocate memory for an object of type A to allocate the buffer.
    • luni
      Here a quick test which shows that the compiler relys on initialization during startup. class A { public: int i = 42; const int c = 17; void print() { Serial.printf("i=%d &i=%p\n", i, &i); Serial.printf("c=%d...
    • luni
      luni replied to the thread Help with Teensy Loader.
      I have successfully worked on a proof of concept to upload ehex files with TeensySharp. However, I haven't integrated it into the library yet. Anyway, the purpose of TeensySharp is to allow users to integrate Teensy detection and firmware upload...
    • luni
      Actually isPressed() returns the debounced state of the button. So, replacing pressed() by isPressed() in @japreja s code should work. Here an example showing the behaviour of isPressed() #include "Bounce2.h" Button b1; void setup() {...
      • 1708066844442.png
    • luni
      luni replied to the thread Lightweight C++ callbacks.
      Thanks, I'll fix that. However, CallbackHelper was just an experiment to understand how those things work. Please note that since the new TD1.59, the core contains teensy::Inplace_function which is a much better solution.
    • luni
      luni replied to the thread Encoder Tester.
      Thanks for spotting this. I'll have a look
    • luni
      You can't. For frequency measurements see here: https://www.pjrc.com/teensy/td_libs_FreqCount.htm For pulse height you need to use analogRead, but that will be difficult if you have short pulses For pulse width see here...
    • luni
      Paul gave you the link to the documentation of the library in #13 above. It contains all information how to use it. However, it does not contain a "simple list of commands". I can give you examples if you tell us what you want to achieve with...
    • luni
      You didn't specify how precice you need that pulse. If you only need something roughly 10ns you can use the following code. It will generate a pulse of about 13ns every 50ms. IntervalTimer timer; void pulse() { digitalWriteFast(0,HIGH)...
    • luni
      luni replied to the thread using DMAMEM.
      Technically you'd put the objects in DMAMEM, not the class. Here an example: c1 lives in ITCM, c2 lives in DMAMEM and c3 in FLASHMEM class myClass { public: unsigned i = 42; }; myClass c1; DMAMEM myClass c2; FLASHMEM const myClass c3; void...
    • luni
      luni replied to the thread WebUSB on teensy.
      I just gave WebSerial a try. This is also very simple to use: Here a simple test web page: <!DOCTYPE html> <html> <head> <title>Page Title2</title> </head> <body> <h1>WebSerial Tester</h1> <button type="button"...
      • 1707060105643.png
    • luni
      luni replied to the thread WebUSB on teensy.
      @PaulS, Maybe I didn't understand this correctly, but I always thought WebUSB is a low level API where you directly communicate to endpoints / interfaces etc. Thus, wouldn't you need a corresponding driver on the Teensy side to make this work...
    • luni
      Actully accelstepper::run() is not very expensive and the T4.1 processor is quite fast. Here a simple test which moves 4 steppers with random parameters. tick() calls the run() functions of the steppers in a timer interrupt every 100µs. During...
      • 1707038076195.png
    • luni
      Did you try to simply call the accelstepper::run() functions from a timer interrupt?
    • luni
      luni replied to the thread WebUSB on teensy.
      In case WebHID is sufficient: I did try it some time ago, it worked nicely with minimal code: https://forum.pjrc.com/index.php?threads/making-webusb-work-with-the-teensy-what-is-pluggableusb.60782/post-247184. I just tried it, it still compiles...
    • luni
      If resetting the device would do what you need, you could use tyCommander:
      • 1706877386304.png
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      Yes, I'll never understand why the Arduino IDE doesn't have a simple "clean all". Anyway, the note is issued during compiling, not linking. So, in this case forcing a rebuild doesn't help.
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      I can reproduce that with @PaulStoffregen s code. I also saw that the warning/note is generated by the compiler, not the linker. So, opposed to what was written in the StackOverflow link it doesn't help doing a clean recompile. Anyway, you can...
    • luni
      If you post the hex file I can try to reproduce the issue.
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      The warning seems to be about linking code compiled with an older compiler to code compiled with a newer compiler. See here for details: https://stackoverflow.com/a/48149400/1842762. Are you sure that you are doing a clean rebuild? Are you...
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      There still is a leftover from the old code in intervaltimer.h: https://github.com/PaulStoffregen/cores/blob/c5e716375532ae0d8b912d7034707c0859b68801/teensy4/IntervalTimer.h#L73C2-L78C3 here the corresponding PR...
    • luni
      Registering an interrupt service routine (ISR) is usually done by storing its address in a table (often called the "vector table"). The IntervalTimer.begin() function does this for you. If an interrupt wtih number n occurs, the processor...
    • luni
      @cmarcus: Here you can experiment: https://godbolt.org/z/djMe46bj1 As mentioned above, signed integers generate much more code than an unsigned version
    • luni
      Couple of years ago I did a lot of experiments with high speed data transfer over usb serial. It turned out that on Win10 you can stably transfer some 10MByte/sec from a Teensy to a dotNet (C#) application. However, there is a known bug in the...
    • luni
      What happens if you remove the serial.print from loop()?
    • luni
      Can't you simply call the accelstepper run function from a timer interrupt?
    • luni
      luni reacted to David C's post in the thread GCC 11 with Like Like.
      Yes. However, a factory fresh Teensy has EEPROM values set to 255 and it copes with that. The problem occurs on a Teensy which has been fine, and is fine when programmed with code from GCC5.3. So I'm not sceptical that correcting all the...
    • luni
      luni replied to the thread GCC 11.
      Some time ago there was a discussion in the forum about a very similar issue when an if clause checking the return value of new was not called correctly. Here the corresponding code void setup() { while (!Serial); void *p = new byte[1024 *...
    • luni
      luni replied to the thread GCC 11.
      Here a very simple method to check if something is eating up too much stack. https://forum.pjrc.com/index.php?threads/teensy-4-1-cannot-make-use-of-free-memory-resulting-in-fw-crash.73203/#post-328880 Anyway, seems to be an interesting issue...
    • luni
      luni replied to the thread New Stepper Motor Library.
      Usually you would use a *HCT since the input levels are better suited for a 3.3V controller output. But, the output rating of a HC/HCT chip is a bit borderline. Your driver is specd for typically 10mA (max 16mA) input current (probably a...
    • luni
      luni replied to the thread New Stepper Motor Library.
      Thanks for the datasheet. Looks like you are right. Currently TeensyStep4 has the pulse polarity hardcoded, so I see 2 possibilities You'll need a level shifter anyway since the driver requires >3.5V logic level. So, using an inverting shifter...
    • luni
      luni replied to the thread New Stepper Motor Library.
      Are you sure that the DM805 needs a falling edge? This would be very unusual for Leadshine. Can you post a datasheet?
    • luni
      Here a minimal example: void setup(){ } void loop(){ time_t time = rtc_get(); // read the current time from the RTC Serial.print(ctime(&time)); // convert time_t to readable string and print out delay(1000); } which prints: Sat...
    • luni
      Use Serial.print((char)Serial.read()); to see the characters
    • luni
      luni replied to the thread Very high code RAM usage.
      However, you can enable it by placing asm(".global _printf_float"); into setup()
    • luni
      What do you mean by "gather variables"? If you want to access class member variables from outside you can either make them public (not recommended) or write a 'getter' and/or a 'setter' function. The advantage of this approach is that you can...
    • luni
      luni reacted to SteveSFX's post in the thread Advice on program construction - DMX with Like Like.
      I'm merrily pasting tat on here.... but hey ho. I have got classes working. Moved some of my code out of my main ino file. How do I retrieve variables I gather within a class and bring them back to the main ino code?
    • luni
      It probably runs on yield. e.g. after loop or while delay or other long running functions are spinning, or whenever you call yield in your code. But yes, this is not an interrupt.
    • luni
      See #8
    • luni
      I'm not very fluent in python. So, I wonder if this is really programming the boards in parallel or one after the other?
    • luni
      Neither did I. So I did a quick test with USB-Serial which works nicely. Might come in handy sometime... void serialEvent() // do your parsing here { char c = Serial.read(); // do something with the character if(c == '1') {...
    • luni
      BTW: for easy installation the library can be found on nuget. Documentation is a bit out of date but the examples in the gitHub repo should show how to use it. https://www.nuget.org/packages/lunOptics.libTeensySharp/1.0.1?_src=template
    • luni
      If you are using windows you can use TeensySharp for such things. I did a quick proof of principle using this c# script: using libTeensySharp; var watcher = new TeensyWatcher(); // provides a list of connected Teensies foreach (var teensy in...
    • luni
      luni replied to the thread TeensyTimerTool.
      You can set the priority directly using the NVIC. Note that the priority can only be set for a complete timer module, not for the individual channels of a module. For example, if you set the priority of the TMR2 module, all 4 channels of this...
  • Loading…
  • Loading…
Back
Top