Search results

  1. P

    ADC_CONVERSION_SPEED question: why would you choose a slow conversion?

    The ADC library has full support for the comparison, both against a threshold and for a range, see commented out code in https://github.com/pedvide/ADC/blob/master/examples/analogRead/analogRead.ino#L54
  2. P

    ADC library, with support for Teensy 4, 3.x, and LC

    The internal (hardware) average only does a mean, not median. It outputs an integer as well, so you have to use software for any other statistics.
  3. P

    ADC library, with support for Teensy 4, 3.x, and LC

    Hey, you are using a ADC library method without calling it with `ADC->setReference(ref)`. The solution given to use `analogReference` is using a Teensy core library ADC functions, so not using the ADC library. See the examples for more information.
  4. P

    Teensy 4 not supported by ADC examples

    You can also find the docs of the latest ADC version at http://pedvide.github.io/ADC/. Regarding your original message: for (auto conv_speed : conversion_speed_list ) is a C++ construct, it has nothing to do with Arduino or Teensy. Look up any modern C++ reference (I think they may be called...
  5. P

    ADC library, with support for Teensy 4, 3.x, and LC

    It's fixed now in github.
  6. P

    Teensy 4.1 ADC.h will not compile

    The latest version on github works with Teensy 4.1.
  7. P

    ADC library, with support for Teensy 4, 3.x, and LC

    It depends on the Teensy that you have and the speed you set up, but usually a measurement takes at minimum 1 us, so probably it's doable to read 10 sensors in 1 ms. It will depend on what kind of processing you do.
  8. P

    Question: How do ADC measurements act when Vmeas exceeds Vref?

    The results are capped to the resolution, so if you are using 8 bits then the max is 255 and that's what you should see. There's no overflow or anything like that.
  9. P

    Teensy 4 How to increase speed of my sample readings using both ADCs and 4 Mic inputs

    However the minimum conversion time of a T4 is probably around 0.8 us, so you can maybe hope to get closer to 1000ksps, but not much more
  10. P

    Teensy 4 How to increase speed of my sample readings using both ADCs and 4 Mic inputs

    You can look into using DMA to copy each conversion into a buffer and when it's full switch to a different pin. I think the library has DMA examples, but none with linking pins.
  11. P

    ADC library, with support for Teensy 4, 3.x, and LC

    Well, it's not really a ADC feature it seems. You can use the library to start a software or hardware conversion and then you can set the board in wait mode. That I don't know how to do, but it's probably in the core library already.
  12. P

    ADC library, with support for Teensy 4, 3.x, and LC

    I'm not sure what exactly you want to do, you quote quite a few things... The ADC library supports using the async clock source (ADACK), so it should ran in low power modes without problems. You can use adc->adcX->setConversionSpeed, use the ADACK settings.
  13. P

    Teensy 4.0 adc0/adc1 swapped... possible bug?????

    ADC *adcX = new ADC(); ADC *adcY = new ADC (); This is wrong, you should only create one ADC object. Please see the examples. The ADC object controls both adc modules ADC0 and ADC1.
  14. P

    Adrift in a sea of #ifdefs

    In the ADc I abstracted most of the differences to two files: a settings file with what each board can do and a hardware access layer to handle the different atomic access styles. In the code I have things like #ifdef HAS_FEATURE_X, where HAS_FEATURE_X is defined in the settings file if that...
  15. P

    ADC library, with support for Teensy 4, 3.x, and LC

    I think in Teensy 4 it's actually possible using one of the timers, but I haven't implemented it.
  16. P

    ADC library, with support for Teensy 4, 3.x, and LC

    So given that message you found, what else do you need to know?
  17. P

    Teensy 3.6 differencial max input voltages

    The maximum is 3.3 V, it doesn't matter if you use the differential or single-ended mode, the limit is the same.
  18. P

    ADC async clock generation Teensy 4.0

    I don't remember it exactly, but I think that information is in the electrical specs sheet. For the Teensy 4 the asynch clock can run at 10 or 20 MHz.
  19. P

    Teensy 4 not supported by ADC examples

    Hello Deane, The example conversionSpeed runs over all possible configurations of the board and prints out the conversion speed for both the single-shot analogRead and the continuous mode. You can then check what configuration need to set to get the speed that you need. Indeed the continuous...
  20. P

    New Internal Temperature Library

    If you are already using the ADC library you can get the voltage of the temperature sensor with int temp_volt = adc->analogRead(ADC_INTERNAL_SOURCE::TEMP_SENSOR); You can convert it to the temperature in ºC with int temp = 25 - (temp_volt - volts_25C)/slope; Where the volts_25C and slope depend...
  21. P

    ADC library, with support for Teensy 4, 3.x, and LC

    Teensy 4 support is official! I have updated the first page and the code is available on the github repo as usual.
  22. P

    Teensy 4.0 which pins for which ADC

    (Note: PGA is the programmable gain amplifier, it has nothing to do with frequency). Indeed for the older Teensys I implemented some functions using the PDB, I'm open to add a the generic method you suggest so it can work with the new boards too.
  23. P

    Teensy 4.0 which pins for which ADC

    Hello @KurtE and @mjs513. The teensy4 branch for the ADc library is pretty much ready to merge into master (I'll do it tomorrow). The library works for all Teensys since 3.0, using a similar codebase. I have added both of you as collaborators so you have rights to merge pull requests. You're...
  24. P

    ADC library, with support for Teensy 4, 3.x, and LC

    With the help of KurtE and mjs513, this library will be updated for Teensy 4 in a few days. I'll make an announcement and update the first post.
  25. P

    How Can I Get A Stable And Accurate Sample Rate?

    You can use the PDB to trigger ADC conversions at a fixed rate with the ADC library. Then you can use the DMAChannel library (it's part of the core library) to transfer the ADC readings into a buffer.
  26. P

    Teensy 3.5 - Using different voltage references for ADC and DAC

    PumpkinEater, please post your complete code. What are you connecting to the ADC pin? the DAC output?
  27. P

    Teensy 3.5 - Using different voltage references for ADC and DAC

    Yes and no. You need to invert the statements in #2. When you call adc->setReference(ADC_REFERENCE::REF_3V3,ADC_0); it will stop the VREF, which is shared with the DAC. You can then call analogReference(1); because that will switch it on (it calls analog_init() which will switch it on) and set...
  28. P

    combining Teensy Audio and Pedvide's ADC libraries

    Well, I guess that's something that ADC library should allow. I think the idea of sampling several pins periodically is interesting so maybe I can try to implement it. Probably I'd implement it so that each pin has a buffer that then the user can use or save.
  29. P

    Teensy 3.5 - Using different voltage references for ADC and DAC

    I think that should work, but you need to switch on the VREF (I don't know if it's on by default) with VREF::start() VREF is included by the ADC library. You can stop it with VREF::stop()
  30. P

    combining Teensy Audio and Pedvide's ADC libraries

    Yes, if you have the Audio library use the ADC0 then you can use the ADC library to measure with the ADC1. However there's only one PDB module, so only one of the libraries can use that at a given time.
  31. P

    ADC library, with support for Teensy 4, 3.x, and LC

    Your spreadsheet isn't right, have a look at mine: https://docs.google.com/spreadsheets/d/1OSILeHUIY9x1FphI3T3Iv0ci9CLovjsvGqLs5a-BUlw/edit?usp=sharing I've actually discovered a bug in the calculation of the medium speeds while creating the spreadsheet, so thanks haha!
  32. P

    "Continuous mode"

    Continuous mode means that the ADC is measuring all the time; that is, it doesn't stop when it gets a result and keeps updating it. Based in your description it's not really what you want. If you want to take periodic measurements have a look at the pdb or the IntervalTimer examples of the ADC...
  33. P

    ADC library, with support for Teensy 4, 3.x, and LC

    Those errors indicate that the latest version on Teensyduino is not installed. I can't help you because I have no idea about that platform, sorry.
  34. P

    Arduino or C

    digitalWriteFast(LED_BUILTIN, HIGH); shows how you can have easy to use and understand zero-cost abstractions. They are zero-cost in two senses: no inefficient ASM code and no mental burden on the programmer. Any reasonable person can understand what that means, and the compiler will emit the...
  35. P

    ADC library, with support for Teensy 4, 3.x, and LC

    VREF_SC_MODE_LV_HIGHPOWERBUF was added "recently" to kinetis.h (not sure when). So I guess he had a moderately old version of Teensyduino. The comment on RingBuffer only says that I needed to include <Arduino.h> so I could use new and delete. It's not a command for the user!
  36. P

    Analog Read Teensy 3.5

    The standard way is using value*3.3/adc->getMaxValue(ADC_0); where value is int value=myADC->analogRead(ADC_INTERNAL_SOURCE::TEMP_SENSOR); but as you can see there are a few options.
  37. P

    ADC library, with support for Teensy 4, 3.x, and LC

    You should probably substitute ADC_Module::channel2sc1aADC0 by ADC::channel2sc1aADC0. But I don't know why you want to use that example. Have you looked at the ADC library examples?
  38. P

    teensy 3.6 ADC resolution problem

    Yes, depending on the conversion rate that you want you should lower the sampling and the conversion speeds, especially the sampling one as your converted voltage is lower than your input voltage (it's possible that your 3.3V isn't exactly 3.3 V though).
  39. P

    Synchronizing DAC and ADC for simultaneous use - Teensy 3.2/3.6

    The fastest the ADC can work on a Teensy 3.2 at 96 MHz is about 1 us. If you use the T3.6 at a higher clock rate you might get a faster rate, however the accuracy of the results won't be guaranteed.
  40. P

    Teensy 3.6 ADC documentation

    aaaxon, The ADC library is fully stable with Teensy 3.5 and 3.6. Of course there may be bugs, like in all software. Thankfully many people use it and report them. You're right that nobody can guarantee that I'll keep working on it for ever, but of course, being open source, if you download the...
  41. P

    Teensy 3.6 ADC documentation

    I've never used AREF, but I can tell you that, as far as I know, it's an input only pin. You need to provide enough current at your desired voltage though, I'm not sure how many mA are needed. Perhaps you source at 1.6 V has too much impedance? When AREF is not connected to anything, it floats...
  42. P

    Teensy 3.6 ADC documentation

    If you see an error in the ADC library, please post it here: https://github.com/pedvide/ADC/issues
  43. P

    Teensy 3.2's ADC Internal Reference Voltage and its Analog Resolution

    I agree with Paul, to get 12 real bits you should probably convert at 16 bits, hardware average and a low impedance. It can be done, but it also depends on the speed that you want to get the measurements.
  44. P

    ADC library, with support for Teensy 4, 3.x, and LC

    I'm looking into these issues, but I have a lot of work. I hope I can do something on the weekend. Please note that Teensy 3.6 only has one differential pair! Also I see that you're casting the results to uint, so you won't get negative values, which are possible for a diff measurement. Also...
  45. P

    ADC library, with support for Teensy 4, 3.x, and LC

    The errors are in ADC_Module.h, but more importantly is that that's a bug in the library for the Teensy 3.6! Please, go to https://github.com/pedvide/ADC/tree/dev and use that version of the library. There are a few changes with respect the old version in the setReference, setConversionSpeed...
  46. P

    ADC library, with support for Teensy 4, 3.x, and LC

    Arctic_Eddie, A similar image for the ADC0/1 for Teensy 3.1/3.2 is in page 1.
  47. P

    ADC library, with support for Teensy 4, 3.x, and LC

    keraba, I can't reproduce the behavior that you're seeing. Using your code I get expected values when I connect A2 to GND or 3.3V. Check this yourself with the latest version of the library (I don't know which one you're using). Grezco, You'll need to provide more details to investigate this...
  48. P

    ADC library, with support for Teensy 4, 3.x, and LC

    The correct names are updated in the github repository! keraba, You're only changing the sampling speed, not the conversion speed. The sampling part of a measurement takes a few ADC clock cycles, so it doesn't affect the total measurement time too much. The conversion part usually takes much...
  49. P

    ADC library, with support for Teensy 4, 3.x, and LC

    There's something strange with the link, open doxygen/html/index.html directly, that should work. I'm preparing a update that will break some things, so I wanna test it before committing it to github.
Back
Top