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

Search:

Type: Posts; User: jonr

Page 1 of 9 1 2 3 4

Search: Search took 0.01 seconds.

  1. Same problem, but slightly clearer. Bad result...

    Same problem, but slightly clearer. Bad result is:

    1<<4 = 16 vs 1616161616161616161616161616161616

    1<<5 = 32 vs 3232...3216 <-- 16 here is wrong

    1<<6 = 64 vs 64...6416

    ...
  2. > I have a GPS providing time codes, but they are...

    > I have a GPS providing time codes, but they are so infrequent that I would like to rely on something more regular.

    I'm curious why you wouldn't take a micros() reading whenever you get a GPS...
  3. Replies
    4
    Views
    150

    You can use 2 resistors and a N mosfet.

    You can use 2 resistors and a N mosfet.
  4. Note that while the T4 doesn't have a pseudo...

    Note that while the T4 doesn't have a pseudo differential mode, with two converters, one can sample the signal and a reference voltage at about the same time. So similar common mode noise/offset...
  5. Replies
    3
    Views
    142

    Great to see another example. It's good...

    Great to see another example.

    It's good practice to put decoupling capacitors tight to power pins. For example, MCU pins 7&8 are some distance from a capacitor.
  6. Interesting. Changing i to unsigned seems to fix...

    Interesting. Changing i to unsigned seems to fix it.
  7. Replies
    13
    Views
    211

    I went the wrong way and corrected it. Because,...

    I went the wrong way and corrected it. Because, per the manual, you want low impedance (< 4K) for the input to the ADC in the T4 to reduce errors. But if you otherwise have low impedance (say an...
  8. Replies
    13
    Views
    211

    > watch out for impedance requirements Yes -...

    > watch out for impedance requirements

    Yes - 1.1K and 2K would be better.
  9. Replies
    13
    Views
    211

    @kd5rxt-mark Once a question has been...

    @kd5rxt-mark

    Once a question has been answered, it's often useful to discuss a solution to the problem that reader(s) may be trying to address. Replies shouldn't criticize such helpfulness.
  10. Replies
    13
    Views
    211

    Not clear to me is if the T4 pins become 5V...

    Not clear to me is if the T4 pins become 5V tolerant with enough series resistance. Certainly one can add resistance+diodes to protect from 5V.
  11. > or connect them to 24, 25, 19, 18, 14... ...

    > or connect them to 24, 25, 19, 18, 14...

    Yes, pin 24 will be bit 0, 25 will be bit 1, etc.
  12. But I see nothing that indicates the equivalent...

    But I see nothing that indicates the equivalent pedvide _SPEED library settings for the defaults of AnalogRead().
  13. Looks like AnalogRead() normally uses averaging...

    Looks like AnalogRead() normally uses averaging of 4 samples. Not sure about other settings.

    Not sure what you expect, one or even a few bits of noise isn't bad.
  14. Let us know what works.

    Let us know what works.
  15. Also try a capacitor from the piezo negative to...

    Also try a capacitor from the piezo negative to ground.
  16. Like this: ...

    Like this:

    https://electronics.stackexchange.com/questions/275755/rc-low-pass-filters-for-op-amp-power-in-pins

    You may not notice the difference.
  17. Input protection is important to avoid teensy...

    Input protection is important to avoid teensy damage. I would use a BAT54S diode to 3.3V and to ground.

    Or maybe SDM40E20LS for better protection.
  18. You can try a 10 ohm resistor and then a 10u...

    You can try a 10 ohm resistor and then a 10u capacitor on line from power supply to the op amp.
  19. The reference manual says that 4K ohms is low...

    The reference manual says that 4K ohms is low enough source resistance for a T4 ADC input. 1K will be fine, even if an adjustment is needed for higher speed modes. Lower won't make any difference.
  20. Polling 3 ports for 34 pins sounds reasonable. ...

    Polling 3 ports for 34 pins sounds reasonable. There will be some jitter in your timing results.
  21. I/O ports are slow, maybe 13ns. This should be...

    I/O ports are slow, maybe 13ns. This should be the fastest way to read 18 parallel pins on a T4.1:


    #define IMXRT_GPIO6_DIRECT (*(volatile uint32_t *)0x42000000)

    inline uint32_t fixbits()
    {...
  22. You can quickly read 18 pins with one read to...

    You can quickly read 18 pins with one read to GPIO6. Wire them in this order:

    CORE_PIN24_BIT 12 GPIO6_DR
    CORE_PIN25_BIT 13 GPIO6_DR
    CORE_PIN19_BIT 16 GPIO6_DR
    CORE_PIN18_BIT...
  23. Do add some filtering on the output of the op...

    Do add some filtering on the output of the op amps to reduce noise. Try a 1K resistor in series followed by a .1u capacitor to ground. Change capacitor as needed.
  24. > adc->adc1->setAveraging(1); You can change...

    > adc->adc1->setAveraging(1);

    You can change the 1 to 2 or more for less noise. Also consider posting a schematic to get a lower noise design - there is more to it than just here and there...
  25. Replies
    8
    Views
    190

    > pinMode(A10, INPUT); All this does on a...

    > pinMode(A10, INPUT);

    All this does on a teensy is add some distortion of the signal. Leave it out.
  26. > try >> 1 shift instead of / 2 No difference,...

    > try >> 1 shift instead of / 2

    No difference, the compiler is smart about such things. On the other hand, pedvide uses some odd/slow types, so a (uint32_t) cast is needed in this case. Added.
  27. Here is a trick that should work. Say you only...

    Here is a trick that should work. Say you only need to read 1 pin, but want it fast and with .5 bits less noise. No sense is leaving an ADC idle when it will reduce noise.


    ADC::Sync_result sr...
  28. IMO, the best way to read 10 pins quickly. ...

    IMO, the best way to read 10 pins quickly. There are other ways if you want to do something else while the conversions are being done.


    for (int i = 0; i < PINS; i += 2)
    {
    ...
  29. > pinMode(adc_pins[i], INPUT); Paul doesn't do...

    > pinMode(adc_pins[i], INPUT);

    Paul doesn't do this and explicitly says not to. And I get very different ADC results when I do. So I think it's clear - don't do it.
  30. For linux users who want to do things manually,...

    For linux users who want to do things manually, this quick "gdb.sh" script works for me and is convenient:



    #!/bin/bash

    # find port
    port=`ls /dev/ttyACM* | tail -1`

    # find latest build
  31. > pinMode(adc_pins[i], INPUT); AFAIK, this...

    > pinMode(adc_pins[i], INPUT);

    AFAIK, this configures a pin for DIGITAL input - not what you want, so delete this section.
  32. Replies
    31
    Views
    1,283

    Work fine for me, although synchronous ADC reads...

    Work fine for me, although synchronous ADC reads went from .78 usec to .79 usec per sample.
  33. Put this at the top: "#define ADC_TEENSY_4_0" ...

    Put this at the top: "#define ADC_TEENSY_4_0"

    > I need 200 ADC readings per ms in total.

    No problem, the T4 can read the ADC at more than 700 samples per ms. > 1200 if using both ADCs.
  34. Replies
    4
    Views
    162

    Consider adding an external ADC with differential...

    Consider adding an external ADC with differential (or pseudo differential) inputs and a proper low pass filter. Even better if you can switch the input signal to a known value, allowing a pulsed...
  35. +1 on measuring timing. There some...

    +1 on measuring timing. There some non-intuitive things that even experts don't expect.

    Yes, do use lots of functions and pass all of the needed variables to them.
  36. Less scope is better, so much so that when you...

    Less scope is better, so much so that when you are starting out, you should program without using ANY global variables. It will force better coding practices.

    For example, "for (int i = 0 ; i <...
  37. Replies
    19
    Views
    427

    If you use differential signal/inputs, ground can...

    If you use differential signal/inputs, ground can be quite noisy or offset and it doesn't matter. Nor does other noise that gets induced in both lines.
  38. Replies
    19
    Views
    427

    For low noise audio with a teensy 4, I'd use an...

    For low noise audio with a teensy 4, I'd use an external, fully differential ADC with a clean supply and reference voltage. With a differential pair to it.
  39. See resp #13 for a link to info about bit...

    See resp #13 for a link to info about bit manipulation and reading ports directly.
  40. > Still wondering if the IMXRT1062 has a...

    > Still wondering if the IMXRT1062 has a brown-out interrupt, though.

    It has analog comparators which could be used to detect any voltage level. Could compare divided supply voltage to a voltage...
  41. I get roughly 13ns to read a port vs 2-3 ns for...

    I get roughly 13ns to read a port vs 2-3 ns for bit manipulation instructions. So you want to avoid port reads, even if it means more bit manipulation. Just ports 6 and 7 to get 32 bits?
  42. Good point. So the answer might be a singe...

    Good point. So the answer might be a singe read/shift for 16 bits and something similar to the T4.0 solution for the 2nd 16 bits?
  43. See my answers here: ...

    See my answers here:

    https://forum.pjrc.com/threads/58377-Reading-multiple-GPIO-pins-on-the-Teensy-4-0-quot-atomically-quot/page2?highlight=GPIO6
  44. If the sampling is done in an interrupt service...

    If the sampling is done in an interrupt service routine and the ethernet writing is done in the main loop, then no samples should be missed. Use a double buffer (2x 40k).
  45. Move the declaration of "struct Step_data" into...

    Move the declaration of "struct Step_data" into the .h file.
  46. Replies
    26
    Views
    5,267

    And now we have this, which is fine for many...

    And now we have this, which is fine for many uses:

    https://forum.pjrc.com/threads/61373-Using-GDB-with-Teensy-without-hardware-debugger-first-Beta
  47. Replies
    12
    Views
    306

    One more tip for low noise ADC. If you are...

    One more tip for low noise ADC. If you are reading a signal that you control, use a lock-in amplifier for amazing SNR (with a slow, high resolution ADC). You don't need the circuits they suggest...
  48. Replies
    14
    Views
    330

    > pinMode(A1, INPUT); Don't set up a pin for...

    > pinMode(A1, INPUT);

    Don't set up a pin for digital input if you intend to use it for analog input.

    https://forum.pjrc.com/threads/34319-Analog-input-impedance-and-pull-up
  49. Replies
    14
    Views
    330

    10K isn't low impedance. But if 1K to ground and...

    10K isn't low impedance. But if 1K to ground and your simple program above doesn't cause an analog input to reliably read about zero, then I don't know.
  50. Replies
    14
    Views
    330

    Connect all your analog pins to a low impedance...

    Connect all your analog pins to a low impedance source - don't leave them floating.
Results 1 to 50 of 416
Page 1 of 9 1 2 3 4