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. Replies
    19
    Views
    421

    Looks like it's an application that needs...

    Looks like it's an application that needs floating point SIMD instructions.
  2. Replies
    19
    Views
    421

    Thanks. Some background on it is here: ...

    Thanks. Some background on it is here: https://torger.se/anders/brutefir.html#bruteconv

    I use it for digital room correction (DRC) of speakers - which I highly recommend to anyone interested...
  3. Replies
    19
    Views
    421

    My desktop does a 65536 tap fir filter on 44 kHz...

    My desktop does a 65536 tap fir filter on 44 kHz stereo with 1.5% cpu (with BruteFIR). But I take it that a T4 couldn't do it, even at 100% cpu?
  4. Looked into it more. Signed integer overflow is...

    Looked into it more. Signed integer overflow is undefined. meaning that when it occurs. the compiler is free to generate any "bug" it wants. There is no problem with gcc here.
  5. It also occurs on gcc 7.5.0, x86_64-linux-gnu...

    It also occurs on gcc 7.5.0, x86_64-linux-gnu with -O2 or -O3.

    Good for looking at gcc output: https://godbolt.org/


    #include <stdio.h>
    void
    setup2 ()
    {
    for (int n = 4; n <= 6; n++)
  6. 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

    ...
  7. > 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...
  8. Replies
    4
    Views
    190

    You can use 2 resistors and a N mosfet.

    You can use 2 resistors and a N mosfet.
  9. 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...
  10. Replies
    3
    Views
    162

    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.
  11. Interesting. Changing i to unsigned seems to fix...

    Interesting. Changing i to unsigned seems to fix it.
  12. Replies
    13
    Views
    244

    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...
  13. Replies
    13
    Views
    244

    > watch out for impedance requirements Yes -...

    > watch out for impedance requirements

    Yes - 1.1K and 2K would be better.
  14. Replies
    13
    Views
    244

    @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.
  15. Replies
    13
    Views
    244

    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.
  16. > 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.
  17. 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().
  18. 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.
  19. Let us know what works.

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

    Also try a capacitor from the piezo negative to ground.
  21. 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.
  22. 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.
  23. 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.
  24. 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.
  25. 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.
  26. 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()
    {...
  27. 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...
  28. 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.
  29. > 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...
  30. Replies
    8
    Views
    195

    > 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.
  31. > 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.
  32. 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...
  33. 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)
    {
    ...
  34. > 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.
  35. 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
  36. > 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.
  37. Replies
    31
    Views
    1,397

    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.
  38. 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.
  39. Replies
    4
    Views
    166

    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...
  40. +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.
  41. 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 <...
  42. Replies
    19
    Views
    467

    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.
  43. Replies
    19
    Views
    467

    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.
  44. 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.
  45. > 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...
  46. 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?
  47. 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?
  48. 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
  49. 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).
  50. Move the declaration of "struct Step_data" into...

    Move the declaration of "struct Step_data" into the .h file.
Results 1 to 50 of 421
Page 1 of 9 1 2 3 4