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

Search:

Type: Posts; User: Jp3141

Page 1 of 10 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thanks all, After I realized I was looking at...

    Thanks all,

    After I realized I was looking at the wrong pin, and using Manitou's guidance, I whittled my code to:


    void PWMPhaseShift(void) {
    // will use FTM2_CH1
    FTM2_SC = 0b00001000;...
  2. Help generate fixed frequency with FTM2 on Teensy 3.2

    I have a measurement instrument that is already using FTM0 and FTM1. I want to generate a 48 kHz (FBUS/1000) signal on the Teensy's pin #25 (PTB18), the duty cycle doesn't really matter (squareish). ...
  3. Replies
    16
    Views
    603

    I can confirm that (by using ARM_DWT_CYCCNT) it...

    I can confirm that (by using ARM_DWT_CYCCNT) it is working as desired now. 48 h and no spurious values for Phase.
  4. Replies
    16
    Views
    603

    I'm going to try using ARM_DWT_CYCCNT. Since the...

    I'm going to try using ARM_DWT_CYCCNT. Since the intermediate multiplication result can overflow, I used 360LL to force a 64-bit calculation (the final result won't overflow).



    (setup): ...
  5. Replies
    16
    Views
    603

    Thanks all. 1) I now see the purpose and use...

    Thanks all.

    1) I now see the purpose and use of _LDREX & _STREX. I expect this should also work if an interrupt was nested between them that also used LDREX/STREX (around some completely different...
  6. Replies
    16
    Views
    603

    Thanks -- I'll insert some debug code. I did...

    Thanks -- I'll insert some debug code.

    I did try to look at the compiler listing:


    1fff895e: f000 f84b bl 1fff89f8 <__micros_veneer>
    1fff8962: 4b1e ldr ...
  7. Replies
    16
    Views
    603

    micros() inside interrupt ?

    I have 2 external pin interrupts to my Teensy 3.2 (48 MHz)-- one at ~60 Hz, the other at 1 Hz (see project at https://github.com/jp3141/60Hz)

    Here's (what I think are) the relevant parts of the...
  8. Replies
    0
    Views
    262

    [queued] Log 60 Hz AC Powerline Frequency

    This uses a Teensy 3.2 and its FTM to precisely measure the frequency of the AC power line. An external GPS provides a 1 pps calibration pulse to continuously calibrate the Teensy's 48 MHz clock....
  9. Replies
    15
    Views
    2,498

    You might have an oscillation. You'll never...

    You might have an oscillation. You'll never observe an opamp's settling time with a multimeter -- it's in the us range at worst.
    You don't really need the extra input resistor anyway; opamp input...
  10. Replies
    9
    Views
    1,683

    Yes. The input signal is the resistance. You can...

    Yes. The input signal is the resistance. You can power the sender from any voltage -- the 3.3 V supply on Teensy is convenient. In any automotive system, you need to protect against transients and...
  11. You don't really need an opamp. If you don't...

    You don't really need an opamp.

    If you don't need perfect accuracy, connect 2 resistors in series between the +3.3 V and -3.3 V line that you want to measure. Connect the junction to the ADC...
  12. for this part - "Also, the 1/15Hz = 66,666 us....

    for this part - "Also, the 1/15Hz = 66,666 us. (mark of the devil!) which is > 65,536." --could you have a timer for 1/30 Hz and then in the callback just skip every 2nd one ?
  13. Replies
    6
    Views
    785

    Try this -- connect one input to VDD (3.3 V), and...

    Try this -- connect one input to VDD (3.3 V), and the other to GND. Then run a small sketch that reads alternately between the two inputs -- see how slow you have to go to only (mostly) see codes...
  14. Replies
    51
    Views
    8,174

    The reference for the ADC is the VDD (3.3 V)...

    The reference for the ADC is the VDD (3.3 V) supply -- from a TLV75733P. This only has 1.5 % accuracy, about 200 uV p-p noise in the BW you are using, and probably a change of a few mV over the...
  15. Yes, that spike could be bad. Add 1k in series...

    Yes, that spike could be bad. Add 1k in series with the input, or just in series with the 10 uF.

    You don't need to use 1k & 220 Ω -- they make the cutoff frequency too high for audio (10 uF &...
  16. Be careful -- a very large DC offset on the input...

    Be careful -- a very large DC offset on the input (say 5 V) could damage the Teensy when it is initially plugged in because the initial step as the 10 uF is charged will be driven straight into the...
  17. Replies
    63
    Views
    11,874

    I looked at interrupt-driven ADC conversions some...

    I looked at interrupt-driven ADC conversions some more. Using this ISR:

    FASTRUN void ADC_loop(void) {
    digitalWriteFast(admarkpin, HIGH);
    adc->adc0->startSingleRead(A9); // start a single...
  18. Replies
    63
    Views
    11,874

    At 8 bits, quantization errors possibly make...

    At 8 bits, quantization errors possibly make STDEV analysis inaccurate -- you may have a DC input that falls well within an ADC conversion step, thus giving 0 STDEV (even with some noise on the...
  19. Replies
    63
    Views
    11,874

    @borgerson -- yes, it compiles; I don't think the...

    @borgerson -- yes, it compiles; I don't think the variable sizes are the problem. What seems to be happening is that at > 10 bits resolution, I can't run 1 ADC at 1 MHz - I need 500 kHz for 12 bits,...
  20. Replies
    9
    Views
    1,208

    Thanks all. It seems like ...

    Thanks all. It seems like

    NVIC_SET_PRIORITY(IRQ_PIT, 1);
    and
    myTimer.priority(1); // set high priority

    have the same effect of raising the priority.

    Furthe looking through my code, it...
  21. Replies
    63
    Views
    11,874

    @mborgerson, I can't get your 1st post to work on...

    @mborgerson, I can't get your 1st post to work on a T4.1 (with a PSRAM also) at anything other than 8 bits. Am I missing something simple ?

    I have tried changing these lines:

    ...
  22. Replies
    9
    Views
    1,208

    But how can I find what other interrupts are...

    But how can I find what other interrupts are using priority 0 and move them to (say) 8 ?
  23. Replies
    9
    Views
    1,208

    But how do I do that specifically ? I don't know...

    But how do I do that specifically ? I don't know the interrupt number.

    I tried NVIC_SET_PRIORITY(IRQ_PIT, 1);?

    and ...,0); -- that helps and reduces the jitter from 10's of us to about 1us. I...
  24. Replies
    9
    Views
    1,208

    IntervalTimer interrupt priority

    I have a simple demo on Teensy LC that generates an interval timer interrupt nominally each 10 ms and toggles a pin. However the interrupts (or pin toggling) don't come at precise intervals. Here is...
  25. Replies
    2
    Views
    682

    It probably won't damage anything -- the '5 V'...

    It probably won't damage anything -- the '5 V' will rise to the highest of the USB voltage and the external supply. In the worst case, the USB power supply will current limit or shutdown (in some...
  26. Where did digitalToggleFast() come from ? I can't...

    Where did digitalToggleFast() come from ? I can't even find it on Google. What other useful functions am I missing ?
  27. Given that it is driving a mechanical system, the...

    Given that it is driving a mechanical system, the requirement to have the phase change smoothly by 'x' ns every single cycle isn't real -- it just requires that the average does this.

    It still...
  28. There is only a single DAC output on the...

    There is only a single DAC output on the Teensy's. But your VOR probably doesn't really need a sine wave -- likely a square wave will do, and you can generate those from PWM signals -- to get your...
  29. Replies
    35
    Views
    8,274

    There has been some interest in this question. I...

    There has been some interest in this question. I setup a test with a Teensy_LC where I supplied an external DC signal, and monitored it with both the Teensy and an Agilent 34410A DVM using USB for...
  30. Replies
    5
    Views
    1,129

    Try load this file...

    Try load this file https://github.com/tloimu/adapt-ffb-joy/blob/master/downloads/adaptffbjoy-r54.hex by using the Teensy application (File..Open HEX File).
  31. Replies
    9
    Views
    1,915

    My favourite tool :D For Windows users -...

    My favourite tool :D

    For Windows users - here's a copy of AWK: https://sourceforge.net/projects/ezwinports/files/gawk-5.1.0-w32-bin.zip/download
  32. Replies
    9
    Views
    1,915

    I'm back on this again. I created a simple script...

    I'm back on this again. I created a simple script that I run manually to generate a #include file. The script is:


    awk 'BEGIN{print "Serial.println( F( \\"}{gsub("\"","\\\"");print "\"" $0...
  33. Replies
    4
    Views
    1,893

    Can someone please post an example of how to do...

    Can someone please post an example of how to do this ?

    I'm confused over the number of endpoints I need; where the unique number is for each interface (is it 'PRODUCT_ID') ? Is DEVICE_CLASS...
  34. Replies
    7
    Views
    3,018

    Thanks -- that works, but I agree it's quite...

    Thanks -- that works, but I agree it's quite twisted; I'll wait until I am really out of memory.
  35. Replies
    7
    Views
    3,018

    Thanks @JarkkoL -- that's closer to what I was...

    Thanks @JarkkoL -- that's closer to what I was aiming for, but I was hoping (for clarity) to have it all on one line without having to invent new names for all the intermediate variables like...
  36. Replies
    7
    Views
    3,018

    Flexible Array in Arduino ?

    I am trying to initialize an array as part of a structure variable, but the compiler options in place on Arduino seem to require that the array size is predefined. Is there a way around this ?...
  37. Replies
    2
    Views
    2,430

    If you are just interested in the average...

    If you are just interested in the average current, then most measurement systems will actually do this by default -- they don't (instantaneously) sample the signal and then digitize it. For instance,...
  38. Replies
    9
    Views
    1,915

    I do that too, but with many computers of...

    I do that too, but with many computers of different vintages and locations, it's not unique enough for me.

    I'd like something like (I know this won't work) where the #include basically loads the...
  39. Replies
    9
    Views
    1,915

    Self-print code for documentation ?

    I suspect this is not possible, but is there a way (in the Arduino environment) to have a program print its own source code for documentation purposes ? I'd like to be able to do this as part of the...
  40. what works really well is to run through the...

    what works really well is to run through the array, and with a probability p, change it from off to on. If you want 10 % of the LEDs on (on average), then p is 0.1 etc. This keeps the whole set of...
  41. Replies
    7
    Views
    4,746

    15 V might be a little too low for the TVS -- as...

    15 V might be a little too low for the TVS -- as the battery goes bad (but not failed), the voltage could approach 15 V -- together with the TVS tolerance, it could cause some current to flow and it...
  42. You can't connect the 'A0 COM' connections...

    You can't connect the 'A0 COM' connections together from the multiple rotary switches -- you won't be able to read the switches independently (or correctly). You can connect multiple Teensy analog...
  43. If you have problems with signal amplitude, you...

    If you have problems with signal amplitude, you could use this. It uses the analog comparator in the Teensy and can detect 200 mV 10 MHz signals.



    Put your signal on pin23, and connect the...
  44. Replies
    3
    Views
    3,851

    1) jitter: you can't easily remove this. If you...

    1) jitter: you can't easily remove this. If you 'just' remove the last bit, you'll still have errors when the result crosses the next-to-last. For instance, say the numbers were 1..1000, and you had...
  45. Replies
    3
    Views
    3,851

    You are asking too much. 1) The ADC can always...

    You are asking too much.

    1) The ADC can always have a jitter of +/- 1 count -- imagine the input voltage is just on the border between two conversion codes -- depending on noise etc, it might...
  46. Replies
    3
    Views
    2,140

    0.1 mV for a 100 mV signal requires 10 bit...

    0.1 mV for a 100 mV signal requires 10 bit resolution (log2(100 mV/0.1 mV)) -- the ADC can do that (it has 16 bits. but realistically only ~ 13 are 'good'). With a 1.2 V reference, the LSB is 0.14...
  47. Replies
    4
    Views
    2,332

    There is a sufficient amount of digital IO on T...

    There is a sufficient amount of digital IO on T 3.2 etc. This IO is 5 V tolerant -- i.e. it survives 5 V being applied, but can only output 3.3 V. The ROM uses 5 V, but the datasheet indicates that...
  48. See my code in thread...

    See my code in thread https://forum.pjrc.com/threads/30822-Teensy-3-1-and-Flextimer(s)-Counting-external-pulses-accurately -- checking for 24 h with 15 MHz on pin3 and 20 Hz on pin A2 shows no...
  49. I think I have this figured out. When the FTM...

    I think I have this figured out. When the FTM overflows and an input capture occurs nearly simultaneously, it is difficult to know which occurred first, and therefore if the pre-overflow or post...
  50. Thanks @robsoles. I see what you are doing, but...

    Thanks @robsoles. I see what you are doing, but that won't work for me -- I trigger a capture with the FTM Channel 0. I am leaning towards not generating an interrupt with a Channel 0 event, just...
Results 1 to 50 of 496
Page 1 of 10 1 2 3 4