Hi,
Probably a question for Paul, but others may be able to help me to I am hoping!
I am trying to use the Teensy3.5 as an in circuit TTL tester using upto 20 digital IO pins. I have grouped the pins to use PortC0-11 and PortD0-7. I had thought that at 120Mhz it would be quick enough for my needs but so far it works fine with TTL in slower circuits but faster circuits don't work.
So I dug out my logic analyser and started doing some timing tests using an extra digital pin to indicate start/finish points.
static uint16_t PrtCDat[100] __attribute__ ((aligned (16)));
static uint16_t PrtDDat[100] __attribute__ ((aligned (16)));
void Capture1()
{
digitalWriteFast(33, HIGH);
for (int i=0; i<100; i++)
{
PrtCDat = GPIOC_PDIR;
/* PrtDDat = GPIOD_PDIR;*/
}
digitalWriteFast(33, LOW);
}
This code takes 5.06us but if I takes out the comments it only takes an extra 0.82us, why? Surely there is not that much overhead for the loop.... I had been expecting the time to nearly double.
I have also tried using DMA, and if only sampling a single port I can get the time down to 4.44us but however I try to trigger 2 dma channels the time almost doubles to 8.62us. I also found that it was quicker to do the transfer in 1 trigger with NBYTES being set to the buffer size (200) rather than (2) and setting BITER/CITER to (100).
Am I missing something obvious here? Does anybody know of a quicker way?
In an ideal world it would have been great to have all 20 bits available on a single port, it seems the most I can get is 15 on Port D if I use the surface pads on the bottom.
Probably a question for Paul, but others may be able to help me to I am hoping!
I am trying to use the Teensy3.5 as an in circuit TTL tester using upto 20 digital IO pins. I have grouped the pins to use PortC0-11 and PortD0-7. I had thought that at 120Mhz it would be quick enough for my needs but so far it works fine with TTL in slower circuits but faster circuits don't work.
So I dug out my logic analyser and started doing some timing tests using an extra digital pin to indicate start/finish points.
static uint16_t PrtCDat[100] __attribute__ ((aligned (16)));
static uint16_t PrtDDat[100] __attribute__ ((aligned (16)));
void Capture1()
{
digitalWriteFast(33, HIGH);
for (int i=0; i<100; i++)
{
PrtCDat = GPIOC_PDIR;
/* PrtDDat = GPIOD_PDIR;*/
}
digitalWriteFast(33, LOW);
}
This code takes 5.06us but if I takes out the comments it only takes an extra 0.82us, why? Surely there is not that much overhead for the loop.... I had been expecting the time to nearly double.
I have also tried using DMA, and if only sampling a single port I can get the time down to 4.44us but however I try to trigger 2 dma channels the time almost doubles to 8.62us. I also found that it was quicker to do the transfer in 1 trigger with NBYTES being set to the buffer size (200) rather than (2) and setting BITER/CITER to (100).
Am I missing something obvious here? Does anybody know of a quicker way?
In an ideal world it would have been great to have all 20 bits available on a single port, it seems the most I can get is 15 on Port D if I use the surface pads on the bottom.