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

Search:

Type: Posts; User: joepasquariello

Page 1 of 10 1 2 3 4

Search: Search took 0.01 seconds.

  1. malloc() will report that no memory is available...

    malloc() will report that no memory is available if the requested allocation will collide with the stack, as defined by the value of the stack pointer at the time of the call to malloc(). With...
  2. Yes, many pitfalls. It seems like dynamic...

    Yes, many pitfalls. It seems like dynamic allocation will work only if it is limited to the main thread, where the stack pointer is the system stack pointer. Probably a good idea to also limit...
  3. malloc() works as expected in the main thread...

    malloc() works as expected in the main thread (loop), but not in the thread created via addThread(). Something to do with that thread's stack having been allocated from the heap?
  4. I also ran the code on 3.5 and got the error. If...

    I also ran the code on 3.5 and got the error. If I move the malloc() code from the thread function to loop(), it runs okay there until memory is exhausted, so there is something about how threads and...
  5. I think I began using the library below to reduce...

    I think I began using the library below to reduce code size associated with printf(), but the documentation makes a point to that it is not only small, but also thread-safe and does not use malloc()....
  6. Useful doc, thanks.

    Useful doc, thanks.
  7. Replies
    9
    Views
    147

    Others know more about this than me, but I think...

    Others know more about this than me, but I think the short answer is the T4 processor is a lot more complex than the one on UNO or DUE. See section 28.2 of the processor reference manual for a...
  8. Replies
    352
    Views
    59,323

    @luni, it looks to me like the new setPeriod() in...

    @luni, it looks to me like the new setPeriod() in your fixFTM branch will do what you want. Because you have FTMEN=0 in the FTMx_MODE registers, and you are using output compare, writes to the CV...
  9. Replies
    352
    Views
    59,323

    I checked the source code, and it looks like...

    I checked the source code, and it looks like setPeriod() is not implemented for FTM, so that may explain why that function is not doing what you want. It looks like t1.trigger() will do what you...
  10. Replies
    352
    Views
    59,323

    With a PeriodicTimer, the timer starts when you...

    With a PeriodicTimer, the timer starts when you call begin(), so you could call t1.begin() in the hw_interrupt function instead of in setup(), and then stop the timer after 10 calls to...
  11. I think that's a good idea. Nice to have the...

    I think that's a good idea. Nice to have the option of using the stable IDE 1.x, but get the faster build times, while IDE 2.0 is maturing.
  12. Installed IDE 2.0 for the first time last week...

    Installed IDE 2.0 for the first time last week (rc9) on Windows 7 64-bit. Today when I started IDE 2.0, it notified me that rc9.1 was available. Download/install was fully automatic, so that was...
  13. Replies
    57
    Views
    778

    You're welcome. Yes, it seems a good idea to be...

    You're welcome. Yes, it seems a good idea to be able to modify the output pulse width and also to be able to reinitialize the input period measurement. In this case we can do that with a single...
  14. Replies
    57
    Views
    778

    Hi Biff. Here's an update that does a couple of...

    Hi Biff. Here's an update that does a couple of new things. It processes serial input from the Arduino console and looks for valid numerical characters. When newline is found (user hits enter), the...
  15. Not sure if one is preferred. Either should work....

    Not sure if one is preferred. Either should work.



    memset() is a standard library function, defined as shown below. The address (s) is type void*, value (c) is type int, and size (n) is size_t...
  16. Thanks very much for the info. I've seen...

    Thanks very much for the info. I've seen preallocation mentioned in that other thread, so I'll have to read about it. Good luck at Salt Lake, and let us know how it goes.
  17. Replies
    57
    Views
    778

    You're welcome. I was kinda glad to have a reason...

    You're welcome. I was kinda glad to have a reason to understand the FTM module better. The way that I ended up doing it is not obvious in looking at the code. FTM0 ch4 (pin 6) does input capture on...
  18. Thanks for the insights. Just a great application...

    Thanks for the insights. Just a great application and must be a lot of fun to see it all work. There are some recent threads discussing best practice for SD logging, and that's something I need to do...
  19. Replies
    57
    Views
    778

    Please try this one. I might have been in the...

    Please try this one. I might have been in the middle of a change when I did my last copy/paste. I confirmed that this builds for T3.2, though I'm testing on T3.5


    ...
  20. Replies
    57
    Views
    778

    Okay. Try this one, which (I think) sync's the...

    Okay. Try this one, which (I think) sync's the output pulse on each rising edge of the input. However, if you do single triggers, you will likely get output pulses in between your input pulses. This...
  21. Replies
    57
    Views
    778

    @Biff, I figured out how to use the COMBINE mode...

    @Biff, I figured out how to use the COMBINE mode PWM on two FTM channels to generate the output signal without interrupts. The code below does that, and you can set the output width from 1% (or even...
  22. Very cool. Can you tell us a little about the...

    Very cool. Can you tell us a little about the hardware and software? I'm curious what is the control frequency, how many analog I/O, whether you are using on-board ADC or external, etc.
  23. Replies
    57
    Views
    778

    I'm guessing that's because you're really close...

    I'm guessing that's because you're really close to the boundary between OK and too short. I'm not sure exactly what variables exist from one run to the next, but I do think it's possible that the...
  24. Replies
    57
    Views
    778

    [QUOTE=Biff;309883]@joe, trying the 5% duty cycle...

    [QUOTE=Biff;309883]@joe, trying the 5% duty cycle works well at 50 kHz (see first figure below). But if I increase the frequency to 55 kHz, the duty cycle breaks, and becomes closer to 100% (see...
  25. Replies
    57
    Views
    778

    @Biff, glad that's working for you. The method I...

    @Biff, glad that's working for you. The method I had hoped to get down to 2% on the output was to use the COMBINE feature to couple together two FTM channels to produce both the rising and falling...
  26. Replies
    57
    Views
    778

    Here's a bug fix for the version that uses FTM...

    Here's a bug fix for the version that uses FTM input capture and output compare. The fix is that variable "input_period" must be 16-bit unsigned to avoid error on roll-over of the 16-bit FTM counter....
  27. Replies
    57
    Views
    778

    Updated version w/ more and better comments and...

    Updated version w/ more and better comments and elimination of a few "magic number" constants. Use variable "output_width_pct" to set output width as % of input period.

    EDIT: On further reading of...
  28. Replies
    57
    Views
    778

    Here is a program that does what you want, as I...

    Here is a program that does what you want, as I understand it. It uses 3 pins

    - pin 3 is 50 kHz PWM to simulate the 50 kHz input signal
    - pin 9 is the input signal (FTM0 ch2) and does input...
  29. Replies
    57
    Views
    778

    That helps. Tomorrow I'll take a shot at using...

    That helps. Tomorrow I'll take a shot at using FTM for both input (input capture on rising edge only) and output (output compare for rising/falling edges of output). We should only need the rising...
  30. Replies
    57
    Views
    778

    You said previously that the output rising edge...

    You said previously that the output rising edge could be at the same time or soon after the input rising edge. And now you're saying the output pulse width depends on something other than the input...
  31. https://github.com/mjs513/NewPing_t4

    https://github.com/mjs513/NewPing_t4
  32. Replies
    57
    Views
    778

    I take your sentence above to mean that the...

    I take your sentence above to mean that the RISING edge of the output pulse can start "any time after the (rising edge of the) input pulse". Can you say something about the requirements for the...
  33. Replies
    57
    Views
    778

    FreqMeasureMulti can definitely be used to...

    FreqMeasureMulti can definitely be used to measure the period and high time of the input pulse, but unless you modify the library, there is no hook into the rising/falling edge ISRs. If you brought...
  34. The frequency and high time of any PWM signal is...

    The frequency and high time of any PWM signal is based on a clock frequency. In the case of T4.0, the clock frequency of the PWM module is F_CPU/4, so for your F_CPU=528MHz, the PWM clock frequency...
  35. There have been a number of posts lately where...

    There have been a number of posts lately where anti-virus software was getting in the way. Can you turn off your AV and try again?
  36. It's complex enough that I would try simplifying...

    It's complex enough that I would try simplifying the program to either identify the source or eliminating some of the stuff. Since nobody is going to have your board or sensors, try taking out all of...
  37. Replies
    57
    Views
    778

    I had to read your last sentence a few times, but...

    I had to read your last sentence a few times, but now I get it, and yes, I think that's a good idea. The OP didn't say there was a specified delay from rising edge of input to rising edge of output,...
  38. Replies
    57
    Views
    778

    The method we've been trying is the best I can...

    The method we've been trying is the best I can think of that doesn't involve developing any low-level code. If it needs to be better, I would want to get away from the digital input interrupt and use...
  39. Replies
    57
    Views
    778

    Hi Kurt. Just a note that my comment in the line...

    Hi Kurt. Just a note that my comment in the line that defines PWM_FREQUENCY is incorrect. 50 kHz signal has a period of only 20 us, not 200 us. According to the OP's spec, the output pulse must have...
  40. Replies
    57
    Views
    778

    And here's one more update that (I think) sets...

    And here's one more update that (I think) sets the priority of the OneShotTimer to 0, which should further reduce the jitter.



    #include "TeensyTimerTool.h"

    #define PWM_SIGNAL_PIN (3) // must...
  41. Replies
    57
    Views
    778

    Here's an update with additional code in setup()...

    Here's an update with additional code in setup() to increase the priority of the digital input interrupt to 0 (highest). This should help reduce variability in the measurement of the input pulse...
  42. Replies
    57
    Views
    778

    That is much better, though. There is only a...

    That is much better, though. There is only a little jitter in the start of the output pulse relative to the input pulse, and more jitter (variation) in the length of the output pulse. I think this is...
  43. long values are 32 bits. Signed long values have...

    long values are 32 bits. Signed long values have range -2147483648 to +2147483647. If you keep adding negative numbers, your sum will eventually roll over to the positive range, and if you add...
  44. Replies
    57
    Views
    778

    Oh, yes, good point. The digital input and timer...

    Oh, yes, good point. The digital input and timer interrupts shouldn't coincide, but I forgot about systick. I know how to raise the priority of the digital input interrupt, but I'll have to look into...
  45. Replies
    57
    Views
    778

    Thanks for those reminders, Paul. Here's an...

    Thanks for those reminders, Paul. Here's an update with FASTRUN for the interrupt routines and the Serial.printf() statements commented out. I left the interrupts at their default priorities for now,...
  46. Replies
    57
    Views
    778

    There is going to be some jitter, and it's going...

    There is going to be some jitter, and it's going to look much worse at 50 kHz than it will at 10 Hz. I'm guessing, but did you change the relationship output_width = input_width/2 ? You will run into...
  47. Replies
    57
    Views
    778

    Here's another update with an important change....

    Here's another update with an important change. In the previous version, "high_time_us" was an integer, and in this version it's a float. The measurement of the high time of the input pulse is in ARM...
  48. Replies
    57
    Views
    778

    Here's an update to the previous program that...

    Here's an update to the previous program that uses Paul's suggested method, but instead of using 2 pins, one for rising and one for falling edges, this one interrupts on CHANGE (both rising and...
  49. Replies
    57
    Views
    778

    When you say "the width of the source pulse would...

    When you say "the width of the source pulse would be measured in advance", do you mean the Teensy 3.2 does not need to measure it, and it will be a constant for a given build? If so, you could use...
  50. Replies
    6
    Views
    189

    Without looking into it too much, I think you...

    Without looking into it too much, I think you would be using the serial interface, which seems to be a 3-wire SPI-like interface, with pin 6 being the chip select, pin 7 the clock, and pin 8 the...
Results 1 to 50 of 500
Page 1 of 10 1 2 3 4