If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Not used "FreqCount" library myself, so maybe someone else can advise about this library. The comparator input signal goes in on Pin 18 and the sq wave output comes out on Pin 2 (and the code would go into Setup).
If...

Be aware that T4 is not 5 volt tolerant.
I used to consider external components for beefing up a low sinsusoid signal, but then discovered the delights of using the internal comparators (in T3 and T4). These are...

Am I correct in thinking that setting the Baud Rate for the Teensy port to the Arduino IDE Serial Monitor (e.g. "Serial.begin(115200);") over the mini USB is rather academic?
I wrote my own Serial Monitor yesterday...

Interesting perspective from a software engineer. For those who learnt hardware first, then came into software (once progress had caught up), they see things differently. What is BAD about magic numbers is that they may...

I had a look at page 26 as quoted but could not find this reference to 12 mA? Are you looking at a different page? Maybe a typo, what paragraph number?
On page 26, the first line says "Table 13 shows the current core...

@Paul - Have a quick look at https://forum.pjrc.com/threads/57386-T4-Quad-Timer-Capture-and-Output post #5... there is code there where you might reproduce a Win serial mon issue?
I have since made some code changes...

Have done a bit more work today. Today's first step was to extend QT1 to have two timers running (both of the QT1 group). Timer2 still used Pin11 as the trigger input for its own counter, but I added Timer1 to give an...

Have a look at this post https://forum.pjrc.com/threads/57386-T4-Quad-Timer-Capture-and-Output to see how you code for a timer interrupt.
The "attach" statement declares the name of the routine that will become the...

I first tried to use one pin of a QUAD TIMER as an input for another, but this was far too ambitious to get working in one step. So I then decide to break the problem down into manageable steps.
The first step was to...

The plot thickens. Reading page 3128, the register TMRx_CTRLn bits 8,7 control the "Secondary Count Source" (SCS) and it now looks as if one of the timers in a quad group can use the other "counters input pins" to...

I wish to use a Teensy 4 Quad Timer as both an external signal generator (output) and at the same time capture its current count value from another external signal (input). I want to compare the phases of these two...

Just been doing some work myself last night with XBARA1. I also ran into trouble, but did manage eventually to get an analog comparator functioning very well. Might give you some ideas? You have to read that manual VERY...

Many thanks again buddy. I can confirm all is now well. Your "xbar_connect" routine has confirmed that I was on the right track... the following line does exactly what your routine does. It is a complicated set of...

Inspection again of the iMXTR.h file, I found there is a symbol for the XBARA1_SEL3 register after all. It has the correct address of "403B_C000h base + 6h offset". I was looking for XBAR1 (sometimes the manual uses...

Thanks for the reference. Had a look at the .ino, but quickly out of my depth with your code...
I think I know how the XBAR now works (maybe). But I'm stuck on being able to set a register on page 3367/3368. The...

From the R.M. page 291, the only analog comparator OUTs to appear on T4 pins directly are ACMP3_OUT (GPIO_AD_B1_14) on Pin26, and ACMP4_OUT (GPIO_AD_B1_15) on pin27. These are pins both on the underside and require...

The 24 MHz crystal is situated close to the main chip and this will probably affect the "ambient temp" of the crystal module, either by convection - or possibly by conduction (in addition to room ambient changes).
I...

I also wondered what peripherals might be already in use. I don't have any knowledge - perhaps one of the experts will point you in the right direction.
Attached is some commented code on using GPT2. I chose GPT2...

@JBeale - You might find Beta Tests post #3578 and #3586 interesting. These refer to making the 150 MHz peripheral clock available for GPT2, which has a 32 bit counter.
I worried about making program code changes to...

Thanks for your useful response. I have just been doing some more experiments with T4 and have further very good results which may be of interest. Appreciate that temperature is a key factor - and more of this in a...

When measuring the output frequency of a QTIMER on a T4, I found it to be 5ppm slow on the theoretical value. This will be attributable to the 24 MHz oscillator also being 5ppm slow (within spec and temperature...

I believe the keyword "volatile" provides some insurance. Against what? The compiler making assumptions that differ from my own.
What is an ISR? Some code that might happen - but your'e never truly sure when....

So, in summary, the C code modulo operation "A % B" is realised by two assembler instructions - "sdiv" (signed division) followed by "mls" (multiply and subtract). Sdiv finds the integer result R of the division of A by...

Does anyone know how the algorithm works for performing modulo division in the Arduino/Teensyduino IDE?
I'm interested to know if the timing for this operation might depend on the size of the operands involved?
If...

I forgot to add that in order to get the 81 KHz frequency exact with Scheme (3), I needed to change the value from 0x04 to 0x08 for one of the digital capacitors...
//This following code will make incremental...

Having found a solution which was an almost perfect 81 KHz frequency square waveform, I wondered if it was now possible to reduce the jitter without loss of frequency precision.
The jitter is caused by the...

I had need recently to see if I could generate a very precise 81 KHz signal using a Teensy 3.5. I was looking for precision much better than 1 Hz.
This frequency is employed by Radio Station GYN2, which...

Glad to help. Yes, it does mean that the board is OK to work with. You may wish to experiment with turning the LED on and off by writing your own code. You learn a great deal by such experiments.
One of the very...

The schematic for Teensy 3.2 can be found here... https://www.pjrc.com/teensy/schematic.html
As you can see on the right hand side of the diagram, there is nothing particularly special about the LED. It is a simple...

@defragster - This three phase example illustrates the point. It is derived from my previous "alternating compare" example, which is why Compare1 and Compare2 are both being used.
I have not set Bit 14 (TCFIE) in...

With QTimers, there are two "Status and Control" registers - for example, TMR3_SCTRL1 and TMR3_CSCTRL1. The first is the Status/Control for the timer as a whole. The second is the Status/Control for comparators.
...

Been playing around again tonight with QTimers. Interesting idea of using QT3 in quadrature - employing QT3_Timer0 on pin 19 and QT3_Timer1 on pin 18.
This example also uses the "Alternating Compare1 and Compare2"...

Yes - I should use the symbols - even just to find any errors that might have crept in. I do find it educational, though, going through the registers bit by bit - it sticks in the brain better with me!

Not studied yet but there is a QUADRATURE option. One of the control bits can also invert.
I did get a QUAD output from GPT2 as well. Set Compare1 for frequency, then Compare2 and Compare3 can be any integer "phase"...

Gentlemen - Thankyou both. I could have stared at those ISR lines for days and not spotted it. So many other places where you write a '1' to clear a flag (familiarity breeds contempt). And the manual - can't see wood...

I have run into T4 trouble while experimenting with a QTIMER QT3_0. I am making an assumption that QT3_0 is free to use?
I am using the QTIMER as a simple upcounter from 0 to COMPARE1 and then reset 0. I want a...