I think this will be hard to do with PWM, and using an IntervalTimer won't meet your accuracy requirements, so it may not be the only solution, but I think I can outline something that will work. Every timer has two...
I'm not sure why you say you have a library problem. TeensyDuino 1.57b1 is available, but I think you're okay with 1.56. Here is the declaration of the printConfig() function. The argument is a pointer to a structure of...
I remember being very confused when I first started trying to use QuadEncoder. The HOLD registers are simply a "snapshot" of what was in various registers at the time that a read() was executed. This is done in hardware...
My applications don't have a HOME signal, but I think the basic idea is that you have a HOME switch on your machine, and that is input to the Teensy pin defined as the QDC HOME input. That switch defines an absolute...
I recommend reading the Quad Decoder (QDC) section of the processor reference manual. This will provide some background when looking at the library source and examples. It looks like the HOME signal can be used to...
Do you mean a different duty cycle? Can you define the two signals you need, and in what sense they need to be synchronized?
Edit: I see now you provided that info in the first post. I would follow the subsequent...
Perhaps not true for any two arbitrary pins, but possibly true for two pins on the same FlexPWM module, such as 7/8, 6/9, 28/29, 2/3. For reference see link below.
https://www.pjrc.com/store/teensy40.html#timing
Next step I would say is to show your wiring, provide info on the specific display, and specify your Arduino and TeensyDuino versions. If not the latest, that's always a good step to take so that others can replicate...
Paul, I have a question about calling yield() from the various "available" functions. These functions don't fit the pattern of calling yield() while waiting for something in hardware to finish, and I think therefore...
This is strange. Note that the big jump does not occur at the same switch position on the way down as on the way up. Instead it occurs on the 7th step in both directions. Seems like the hardware doesn't work in the way...
Please see this page on the PJRC website regarding library FreqCount. T3.x use pin 13, and T4.x uses pin 9. Library FreqMeasure is similar in that it supports only 1 pin per Teensy type. Depending on what you want to...
This question is an unusual one. The entire purpose of the TeensyDuino core and libraries is to access the power of the Teensy. Even if you want to write 100% of your own code, you seem to be under the impression that...
Here is a summary of your values. The first 5 values (109,203,299,392,490) are much closer to steps of 1/10 of the 1023 max than 1/9. That's why you don't get 1,2,3,4,5. After 490, there is big jump to 726, and then on...
Teensy 4.0 can do frequency counting, but it's a different processor, so the underlying code is different. Paul did a great job of maintaining pin compatibility, but that doesn't mean that all of the same features are...
It would be interesting to look at the actual values you are getting from readAnalog() by replacing the Serial.println(val) statement with:
Serial.printf( "%1hd %1hd\n", input, val );
Just to add to @defragster's answer, there is no "list" of code that runs before reaching your setup() function. If you want to review every line of code that runs before setup(), you can, but it's not as simple as...
In the code below, you are trying to allocate an array large enough to hold ALL of the samples, no matter how many there are. If your file is 7MB, then you are trying to allocate an array of size ~7MB, then read all of...
One more recommendation. When searching, start with Google. It's a much better search engine than the forum search tool. For example, if I was looking for information regarding Teensy and a particular part, such as A/D...
You could start at www.pjrc.com. That is where you will find a LOT of information on the Teensy boards, companion boards such as audio, TeensyDuino software and all of the libraries, tutorials, and much more. Choose a...
When you run the sketch, it tell you the time for 30000 samples. Yes, you have 30000 samples, but these are read in slightly less than 1 second, so your SPS (samples PER SECOND) is not 30000
SPS = 30000 samples /...
You're welcome. "SPS" is probably 30000, and this value must already be part of "ydata5". When the FFT is computed, you need to tell it the actual samples per second, which is 30005.25. Pseudo-code would look something...
Okay, good. Your 0 value is closer to 0 for the lower frequency sine wave because your time series offset is close to 0. You will ALWAYS have a non-zero value at 0 Hz if you have ANY offset, and there is almost always...
Yes, that's correct.
Can you please show a time series chart and FFT chart for a lower frequency, such as 50 or 100 Hz? I think you have a bias in the time series of the higher frequencies because the sample rate is...
Can you show the time series chart? The 0th element of the FFT is simply the mean value. If you have your function generator set up to produce a sine wave with 0 offset, the mean of your signal should be 0. If your mean...
On T4.1, I get total time of 999825 us for 30000 samples. That means sample rate = 30000/0.999825 = 30005.25
When you do your FFT, instead of specifying your sample rate as 30000 Hz, specify it as 30005.25 or...
With 30-kHz sampling of a 12-kHz sine wave, your raw data won't look like a sine wave (only 2.5 samples per period), but theoretically the FFT is okay up to sample freq / 2 = 15 kHz.
Here is another update, with a...
With the program above, I tested an input sine wave with frequency = 60 Hz, amplitude = 0.2 Vpp, and offset = 0 V. The data from the ADS1256 looks good. At 30 kSPS, the period of the sine wave is 500 samples, max = 0.1,...
Since you are getting a good sine wave with your own sketch, I decided to start from there. The code below has my changes to your sketch. There are only 3 functional changes, which are listed below. There are some other...
@frohr, I can only guess that your configuration of the ADS1256 is different from the program @mbilsky. Can you please tell us how you produce the sine wave for test, and what are the settings (frequency, amplitude,...
This is an interesting question. I haven't spent much time studying the ADS1256 data sheet, but the (settable) data rate, in this case 30kSPS must be derived from the on-board clock. 7.68M / 30000 = 256, so if you have...
Yes, it's also a pain to have to modify your laptop network settings. Here's a wifi extender that I use to avoid that trouble and connect the T4.1 on my desk to my network without running a long cable.
...
I can't answer that specific question, and the problem may be really simple, but I don't think you should expect examples written for Wiznet will work with just a change from "Ethernet.h" to "QNEthernet.h". If you...
I don't know how the A/D is clocked, or the accuracy of either the Teensy clock or the A/D clock, but you probably shouldn't expect to do any better unless you switch to clocking the samples with a signal from Teensy....
Assuming you are using T4.1, have you tried running any of shawn's QNEthernet examples? That would be a good starting point to be sure that your ethernet hardware/software is okay and the basics work, and then move on...
Have you looked at this page? https://mattbilsky.com/mediawiki/index.php?title=Teensy_and_the_ADS1256
And this github repository? https://github.com/mbilsky/TeensyADS1256
There is a video that shows how to...
For each sample, you have 5 calls to transfer() (8 bits each) for a total of 40 bits. With the SPI clock rate 1.95 MHz, the bit transfer time is 20.5 us, and that does not include any of the overhead for...
You say that you are not strong in ADS1256. Have you read the data sheet? Have you searched for existing ADS1256 libraries? If you do, you will find some. Choose one, install it, and run the example sketches. When you...
Paul beat me to it, but I was about to say....
No, you may not. The code in file mk20dx128.c in folder cores\Teensy3 is what modifies the registers from their default (reset) configuration. Study function...
All of the code executed before main() is in the Teensy core. File mk20dx128.c has function ResetHandler(). Also look at array _VectorsFlash. You'll notice that the second entry is ResetHandler, i.e. the address of the...
Any program that runs on any computing platform, whether it be Windows or Linux or Teensy, goes through some initialization code before it executes the code written by the "user". In C and C++, user code begins...
//MCG_C2 = MCG_C2_RANGE(1) | MCG_C2_HGO_MASK | MCG_C2_EREFS_MASK;
MCG_C2 |= MCG_C2_RANGE0(1) | MCG_C2_HGO0 | MCG_C2_EREFS;
One minor thing I notice is for MCG_C2 you use "|=" where the original code uses "="....
I've not personally done anything like your project, but this github repository has a project combining Teensy 3.1 with Airlift. Might be relevant?
https://github.com/j3nsykes/OSC_propShield
Yes, that code is rather opaque, but it's not freeing memory. 0x20200000 is the address of 2nd 512K block of RAM in T4.x, which includes DMAMEM. So, I think what this code means is "if the buffer is DMAMEM, clear the...
Fixes to ADC library to use DMA and for examples to build and run correctly
1) For source files AnalogBufferDMA.h and AnalogBufferDMA.cpp, move #include "ADC.h" outside #ifdef ADC_USE_DMA.
2) For examples listed...
The problem is that ADC_USE_DMA is not defined until there is a #include <ADC.h>, and the #include <ADC.h> is INSIDE the #ifdef ADC_USE_DMA. This is a problem (bug) not only in the example INO files, but also in the ADC...
Regarding external DACs, you can find 1-channel and 4-channel DACs on breakout boards from Sparkfun and Adafruit. You can also look at boards from MikroE, which use their MikroBus pinout for I2C and SPI. Sparkfun...
I don't know anything about USBHost, but it looks like you are calling Serial.print/println from different contexts. Much of the cores and libraries are not re-entrant, so if you're going to call those from more than...
Can you tell us about your application, how you have assigned various parts to FreeRTOS tasks, and how you are managing the interactions between tasks?
With modern C++ there may be a syntax to define/initialize as an array, but you could also do this:
// define the individual display objects as you already have
Adafruit_SSD1306 display1(SCREEN_WIDTH,...
If that happened it would simply be a bug. The two classes are closely related.Are you suggesting the functions should all be given different names? The compiler can’t divine your intent based on the names of macros....
HWSERIAL is a macro defined to have the value Serial1. clear() is a member function of the HardwareSerial class, so it's valid to use HWSERIAL.clear(). I don't understand the point about function arguments. You could...
See this thread. It's the only one I know of with IEEE 1588 PTP for Teensy. I think it's somewhat experimental, and I haven't looked at the examples, but the author (shawn) is very responsive. Rather than post more...
They were guessing that when you said axes, you were referring to a joystick. When you first mentioned dials, you didn't say what type of input. If you need 12 analog inputs, I think any Teensy will do it. If you need...
I'm no expert on the Teensy SPI, but maybe I can help with some general information. Yes, the processor can do other things while data is being transferred to/from SPI devices. I recommend reading the LPSPI chapter (48)...
Okay, thanks. I've experimented with STM32, but not ESP32, though I share the interest in built-in RTOS, and avoiding having to modify the core. I haven't tried Teensy Threads, but rather have settled on a very simple...
@DaveAK, just FYI, that would work. The code doesn't have to be sent as Intel Hex records, so an application could read its own flash and build/send records containing address+data. I don't use Teensy-to-Teensy for...
The thread referenced by @thebigg provides a way to update firmware via a UART (or I2C or SPI) on the target Teensy, as opposed to via the USB connector, but it doesn't use the Teensy bootloader. It requires that the...
I downloaded the EEPROMEx library from github and tried to build your sketch. The constant EEPROMSizeTeensy32 is not defined, so can you tell us what is that value, and did you make any other changes to the code from...
Only CMSIS DSP is included in TeensyDuino. It requires a few macros that are defined in core_cm7.h, but #include "core_cm7.h" creates other issues (as you have found), so the necessary macros were extracted and placed...
I'm just trying to say that you should not have #include "core_cm7.h" in your code unless you bring in more of the CMSIS library. Perhaps it shouldn't be in the Teensy4 core at all. I can only speculate that it ended up...
The only reference to "core_cm7.h" in the Teensy cores and TeensyDuino libraries is a #include in arm_math.h, and that #include is inside a #if 0 conditional block. In other words, it is not used by Teensy. A few of the...
It would be helpful to see some of your code that calls these macros, but I'll take a guess. You could start with very simple macros like those below. I'm not sure if your macros return 16-bit or 32-bit values, so I'm...
It would be quite expensive to get to 512 MB of serial RAM. Your data rate is not that high, so look at Flash, which is a lot cheaper. Also search this forum and elsewhere for Teensy-based synthesizers and other music...
Paul has said there will be a Teensy with NXP's 1170 chip. The pandemic has disrupted not only PJRC, but also NXP and every other vendor, so I don't think anyone can give you a timeline.
The text below is from the Teensy 4.1 product page. So, for T4.1, you can add up to 16 MB of PSRAM. This is on a relatively fast QSPI (quad) bus, so it's pretty fast. I don't know the actual peak speed, but it won't be...
Thanks, this is good info. I've been working on T3.5 recently, being careful to use the "f" suffix to be sure that all floating-point operations are 32-bit. This makes it a little tricky to plan for portability of code...
@PaulStoffregen, Paul, I was familiar with the use of suffixes "L", "UL", "LL", and "ULL" for integers in C and C++, but not with "L" for floating-point values. I did some searching, and what I'm reading says that "L"...