Forum Rule: Always post complete source code & details to reproduce any issue!
Tab Content
  • luni's Avatar
    05-24-2023, 08:14 PM
    luni replied to a thread EncoderTool in General Discussion
    Sounds good. Thanks a lot for testing!
    46 replies | 3740 view(s)
  • luni's Avatar
    05-24-2023, 06:15 PM
    luni replied to a thread EncoderTool in General Discussion
    Should work with 1.58 out of the box. Thanks for testing
    46 replies | 3740 view(s)
  • luni's Avatar
    05-24-2023, 05:25 PM
    luni replied to a thread EncoderTool in General Discussion
    @clinker8 I need to fix an EncoderTool issue for the ESP32. To fix it, I need to touch the part of the code which generated the compile issue you had some months ago. Can I talk you into trying the code in the...
    46 replies | 3740 view(s)
  • luni's Avatar
    05-22-2023, 07:19 AM
    These encoders are just mechanical switches. If you can not pull the pin down, something is probably wrong with the encoder or your wiring. Here what I usually do in such cases...
    14 replies | 520 view(s)
  • luni's Avatar
    05-21-2023, 04:30 PM
    If you don't have a harsh environment, you can simply connect the C pin to GND and directly connect A/B to the Teensy. Just use pinmode(INPUT_PULLUP) for the pins. No need for resistors or capacitors. The quadrature...
    14 replies | 520 view(s)
  • luni's Avatar
    05-21-2023, 04:14 PM
    Actually you don't even need the surrounding struct you can directly put/get your array: #include <EEPROM.h> float focusCalib12]4]; void setup() { EEPROM.put(0, focusCalib); EEPROM.get(0, focusCalib);
    29 replies | 10965 view(s)
  • luni's Avatar
    05-18-2023, 11:33 AM
    Are you sure your USB cable is good for 480Mb/sec? Cheap/old cables may be certified for 12Mbit only
    2 replies | 92 view(s)
  • luni's Avatar
    05-14-2023, 02:20 AM
    Yes, but did you look at the memory consumption? Last time I tried it was some 300kB :-(
    84 replies | 4298 view(s)
  • luni's Avatar
    05-13-2023, 06:38 PM
    luni replied to a thread random() in General Discussion
    Seems to be the usual clash with the arduino #defines for abs, round etc. Try to #undef them. IIRC mjs513 already has a PR removing those #defines from the core Edit: Here it is:...
    12 replies | 291 view(s)
  • luni's Avatar
    05-13-2023, 04:55 PM
    luni replied to a thread random() in General Discussion
    Random returns uint32_t if its parameters are uint32_t. However, as you observed, it only returns values from 0 to 2^31. Same for the standard C "rand()" function. C++ provides much better random generators in its...
    12 replies | 291 view(s)
  • luni's Avatar
    05-08-2023, 10:33 AM
    Works here using IDE 2.1.0. Adds a folder "build" to the sketch folder which contains this: For small snippets I like the compiler explorer, it life-generates the asm while you type your c++ code. Here an...
    6 replies | 191 view(s)
  • luni's Avatar
    05-08-2023, 07:30 AM
    Would be good to add the same info to the IntervalTimer::update function which also accepts floats. You might also consider removing the leftover specialization of the update function (see PR701)
    7 replies | 234 view(s)
  • luni's Avatar
    05-04-2023, 02:41 PM
    luni replied to a thread Help with Coding in Project Guidance
    You declared your struct "testType" nested in the class TestHeader. This is OK but probably not what you want. If you want to access this type you need to fully qualify it. E.g. in Test.ino you need to write ...
    3 replies | 180 view(s)
  • luni's Avatar
    05-03-2023, 07:52 AM
    I have absolutely no stakes in it. I was just interested if Pauls statement from #2 is correct. If this behaviour of elapsedMillis should be fixed / documentend / ignored is another question which needs to be decided by...
    17 replies | 372 view(s)
  • luni's Avatar
    05-03-2023, 06:16 AM
    This is certainly a better definition than "something complicated" :-) But, even if I delcare stopwartch static, the println will trigger a reload of ms. Anyway, I think the example shows that elapsedMillis is not...
    17 replies | 372 view(s)
  • luni's Avatar
    05-03-2023, 05:02 AM
    I think Shawn is right. Below a simple example demonstrating the problem. A 1s timer is resetting the elapsedMillis variable `stopwatch` in its callback. In a tight loop the LED is switched on when the stopwatch value...
    17 replies | 372 view(s)
  • luni's Avatar
    04-25-2023, 03:49 PM
    Maybe another process opened the port and blocks it? Maybe you did open another uploader or Terminal and didn't close it, maybe some Zombie process? In those cases rebooting your PC should help. Does it upload after...
    24 replies | 669 view(s)
  • luni's Avatar
    04-24-2023, 07:32 AM
    This is what is autogenerated for a new Teensy (4.1) project. ; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags...
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 06:42 PM
    I stand corrected. As usual: "If nothing helps, read the fucking manual" :-) https://docs.platformio.org/en/latest/platforms/teensy.html#platform-teensy One doesn't need to directly set the compiler flags, there are...
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 06:17 PM
    @pr8x: Here (windows) <user>\.platformio\packages\framework-arduinoteensy you find board.txt. Once you understand the unusual file format you can easily find the required info
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 05:46 PM
    The problem is that PIO doesn't have such a menu. You can easily set compiler options but you need to know that e.g. -Os goes with -specs=nano-spec in teensyduino. Something like a translation of the tools menu to...
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 05:28 PM
    Glad it works now. Have fun
    3 replies | 176 view(s)
  • luni's Avatar
    04-23-2023, 05:24 PM
    There are two versions of the standard library for this toolchain: newlib and newlib-nano. specs=nano.specs switches to the nano version of the libray. There probably is a reason why teensyduino only uses newlib-nano...
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 04:42 PM
    Looks like you are using PIO? Did you also set "--specs=nano.specs"? Newlib nano is used by teensyduino if you choose smallest code.
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 04:35 PM
    They are set by default anyway.
    16 replies | 429 view(s)
  • luni's Avatar
    04-23-2023, 03:57 PM
    Here a prove of principle. It uses GPIO6_16- GPIO6-31 which are routed to teensy pins. Of course, if you want to output 5000 pulses at 500kHz the pulstrain will be 10 ms long which is borderline if you need a pulsetrain...
    10 replies | 221 view(s)
  • luni's Avatar
    04-23-2023, 01:56 PM
    Thanks, I can do a quick test, shouldn't be too difficult.
    10 replies | 221 view(s)
  • luni's Avatar
    04-23-2023, 01:46 PM
    Just to make sure: the trajectory planner will send you values of up to 5000 per 10ms per motor right?
    10 replies | 221 view(s)
  • luni's Avatar
    04-23-2023, 07:41 AM
    How many steps do you expect per 10ms interval from your motion planner? If it is not too much, you could simply send them to the controllers @700kHz in a 10ms periodic interrupt (or triggered by the arrival of a new...
    10 replies | 221 view(s)
  • luni's Avatar
    04-23-2023, 06:05 AM
    There is no need to do the encoder readout with your own code. There are a lot of proven libs around doing this for you. Here an example using the EncoderTool. The library allows to attach a callback function which will...
    3 replies | 176 view(s)
  • luni's Avatar
    04-21-2023, 11:37 AM
    I think I know what is going on here: Looks like you compiled with -DF_CPU=48000000 which worked. Then you just changed your makefile to -DF_CPU=72000000 and recompiled without a 'make clean'. Thus the core was not...
    3 replies | 124 view(s)
  • luni's Avatar
    04-21-2023, 09:07 AM
    I tested your your code and can not reproduce the effect. It generates a nice 10kHz signal with 25µs HIGH time for F_CPU = 48MHz, 72MHz and 96MHz
    3 replies | 124 view(s)
  • luni's Avatar
    04-20-2023, 12:55 PM
    Looks like those steppers have some unusual step pattern. Here a library to drive them: https://github.com/clearwater/SwitecX25. This lib is directly driving the motor (not step/dir). However, you probably need some...
    10 replies | 307 view(s)
  • luni's Avatar
    04-20-2023, 12:28 PM
    No, TeensyStep is not compatible with T4.x. Are you sure that your gauge has a stepper motor? Do you have a datasheet?
    10 replies | 307 view(s)
  • luni's Avatar
    04-20-2023, 11:12 AM
    I saw your PR. Wouldn't this PR eliminate Pauls macros completely? Probably a risky thing? Maybe just converting the macros to functions which shouldn't clash because the STL lives in the std:: namespace? Anyway, as...
    84 replies | 4298 view(s)
  • luni's Avatar
    04-20-2023, 08:06 AM
    As thebigg mentioned, the Arduino/Teensyduino #defines of standard functions (abs, round...) can mess up the standard library if STL headers are included after Arduino.h. It looks like the new toolchain (or the current...
    84 replies | 4298 view(s)
  • luni's Avatar
    04-19-2023, 11:00 AM
    Maybe this: https://forum.pjrc.com/threads/67520-RAWHID-demonstration-program helps?
    1 replies | 128 view(s)
  • luni's Avatar
    04-18-2023, 01:06 PM
    luni replied to a thread Teensy Qt in General Discussion
    IMHO PIO is pretty much THE current development system for embedded development. Installation is super simple, you'd install it from within vscode (it's just an extension to vscode). There should be plenty of...
    480 replies | 214349 view(s)
  • luni's Avatar
    04-18-2023, 05:34 AM
    Why do you think the waveform is not centralized already? If you imagine vertical lines through the centers on both LA pictures above you will see exactly what you have drawn? (of course after swapping 2/3) Starting...
    13 replies | 313 view(s)
  • luni's Avatar
    04-17-2023, 07:54 PM
    luni replied to a thread Teensy Qt in General Discussion
    Here is what I usually use in PIO. platform = teensy upload_command = C:\toolchain\TyTools\tyCommanderC upload $SOURCE --autostart --wait --multi extends =TeensyBase board = Teensy40
    480 replies | 214349 view(s)
  • luni's Avatar
    04-14-2023, 06:35 PM
    Unfortunately changing this to other means of identification (e.g. same USB Port) would be quite some rework. Reading/Writing to the serial port from a c# PC application is not really difficult. See here for...
    22 replies | 394 view(s)
  • luni's Avatar
    04-14-2023, 06:29 PM
    Paul could give a reliable answer, but I don't think you can change this. It is probably burnt in some read only memory. Couldn't you simply store your revision etc information in the EEPROM and send it on request to...
    22 replies | 394 view(s)
  • luni's Avatar
    04-14-2023, 06:21 PM
    Disclaimer: I didn't work on TeensySharp for years and I could be wrong. When TeensySharp reboots the board it triggers the process and then waits until a board with the same serialnumber but the halfkay PID appears...
    22 replies | 394 view(s)
  • luni's Avatar
    04-14-2023, 05:53 PM
    Your code does not compile (breakTime clashes with some function defined in the core) I renamed it to brkTime: IntervalTimer t1, t2; constexpr uint8_t pins4] = {0, 1, 2, 3}; void switchOn() { static...
    13 replies | 313 view(s)
  • luni's Avatar
    04-14-2023, 11:03 AM
    I tested it with 100kHz (@256MHz) with which is kind of borderline. Execution times get into the same order of magnitude as the delays so the duty cycle calculation need to be corrected.
    13 replies | 313 view(s)
  • luni's Avatar
    04-14-2023, 08:06 AM
    Using the PWM capabilites of the timers is of course the most elegant and precise method. If you just need a quick and dirty method you could use 2 IntervalTimers to generate the signal (fixed 0.25% phase shift). It is...
    13 replies | 313 view(s)
  • luni's Avatar
    04-14-2023, 06:15 AM
    This works here to distinguish a cold boot (power on boot) from a reset bool isWarmBoot() { static DMAMEM unsigned bootCheck; // DMAMEM is not zeroed during bootup if (bootCheck != 0xAAAA'AAAA) {...
    10 replies | 1083 view(s)
  • luni's Avatar
    04-13-2023, 09:02 AM
    Try to place above setup. This used to enable float scanf in the nanolib c-library
    3 replies | 141 view(s)
  • luni's Avatar
    04-10-2023, 01:13 PM
    For those not following the other thread here a link to some usage examples for the extended IntervalTimer interface: https://github.com/TeensyUser/doc/wiki/Using-the-new-callback-interface
    84 replies | 4298 view(s)
  • luni's Avatar
    04-09-2023, 09:36 AM
    luni replied to a thread c++17 in General Discussion
    Yes, that was exciting enough to get me out from under the mortar boxes :-)
    13 replies | 499 view(s)
  • luni's Avatar
    04-09-2023, 08:34 AM
    luni replied to a thread c++17 in General Discussion
    Thanks, didn't find much time for Teensy lately (renovating a (semi detached) house). Looks like I need to catch up :-)
    13 replies | 499 view(s)
  • luni's Avatar
    04-09-2023, 08:01 AM
    luni replied to a thread c++17 in General Discussion
    Thanks, didn't notice that there already is a 1.59 Beta-1
    13 replies | 499 view(s)
  • luni's Avatar
    04-09-2023, 06:37 AM
    luni started a thread c++17 in General Discussion
    @Paul: Do you intend to switch to c++ 17 (or higher) with 1.59? I thought 1.58 was already c++ 17 but looks like I only dreamed that :-)
    13 replies | 499 view(s)
  • luni's Avatar
    04-07-2023, 03:01 PM
    Just added examples for the more exotic uses (functors and non static member functions) https://github.com/TeensyUser/doc/wiki/Using-the-new-callback-interface Let me know if additional examples would help.
    100 replies | 6696 view(s)
  • luni's Avatar
    04-07-2023, 10:53 AM
    I added a first draft of an example page to the WIKI https://github.com/TeensyUser/doc/wiki/Using-the-new-callback-interface (It is stored under the how-to section) Let me know if someone is interested in an example...
    100 replies | 6696 view(s)
  • luni's Avatar
    04-07-2023, 05:49 AM
    Updated TeensyStep to v2.3.3 which should fix the error. Let me know if it compiles now
    26 replies | 871 view(s)
  • luni's Avatar
    04-07-2023, 05:02 AM
    Weird, did exactly the same (well I cloned the core instead of copying). Only difference seem to be Linux/Windows. Maybe some subtle difference in the sequence of system includes? Anyway, works now and this is no...
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 07:18 PM
    But this is clearly TeensyStep errors not generated by your empty sketch. You probably still have TeensyStep in the dependencies so it tries to compilie and runs into the error. I'll fix it tomorrow (to tired today)
    26 replies | 871 view(s)
  • luni's Avatar
    04-06-2023, 07:11 PM
    Can you post the corresponding error?
    26 replies | 871 view(s)
  • luni's Avatar
    04-06-2023, 07:00 PM
    Did it hit TeensyStep now? I'll fix this, reason usually is that Arduino #defines abs which messes up code which uses things like std::abs. Depends on the exact include sequence.
    26 replies | 871 view(s)
  • luni's Avatar
    04-06-2023, 04:26 PM
    Thanks a lot. Looks good, I'll include it in the new WIKI page where I will combine the examples from the pages I linked above and and rewrite them for the IntervalTimer.
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 04:13 PM
    No, doesn't compile with IDE 2.04 for a T3.6. including <cstddef> fixes it
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 04:03 PM
    Definitely doesn't compile here (VisualTeensy) with the same error messages as Kurt sees. Try to clone the core to an IDE installation now to see if this makes a difference...
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 03:01 PM
    Wow, isnt finding bugs the very reason to publish a beta version? @Paul, for some reason the T3 core misses an include of <cstddef> or if you prefer <stddef.h> before including inplace_function.h. If I add #include...
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 01:07 PM
    inplace_function is just a name for one specific implementation of a std::function replacement which doesnt allocate memory on the heap. So, you won't find much if you search for inplace_function. You'd need to search...
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 07:56 AM
    BTW: Your questions are more related to lambda expressions. Using lambdas as callbacks is just one of the possibilities you now have to attach callbacks. Anyway, You can choose in the capturing expression. If...
    100 replies | 6696 view(s)
  • luni's Avatar
    04-06-2023, 06:00 AM
    Yes, I this might be a good idea. Probably the wiki would be a good idea to collect those examples? Here something simple which would be complicated to write with the traditional function pointer interface: ...
    100 replies | 6696 view(s)
No More Results
About luni

Basic Information

Age
58
About luni
Location:
Germany

Statistics


Total Posts
Total Posts
2,056
Posts Per Day
0.62
Last Post
EncoderTool 05-24-2023 08:14 PM
General Information
Join Date
04-27-2014