Teensyduino 1.48 Beta #3

Status
Not open for further replies.
@KurtE

Just gave it a try for some reason not working. I did check to see if the appropriate ISR was firing and it was but not showing on the Scope ? Have to go but will be back.
 
@mjs513 - I am still doing some hacking now...

Was hacking up ISRs...

And also I have not actually tried running it yet...
 
Hi again:

Sorry was detained... Here is an update to the code.

I have not tried it yet:View attachment PulsePosition_t4.zip

I hacked up the ISRs to maybe... That is as part of the begin, I did save away the this pointer and then did some quick and dirty, test to see if we have an object and I think that ISR has triggered, then call the member ISR. Made a copy of one of the other ISRs where I hopefully tried to remap the hardware stuff to the hardware table.

Assuming that any of this works, then probably I am guessing next step is to move most of the other global data into the instance variables. Things like state, the pulse widths...

And then update the write method to go to those settings...

EDIT: I have tried running this, and like you I am not seeing anything on pin 9...
I did bracket the ISRs with a digital writes, like:
Code:
void PulsePositionOutput::isrTimer4()
{
	digitalWriteFast(2, HIGH);
	if (list[0] && (IMXRT_TMR4.CH[1].CSCTRL & TMR_CSCTRL_TCF1)) {IMXRT_TMR4.CH[1].CSCTRL &= ~(TMR_CSCTRL_TCF1); list[0]->isr();}
	if (list[1] && (IMXRT_TMR4.CH[2].CSCTRL & TMR_CSCTRL_TCF1)) {IMXRT_TMR4.CH[2].CSCTRL &= ~(TMR_CSCTRL_TCF1); list[1]->isr();}
	asm volatile ("dsb");  // wait for clear  memory barrier
	digitalWriteFast(2, LOW);
}
And I am getting ISRs. Not sure if correct ones yet, but...
So now wondering when/where does the IO pin get configured to be driven by the timer...

Investigating
 
Last edited:
@mjs513 - I think that part is fixed. I #if 1/#else too much of the old code away and did not configure pin...

Now showing some output...

So I think I will celebrate and go hook up wood chipper to small tractor
 

Attachments

  • PulsePosition_t4.zip
    6.6 KB · Views: 123
@KurtE

Yep you got it fixed! In the config as posted in post #54 I tested each QT pin and it worked, i.e., got the expected output as seen on the other T4.

I also did a bunch of clean up to the code (got rid of all the old stuff as well as moving the all the globals back into the .h file). It still works on all pins. I also tested outputting to three channels from with the sketch and SUCCESS! Here is the test sketch:
Code:
#define PRREG(x) Serial.print(#x" 0x"); Serial.println(x,HEX)
#include <PulsePosition_t4.h>

PulsePositionOutput myOut;
PulsePositionOutput myOut1;
PulsePositionOutput myOut2;

void setup()   
{
  Serial.begin(115200);
  delay(2000);
  myOut.begin(12);
  myOut1.begin(13);
  myOut2.begin(11);

  myOut.write(1, 600.03);
  myOut.write(2, 1500);
  myOut.write(3, 759.24);
  // slots 4 and 5 will default to 1500 us
  myOut.write(6, 1234.56);
  myOut1.write(1, 2234.56);
  myOut2.write(1, 634.56);

}

void loop() {

}
Here is the updated lib for output only. Now back to other things going on.

BTW. Forgot to say - really like what you did with the changes - good learning exercise for me.
 

Attachments

  • PulsePosition_t4.zip
    5.7 KB · Views: 149
@KurtE,

Ok - I got an initial pass at incorporating PulsePositionInput class into the lib. Did a quick test but have something is off. It is receiving data on the pin but the values are wrong - have some debugging to do - pretty sure my ISRs wrong for the this setup - have some debugging to do unless you beat me too it. This is the sketch I am using to test input:
Code:
#include <PulsePosition_t4.h>

// Simple loopback test: create 1 output to transmit
// test pulses, and 1 input to receive the pulses
PulsePositionInput myIn;

void setup() {
  myIn.begin(11);

}

int count=0;

void loop() {
  int i, num;

  // Every time new data arrives, simply print it
  // to the Arduino Serial Monitor.
  num = myIn.available();
  if (num > 0) {
    count = count + 1;
    Serial.print(count);
    Serial.print(" :  ");
    for (i=1; i <= num; i++) {
      float val = myIn.read(i);
      Serial.print(val);
      Serial.print("  ");
    }
    Serial.println();
  }
}

latest and greatest attached. Like I said its just a quick and dirty incorporation of the pulse input class functions. Now for some sleep.
 

Attachments

  • PulsePosition_t4.zip
    6.4 KB · Views: 105
@mjs513 - I don't think I have time tonight to do much here... Other distractions.

One thing I was thinking about was the interaction between the PulsePositionInput and PulsePositionOutput.

Imagine if your test case was to have a test sketch with maybe Pin 10 as an output and pin 11 as an input and you wanted to test by connecting a wire between the two pins.

Problem is, that is they both would want the same Interrupt vector and different code.

What I was thinking of trying was to create a base clase like: PulsePositionBase.

Maybe something like:
Code:
class PulsePositionBase
{

public:

protected:	
	static PulsePositionBase *list[10];
	typedef struct {
		uint8_t 		pin;
		uint8_t			channel;
		volatile IMXRT_TMR_t* tmr;
		volatile uint32_t *clock_gate_register;
		uint32_t 		clock_gate_mask;
		IRQ_NUMBER_t	interrupt;
		void     		(*isr)();

	} TMR_Hardware_t;
	static const TMR_Hardware_t hardware[];

	// member variables...
	virtual void isr();
	// static class functions

	static void isrTimer1();
	static void isrTimer2();
	static void isrTimer3();
	static void isrTimer4();
};
Then base both the other classes on this. They would share the same hardware list, and the list of objects would be shared, and the ISR would be virtual so both could implement... So far it looks like your testing to know which if an ISR happened on each channel is the same for Input and Output, so should just work. If it turns out that they may have different flags we could change test/clear in the ISRs...

Hope that makes sense?
 
@KurtE,

Ok - I got an initial pass at incorporating PulsePositionInput class into the lib. Did a quick test but have something is off. It is receiving data on the pin but the values are wrong - have some debugging to do - pretty sure my ISRs wrong for the this setup - have some debugging to do unless you beat me too it.
Just a visual inspection, in Input begin() you need
Code:
  write_index = 255;
  available_flag = false;
In my hack, i had those in setup() .... ugly
but you might also compare your code to Paul's PulsePosition code.

I just noticed in Paul's PulsePostion code, he has Input pulse buffers sized at PULSEPOSITION_MAXCHANNELS and Output pulse buffers sized at PULSEPOSITION_MAXCHANNELS+1. I know the Output buffers needs to be +1, and I'm thinking the Input buffers may need to be +1 ... bug? further study required.

EDIT: i think Input pulse buffers should be sized PULSEPOSITION_MAXCHANNELS+1 and in the Input isr
Code:
if (write_index < PULSEPOSITION_MAXCHANNELS) {
should be
if (write_index <= PULSEPOSITION_MAXCHANNELS) {

EDIT 2: upon further review, i think the Input pulse buffer logic is OK
 
Last edited:
@KurtE - Makes absolute sense in what you propose. Notice we were duplicating that between Input and output.

@manitou - made the changes in your post.

Ok. Made one change to the ISR flags that did improve the issue that I originally saw. Went from:
Code:
if (list[5] && (IMXRT_TMR2.CH[0].CSCTRL & TMR_CSCTRL_TCF1)) {IMXRT_TMR2.CH[0].CSCTRL &= ~(TMR_CSCTRL_TCF1); list[5]->isr();}
to
Code:
if (list[2] && (IMXRT_TMR1.CH[0].CSCTRL & TMR_CSCTRL_TCF1)) { list[2]->isr();}
Notice we were clearing the flag too early. In the ISR there was a test using the flag to determine when the overflow occurred. Making that change and using only a single frequency of 600.03 on pin 13 I am now seeing:

Code:
3284 :  [COLOR="#FF0000"]2347.71[/COLOR]  
3285 :  600.08  
3286 :  600.08  
3287 :  [COLOR="#FF0000"]2347.71[/COLOR]  
3288 :  600.08  
3289 :  600.08  
3290 :  2347.71  
3291 :  600.08  
3292 :  600.08
Which is partially correct but something seems not be clearing since I am getting that 2347.71 instead of the 600.0x. Still looking.
 
I don't think it will affect what you are seeing, but upon further review, i think the Input pulse buffer logic and buffer sizes are OK
 
@mjs513 @manitou - I could be completely barking up the wrong tree (been known to happen), especially in systems like the timers that I have not done much with (except use)

But I am wondering about on Input capture, setup and flag testing of the registers (SCTRL and CSTRL) ... Sorry in advance for rambling

In particular for Output I see we set:
Code:
	//TMR1_SCTRL0 = TMR_SCTRL_OEN | TMR_SCTRL_OPS to make falling
	if(outPolarity == 0){
	  tmr_ch->SCTRL = TMR_SCTRL_OEN | TMR_SCTRL_OPS;
	} else {
	  tmr_ch->SCTRL = TMR_SCTRL_OEN ;
	}

	tmr_ch->CSCTRL = TMR_CSCTRL_CL1(1);
	attachInterruptVector(hardware[idx_channel].interrupt, hardware[idx_channel].isr);
	tmr_ch->CSCTRL &= ~(TMR_CSCTRL_TCF1);  // clear
	tmr_ch->CSCTRL |= TMR_CSCTRL_TCF1EN;  // enable interrupt

On Input we see:
Code:
	tmr_ch->SCTRL |= TMR_SCTRL_IEFIE;  // enable compare interrupt
	tmr_ch->CSCTRL = TMR_CSCTRL_TCF1EN;  // enable capture interrupt

Now in ISRs:

Output:
Code:
	if (list[2] && (IMXRT_TMR1.CH[0].CSCTRL & TMR_CSCTRL_TCF1)) {IMXRT_TMR1.CH[0].CSCTRL &= ~(TMR_CSCTRL_TCF1); list[2]->isr();}

Input:
Code:
	if (list[2] && (IMXRT_TMR1.CH[0].CSCTRL & TMR_CSCTRL_TCF1)) {IMXRT_TMR1.CH[0].CSCTRL &= ~(TMR_CSCTRL_TCF1); list[2]->isr();}
I get sort of confused in these cases the relationship here between CSCTRL and SCTRL:
That is setting the TMR_SCTRL_IEFIE, looks like it would be doing the interrupt and setting the IEF flag in SCTRL regegister... Not sure what the TMR_CSCTRL_TCF1EN register/bit is doing?

Again probably wrong tree!
 
@KurtE

You and me both :). Keep going through the manual and trying things as I am reading but still confused.

In one of the earlier messages @manitou wrote:
Excellent. There are 10 quadtimer pins on T4. One problem requiring additional logic with both quadtimer PPM out and in in the same lib is that I never could get quadtimer Overflow interrupt to work (??). Counter in overflow interrupt is used to generate 32-bit counter for capture values. I had to use compare-value interrupt (0xffff) to count overflows, BUT compare-value interrupt is used in PPM out. So you'd need to know which pin is in capture mode and which pin is in compare mode to follow the proper path in the ISR -- maybe just look at timer's compare value register, if it has 0xffff then it is just counting overflows. For PPM out, lib's logic never allows value > 60000 in compare register.
Have to digest this one.

EDIT: just noticed something else that I have to look at. If I change input pin to 12 I get nothing so only 11 is working with the code as it stands. Ok - need more coffee
 
@mjs513 and ...

I do think the input ISR settings/handling is screwed up... Will play some more.

I hacked up last nights version to interrupt on input ISR on pin 3 instead of 2, and then did a quick and dirty version of pin 9, to 11 so two different timers involved:
Code:
#define PRREG(x) Serial.print(#x" 0x"); Serial.println(x,HEX)
#include <PulsePosition_t4.h>

PulsePositionOutput myOut;
PulsePositionInput myIn;
uint32_t count = 0;
void setup()
{
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  Serial.begin(115200);
  delay(2000);
  // Make sure on different timers...
  myOut.begin(9);
  myIn.begin(11);
  myOut.write(1, 750);
}
uint32_t last_in_avail_time = 0;
void loop() {
  int i, num;

  // Every time new data arrives, simply print it
  // to the Arduino Serial Monitor.
  num = myIn.available();
  if (num > 0) {
    uint32_t cur_time = micros;
    count = count + 1;
    Serial.print(count);
    Serial.print("(");
    Serial.print(cur_time-last_in_avail_time, DEC);
    last_in_avail_time = cur_time;
    Serial.print("):  ");
    for (i=1; i <= num; i++) {
      float val = myIn.read(i);
      Serial.print(val);
      Serial.print("  ");
    }
    Serial.println();
  }
}
Note: output is garbage:
Code:
796(0):  926.72  
797(0):  1026.75  
798(0):  1026.75  
799(0):  1026.75  
800(0):  926.72  
801(0):  1026.75  
802(0):  1026.75  
803(0):  926.72  
804(0):  1026.75  
805(0):  1026.75  
806(0):  926.72  
807(0):  1026.75  
808(0):  1026.75

Then hooked up LA to pins 9 (and 11 as they are jumpered to each other and 2 and 3...

If you then look at LA output:
You will see there is just one interrupt on the output and a ton of them on input...
screenshot.jpg

Note: I am getting ton of outputs... With time between 0 micros...
 
@KurtE

It seems to be better when using T4 - T4. Just tried loopback as well on 1 T4 with the version I have from this morning with just 1 output frequency and its seems to be always in the 2XXX ranges for a sketch freq of 600.08.

Think this may be going to back to what I quoted @manitou said in https://forum.pjrc.com/threads/57894-Teensyduino-1-48-Beta-3?p=220036&viewfull=1#post220036.

Also if you change from pin 11 to pin 12 its not doing the capturing. Was trying to debug it - ISRs are firing correctly but for other that pin 11 the second IF criterion is never satisfied.

EDIT: I am tx on pin 13 and rx on pin 11.

EDIT2: I just put a scope on pin 13 while running the sketch and the signal is affected by the input config/ISR
unnamed.jpg

Without attaching pin 11 (rxpin) the signal looks like the 2 narrow pulses in the middle of the image
 
Last edited:
@KurtE and others...
I just used the lib to setup output on pin 9 in @manitou's original pulsepositioninput sketch. Pin 9 is outputting 600.03 and the sketch is reading 600.08. Heres the sketch for your reference:

Code:
// PPM in, report pulse widths
//  test with PulsePosition output pin 9 to T4 pin 11
// QTIMER1   pin capture test  qtmr 1 ch 2  pin 11 B0_02,  ch 52
// free-running 16-bit timer
// QTIMER oflow interrupt no workee,  use 0xffff compare for 32-bit
// polarity TMR_SCTRL_IPS
#define PRREG(x) Serial.printf(#x" 0x%x\n",x);
#include <PulsePosition_t4.h>
PulsePositionOutput myOut;

#define PULSEPOSITION_MAXCHANNELS 16
uint32_t pulse_width[PULSEPOSITION_MAXCHANNELS+1];
uint32_t pulse_buffer[PULSEPOSITION_MAXCHANNELS+1];
uint32_t write_index, prev, total_channels;

#define CLOCKS_PER_MICROSECOND (150./4)  // pcs 8+2
#define RX_MINIMUM_SPACE   3500.0
#define RX_MINIMUM_SPACE_CLOCKS   (uint32_t)(RX_MINIMUM_SPACE * CLOCKS_PER_MICROSECOND)


volatile uint32_t ticks, overflow_count;
volatile bool overflow_inc, available_flag;

void my_isr() {  // capture and compare
  if (TMR1_CSCTRL2 & TMR_CSCTRL_TCF1) { // compare rollover
    TMR1_CSCTRL2 &= ~(TMR_CSCTRL_TCF1);  // clear
    overflow_count++;
    overflow_inc = true;
  }
  if (TMR1_SCTRL2 & TMR_SCTRL_IEF) { // capture
    uint32_t val, count;
    TMR1_SCTRL2 &= ~(TMR_SCTRL_IEF);  // clear
    val = TMR1_CAPT2;
    count = overflow_count;
    if (val > 0xE000 && overflow_inc) count--;
    val |= (count << 16);
    count = val - prev;
    prev = val;
    if (count >= RX_MINIMUM_SPACE_CLOCKS) {
      if (write_index < 255) {
        for (int i = 0; i < write_index; i++) {
          pulse_buffer[i] = pulse_width[i];
        }
        total_channels = write_index;
        available_flag = true;
      }
      write_index = 0;
    } else {
      if (write_index < PULSEPOSITION_MAXCHANNELS) {
        pulse_width[write_index++] = count;
      }
    }
  }
  ticks++;
  asm volatile ("dsb");  // wait for clear  memory barrier
  overflow_inc = false;
}

void capture_init() {
  CCM_CCGR6 |= CCM_CCGR6_QTIMER1(CCM_CCGR_ON);

  TMR1_CTRL2 = 0; // stop
  TMR1_LOAD2 = 0;
  TMR1_CSCTRL2 = 0;
  TMR1_LOAD2 = 0;  // start val after compare
  TMR1_COMP12 = 0xffff;  // count up to this val, interrupt,  and start again
  TMR1_CMPLD12 = 0xffff;

  TMR1_SCTRL2 = TMR_SCTRL_CAPTURE_MODE(1);  //rising
  attachInterruptVector(IRQ_QTIMER1, my_isr);
  TMR1_SCTRL2 |= TMR_SCTRL_IEFIE;  // enable compare interrupt
  TMR1_CSCTRL2 = TMR_CSCTRL_TCF1EN;  // enable capture interrupt
  NVIC_SET_PRIORITY(IRQ_QTIMER1, 32);
  NVIC_ENABLE_IRQ(IRQ_QTIMER1);
  TMR1_CTRL2 =  TMR_CTRL_CM(1) | TMR_CTRL_PCS(8 + 2) | TMR_CTRL_SCS(2) | TMR_CTRL_LENGTH ; // prescale
  *(portConfigRegister(11)) = 1;  // ALT 1
}

int ppmIn_available() {
  uint32_t total;
  bool flag;

  __disable_irq();
  flag = available_flag;
  total = total_channels;
  __enable_irq();
  if (flag) return total;
  return -1;
}

float ppmIn_read(uint8_t channel) {
  uint32_t total, index, value = 0;

  if (channel == 0) return 0.0;
  index = channel - 1;
  __disable_irq();
  total = total_channels;
  if (index < total) value = pulse_buffer[index];
  if (channel >= total) available_flag = false;
  __enable_irq();
  return (float)value / (float)CLOCKS_PER_MICROSECOND;
}

void setup()   {
  Serial.begin(9600);
  while (!Serial);
  delay(1000);
  myOut.begin(9);  // connect pins 9 and 10 together...
  myOut.write(1, 600.03);
  write_index = 255;
  available_flag = false;
  capture_init();

  PRREG(TMR1_SCTRL2);
  PRREG(TMR1_CSCTRL2);
  PRREG(TMR1_CTRL2);
  PRREG(TMR1_LOAD2);
  PRREG(TMR1_COMP12);
  PRREG(TMR1_CMPLD12);
  PRREG(TMR1_COMP22);
  PRREG(TMR1_CMPLD22);
}

void loop() {
  int i, num;
  static int count = 0;

  // Every time new data arrives, simply print it
  // to the Arduino Serial Monitor.
  num = ppmIn_available();
  if (num > 0) {
    count = count + 1;
    Serial.print(count);
    Serial.print(" :  ");
    for (i = 1; i <= num; i++) {
      float val = ppmIn_read(i);
      Serial.print(val);
      Serial.print("  ");
    }
    Serial.println();
  }
}
 
I get sort of confused in these cases the relationship here between CSCTRL and SCTRL:
That is setting the TMR_SCTRL_IEFIE, looks like it would be doing the interrupt and setting the IEF flag in SCTRL regegister... Not sure what the TMR_CSCTRL_TCF1EN register/bit is doing?

SCTRL is the capture interrupt, only used by PPM in

CSCTRL is the compare interrupt used by PPM out AND used by PPM In to count rollovers of timer for 32-bit count. That was my concern in post #30 where if you have a sketch doing both PPM in and PPM out on the same TMRx, then the ISR logic has to differentiate the compare interrupt based on ??, one case bump the overflow count or the other case fall into the "state" management logic ....

in Paul's PulsePosition, a timer overflow interrupt is used to bump the overflow count, but I never could get timer overflow to fire with quadtimers???, so i reverted to using a compare interrupt (compare value 0xffff)
 
Yep - sort of confusing...

@mjs513 and @manitou -
Wondering about this line:
Code:
	tmr_ch->CTRL =  TMR_CTRL_CM(1) | TMR_CTRL_PCS(8 + 2) | [COLOR="#FF0000"]TMR_CTRL_SCS(2[/COLOR]) | TMR_CTRL_LENGTH ; // prescale
Which goes back to sample line:
Code:
  TMR1_CTRL2 =  TMR_CTRL_CM(1) | TMR_CTRL_PCS(8 + 2) | TMR_CTRL_SCS(2) | TMR_CTRL_LENGTH ; // prescale

Where maybe the (2) implies that this is for logical input pin 2? If so this would need to change to be the logical channel on the timer?

Or put another way with our table extract
Code:
    {11,2, &IMXRT_TMR1, &CCM_CCGR6, CCM_CCGR6_QTIMER1(CCM_CCGR_ON), IRQ_QTIMER1, &PulsePositionInput::isrTimer1 },
    {12,1, &IMXRT_TMR1, &CCM_CCGR6, CCM_CCGR6_QTIMER1(CCM_CCGR_ON), IRQ_QTIMER1, &PulsePositionInput::isrTimer1 },
:
Might work for pin 11, but for pin 12, You would need TMR_CTRL_SCS(1) ?

Still looking, may for fun see if Overflow works...
On ISR, I can see having it do something like:
Code:
if (list[3] && (IMXRT_TMR1.CH[2].CSCTRL & TMR_CSCTRL_TCF1) 
			|| (IMXRT_TMR1.CH[2].SCTRL & (TMR_SCTRL_IEF | TMR_SCTRL_IEFIE) == (TMR_SCTRL_IEF | TMR_SCTRL_IEFIE))) {
		list[3]->isr();
       }
Still playing, but may be off doing some other stuff soon
 
Re: TMR_CTRL_SCS(2)

I looked at TMR_CTRL_SCS(2) last night and decided it was harmless, but I just removed it, and input doesn't work. So that value needs to match the channel of the timer for the T4 pin you've selected. in my hacked sketch, i was using T4 pin 11 which is qtmr 1 ch 2, hence the "2"

my first test sketch qtmr_capture.ino was based on SDK example, so that's where i got most of required register settings.
 
Last edited:
@mjs513 @manitou and others

I think I have had some success now:

This sketch is showing some reasonable outputs:

Code:
#define PRREG(x) Serial.print(#x" 0x"); Serial.println(x,HEX)
#include <PulsePosition_t4.h>

PulsePositionOutput myOut;
PulsePositionInput myIn;
uint32_t count = 0;
void setup()
{
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  Serial.begin(115200);
  delay(2000);
  // Make sure on different timers...
  myOut.begin(9);
  myIn.begin(11);
  myOut.write(1, 750);
}
uint32_t last_in_avail_time = 0;
void loop() {
  int i, num;

  // Every time new data arrives, simply print it
  // to the Arduino Serial Monitor.
  num = myIn.available();
  if (num > 0) {
    uint32_t cur_time = micros();
    count = count + 1;
    Serial.print(count);
    Serial.print("(");
    Serial.print(cur_time-last_in_avail_time, DEC);
    last_in_avail_time = cur_time;
    Serial.print("):  ");
    for (i=1; i <= num; i++) {
      float val = myIn.read(i);
      Serial.print(val);
      Serial.print("  ");
    }
    Serial.println();
  }
}
Where I have pin 9 connected to pin 11...

Still have separete classes with their own ISRs so can't have them both active. Although I think I setup the input ISR to hooks setup that should be able to use for both...
 

Attachments

  • PulsePosition_t4.zip
    6.6 KB · Views: 75
FYI - I create the base class and made Input and Output based off of it, and my test sketch is still working...

I am probably done for awhile... Need to go to store...

EDIT: Looks like the overflow is not happening... So capture is happening, but the value returned is missing the overlflow values so in my test case I added two more output values:
myOut.write(1, 750);
myOut.write(2, 1500);
myOut.write(3, 2250);

What I am seeing is something like:
Code:
38530(2250):  750.05  
38531(18500):  1519.28  
38532(19251):  502.45
 

Attachments

  • PulsePosition_t4.zip
    6.4 KB · Views: 116
Last edited:
@KurtE
Been playing....

FYI - I create the base class and made Input and Output based off of it, and my test sketch is still working...

I am probably done for awhile... Need to go to store...

@KurtE ….
See been busy while I was out --- really simplified the code using that base class. Have to digest it a bit more though.

Just ran a couple of quick tests with the lib in post #72:
1. pin 13 output on T4(A) to pin 11 on T4(B). (A) running single channel out of 600.03. On pin 11 of (B) I am seeing:multi-channel output when it should be only 1 channel showing:
Code:
101 :  600.08  176.37  600.08  176.37  
102 :  176.37  600.08  176.37  
103 :  176.37  600.08  176.37  
104 :  176.37  600.08  176.37  600.08

2. pin 13 output on T4(A) to pin 11 on T4(B). (A) running mutli-channel output of 3 frequencies (600.03, 1500.00, 759.24). Catching but acting like it is 3 single frequencies:
Code:
0223 :  600.08  
10224 :  1412.35  
10225 :  759.28  
10226 :  600.05  
10227 :  759.28  
10228 :  1500.05  
10229 :  600.08  
10230 :  759.28  
10231 :  600.08  
10232 :  600.08  
10233 :  759.28  
10234 :  600.08  
10235 :  1412.35

3. Multi-pin output on (A). On (A) pin 13 sending single freq of 600.03 and pin 11 sending 634.56; (B) on pin 11 receiving since that is the only working one right now:
Output from pin 13:
Code:
24219 :  600.08  176.37  600.08  176.37  
24220 :  176.40  600.08  176.37  
24221 :  176.37  600.08  176.37  
24222 :  176.37  600.08  176.37  600.08  
24223 :  600.08  176.37  600.08  176.37  
24224 :  176.37  600.08  176.37

Output from pin 11:
Code:
23379 :  634.59  141.87  634.59  141.87  
23380 :  141.87  634.59  141.89  
23381 :  141.87  634.59  141.87  
23382 :  141.87  634.59  141.89  634.59  
23383 :  634.59  141.87  634.59  141.87

Can still only get input on pin 11. No other pin works
 
@mjs513 - I will work on making the inputs work on different pins...

I am pretty sure I know what is going on, and what I need to do to fix...

Hint: Think of other IO pins in other subsystems that did not work...
Hint2: Look at pages like 861 (IOMUXC_QTIMER2_TIMER0_SELECT_INPUT)
 
@mjs513 - I will work on making the inputs work on different pins...

I am pretty sure I know what is going on, and what I need to do to fix...

Hint: Think of other IO pins in other subsystems that did not work...
Hint2: Look at pages like 861 (IOMUXC_QTIMER2_TIMER0_SELECT_INPUT)
Don't need the hint - was looking for the daisy chain earlier on but when I did the search I didn't come across it - must be losing it in my old age ;)

EDIT: Not all pins are available for input using daisy chain unless I missed something, this is what I found:
Code:
IOMUXC_QTIMER2_TIMER0_SELECT_INPUT = 0x01;  //pin 13
IOMUXC_QTIMER3_TIMER0_SELECT_INPUT = 0x02;  //pin 19
IOMUXC_QTIMER3_TIMER1_SELECT_INPUT = 0x00;  //pin 18
IOMUXC_QTIMER3_TIMER2_SELECT_INPUT = 0x01;  //pin 14
IOMUXC_QTIMER3_TIMER3_SELECT_INPUT = 0x01;  //pin 15
 
Last edited:
Status
Not open for further replies.
Back
Top