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. > 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.
  2. 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().
  3. 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.
  4. Let us know what works.

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

    Also try a capacitor from the piezo negative to ground.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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()
    {...
  12. 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...
  13. 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.
  14. > 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...
  15. Replies
    8
    Views
    167

    > 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.
  16. > 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.
  17. 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...
  18. 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)
    {
    ...
  19. > 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.
  20. 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
  21. > 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.
  22. Replies
    30
    Views
    1,132

    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.
  23. 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.
  24. Replies
    4
    Views
    153

    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...
  25. +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.
  26. 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 <...
  27. Replies
    17
    Views
    368

    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.
  28. Replies
    17
    Views
    368

    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.
  29. 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.
  30. > 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...
  31. 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?
  32. 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?
  33. 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
  34. 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).
  35. Move the declaration of "struct Step_data" into...

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

    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
  37. Replies
    12
    Views
    294

    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...
  38. Replies
    14
    Views
    323

    > 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
  39. Replies
    14
    Views
    323

    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.
  40. Replies
    14
    Views
    323

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

    Connect all your analog pins to a low impedance source - don't leave them floating.
  41. I learned that on linux I can install...

    I learned that on linux I can install "gdb-multiarch" and then use this newer version (V8.1) of gdb. Maybe this effects how the call function issue should be resolved.
  42. Everything is working well for me now. Thanks,...

    Everything is working well for me now. Thanks, this will definitely speed up debugging.
  43. If anyone is debugging a teensy that is not...

    If anyone is debugging a teensy that is not connected via dual serial USB (eg, hardware serial port), this should be useful:

    gdb_out_print(const char *msg)

    It causes gdb to display a string.
    ...
  44. I checked and you will be fine up to 200uf. Best...

    I checked and you will be fine up to 200uf. Best to put it close to the load.
  45. If you need more short-term power output, add...

    If you need more short-term power output, add capacitance.
  46. Anybody running on linux that could try: void...

    Anybody running on linux that could try:

    void setup() {
    Serial.begin(19200);
    debug.begin(SerialUSB1);
    delay(1000);
    halt();
    }

    This often causes gbd to not connect. Works fine...
  47. Maybe adding "if (Serial)" before print...

    Maybe adding "if (Serial)" before print statements?
  48. Replies
    12
    Views
    294

    Just a note: If you have some very brief...

    Just a note:

    If you have some very brief signals (eg 1 usec), you can add a sample and hold to the ADS1115 to capture it. You just can't read the signal very often.
  49. Replies
    12
    Views
    294

    Some suggestions for better teensy ADC...

    Some suggestions for better teensy ADC resolution:

    1) over-sample as much as possible
    2) sometimes median outperforms average
    3) use differential mode
    4) turn USB is off
    5) sample for a full...
  50. I don't use the python stuff, but here is proof:...

    I don't use the python stuff, but here is proof:


    (gdb) monitor digitalWrite(13,1)
    (gdb) monitor foo()
    Target does not support this command.
    (gdb)
Results 1 to 50 of 406
Page 1 of 9 1 2 3 4