T4 FlexIO - Looking back at my T4 beta testing library FlexIO_t4

@KurtE
Have to go do a couple of errands - didn't get a chance to test if the same thing happens on other pins as well. I assume you did though knowing you. :)
 
@mjs513 - I hacked up another sketch that has to FlexSerial objects and just does output. Did not bother to echo (also posted this one to NXP).

Code:
//============================================================================
// Simple output only test for Flex Serial pin defined on Pin 2
// Idea is to connect pin 0 (Serail1 RX pin) to Pin2 (Flex IO output)
// 
// And the program will hopefully echo the stuff to The serial output
//============================================================================

#include <FlexIO_t4.h>
#include <FlexSerial.h>

#define TX_PIN 3
#define TX_FLEX_IO_INDEX 0
#define TX_FLEX_IO_TIMER 0
#define TX_FLEX_IO_SHIFTER 0
#define TX_PIN2 4
#define TX_FLEX_IO_INDEX2 0
#define TX_FLEX_IO_TIMER2 1
#define TX_FLEX_IO_SHIFTER2 1
FlexSerial SerialFlex(-1, TX_PIN, -1, -1, -1, TX_FLEX_IO_INDEX, TX_FLEX_IO_TIMER, TX_FLEX_IO_SHIFTER);
FlexSerial SerialFlex2(-1, TX_PIN2, -1, -1, -1, TX_FLEX_IO_INDEX2, TX_FLEX_IO_TIMER2, TX_FLEX_IO_SHIFTER2);

void setup() {
  pinMode(13, OUTPUT);
  while (!Serial && millis() < 4000);
  Serial.begin(115200);
  Serial1.begin(115200);  // lets start up Serial1, to see if we can receive anything from our FlexSerial
  delay(500);
  SerialFlex.begin(115200);
  SerialFlex2.begin(115200);
}

// Real simple for now
void loop() {
  SerialFlex.print("Flex1");
  SerialFlex2.print("Flex2 More");
  delay(2);
  Serial.println("******** After first output ************");
  Serial.printf("CCM_CDCDR: %x\n", CCM_CDCDR);
  Serial.printf("VERID:%x PARAM:%x CTRL:%x PIN: %x\n", IMXRT_FLEXIO1_S.VERID, IMXRT_FLEXIO1_S.PARAM, IMXRT_FLEXIO1_S.CTRL, IMXRT_FLEXIO1_S.PIN);
  Serial.printf("SHIFTSTAT:%x SHIFTERR=%x TIMSTAT=%x\n", IMXRT_FLEXIO1_S.SHIFTSTAT, IMXRT_FLEXIO1_S.SHIFTERR, IMXRT_FLEXIO1_S.TIMSTAT);
  Serial.printf("SHIFTSIEN:%x SHIFTEIEN=%x TIMIEN=%x\n", IMXRT_FLEXIO1_S.SHIFTSIEN, IMXRT_FLEXIO1_S.SHIFTEIEN, IMXRT_FLEXIO1_S.TIMIEN);
  Serial.printf("SHIFTSDEN:%x SHIFTSTATE=%x\n", IMXRT_FLEXIO1_S.SHIFTSDEN, IMXRT_FLEXIO1_S.SHIFTSTATE);
  Serial.printf("SHIFTCTL:%x %x %x %x\n", IMXRT_FLEXIO1_S.SHIFTCTL[0], IMXRT_FLEXIO1_S.SHIFTCTL[1], IMXRT_FLEXIO1_S.SHIFTCTL[2], IMXRT_FLEXIO1_S.SHIFTCTL[3]);
  Serial.printf("SHIFTCFG:%x %x %x %x\n", IMXRT_FLEXIO1_S.SHIFTCFG[0], IMXRT_FLEXIO1_S.SHIFTCFG[1], IMXRT_FLEXIO1_S.SHIFTCFG[2], IMXRT_FLEXIO1_S.SHIFTCFG[3]);
  Serial.printf("TIMCTL:%x %x %x %x\n", IMXRT_FLEXIO1_S.TIMCTL[0], IMXRT_FLEXIO1_S.TIMCTL[1], IMXRT_FLEXIO1_S.TIMCTL[2], IMXRT_FLEXIO1_S.TIMCTL[3]);
  Serial.printf("TIMCFG:%x %x %x %x\n", IMXRT_FLEXIO1_S.TIMCFG[0], IMXRT_FLEXIO1_S.TIMCFG[1], IMXRT_FLEXIO1_S.TIMCFG[2], IMXRT_FLEXIO1_S.TIMCFG[3]);
  Serial.printf("TIMCMP:%x %x %x %x\n", IMXRT_FLEXIO1_S.TIMCMP[0], IMXRT_FLEXIO1_S.TIMCMP[1], IMXRT_FLEXIO1_S.TIMCMP[2], IMXRT_FLEXIO1_S.TIMCMP[3]);
  
  SerialFlex.print(" second Flex output");
  SerialFlex2.print(" Flex 2 output again");

  delay(10);
  Serial.println("******** After Second output ************");
  Serial.printf("CCM_CDCDR: %x\n", CCM_CDCDR);
  Serial.printf("VERID:%x PARAM:%x CTRL:%x PIN: %x\n", IMXRT_FLEXIO1_S.VERID, IMXRT_FLEXIO1_S.PARAM, IMXRT_FLEXIO1_S.CTRL, IMXRT_FLEXIO1_S.PIN);
  Serial.printf("SHIFTSTAT:%x SHIFTERR=%x TIMSTAT=%x\n", IMXRT_FLEXIO1_S.SHIFTSTAT, IMXRT_FLEXIO1_S.SHIFTERR, IMXRT_FLEXIO1_S.TIMSTAT);
  Serial.printf("SHIFTSIEN:%x SHIFTEIEN=%x TIMIEN=%x\n", IMXRT_FLEXIO1_S.SHIFTSIEN, IMXRT_FLEXIO1_S.SHIFTEIEN, IMXRT_FLEXIO1_S.TIMIEN);
  Serial.printf("SHIFTSDEN:%x SHIFTSTATE=%x\n", IMXRT_FLEXIO1_S.SHIFTSDEN, IMXRT_FLEXIO1_S.SHIFTSTATE);
  Serial.printf("SHIFTCTL:%x %x %x %x\n", IMXRT_FLEXIO1_S.SHIFTCTL[0], IMXRT_FLEXIO1_S.SHIFTCTL[1], IMXRT_FLEXIO1_S.SHIFTCTL[2], IMXRT_FLEXIO1_S.SHIFTCTL[3]);
  Serial.printf("SHIFTCFG:%x %x %x %x\n", IMXRT_FLEXIO1_S.SHIFTCFG[0], IMXRT_FLEXIO1_S.SHIFTCFG[1], IMXRT_FLEXIO1_S.SHIFTCFG[2], IMXRT_FLEXIO1_S.SHIFTCFG[3]);
  Serial.printf("TIMCTL:%x %x %x %x\n", IMXRT_FLEXIO1_S.TIMCTL[0], IMXRT_FLEXIO1_S.TIMCTL[1], IMXRT_FLEXIO1_S.TIMCTL[2], IMXRT_FLEXIO1_S.TIMCTL[3]);
  Serial.printf("TIMCFG:%x %x %x %x\n", IMXRT_FLEXIO1_S.TIMCFG[0], IMXRT_FLEXIO1_S.TIMCFG[1], IMXRT_FLEXIO1_S.TIMCFG[2], IMXRT_FLEXIO1_S.TIMCFG[3]);
  Serial.printf("TIMCMP:%x %x %x %x\n", IMXRT_FLEXIO1_S.TIMCMP[0], IMXRT_FLEXIO1_S.TIMCMP[1], IMXRT_FLEXIO1_S.TIMCMP[2], IMXRT_FLEXIO1_S.TIMCMP[3]);

  Serial.println("\n *** Enter anything to run again ***");
  while (Serial.read() == -1) ;
  while (Serial.read() != -1);
  
}
Sample output:
Code:
pin 3 maps to: 20000bb8, port: 401ac000(FLEXIO1) pin 5
timer index: 0 shifter index: 0 mask: 1
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 0
SHIFTSTAT:0 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 0 0 0
SHIFTCFG:32 0 0 0
TIMCTL:1c00501 0 0 0
TIMCFG:2222 0 0 0
TIMCMP:f81 0 0 0
pin 4 maps to: 20000bb8, port: 401ac000(FLEXIO1) pin 6
timer index: 1 shifter index: 1 mask: 2
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 40
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3(F) 0 1 0
FI1: 2 3 0 4(F) 0 3 0
FI1: 1 3 0 3(l) 0 3 0
FI1: 2 3 0 4(l) 0 3 0
FI1: 1 3 0 3(e) 0 3 0
FI1: 2 3 0 4(e) 0 3 0
FI1: 1 3 0 3(x) 0 3 0
FI1: 2 3 0 4(x) 0 3 0
FI1: 1 3 0 3(1)* 0 2 0
FI1: 2 2 0 4(2) 0 2 0
******** After first output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:2 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 3 0 3( ) 0 3 0
FI1: 3 3 0 3(s)4( ) 0 3 0
FI1: 3 3 0 3(e)4(M) 0 3 0
FI1: 3 3 0 3(c)4(o) 0 3 0
FI1: 3 3 0 3(o)4(r) 0 3 0
FI1: 3 3 0 3(n)4(e) 0 3 0
FI1: 3 3 0 3(d)4( ) 0 3 0
FI1: 3 3 0 3( )4(F) 0 3 0
FI1: 3 3 0 3(F)4(l) 0 3 0
FI1: 3 3 0 3(l)4(e) 0 3 0
FI1: 3 3 0 3(e)4(x) 0 3 0
FI1: 3 3 0 3(x)4( ) 0 3 0
FI1: 3 3 0 3( )4(2) 0 3 0
FI1: 3 3 0 3(o)4( ) 0 3 0
FI1: 3 3 0 3(u)4(o) 0 3 0
FI1: 3 3 0 3(t)4(u) 0 3 0
FI1: 3 3 0 3(p)4(t) 0 3 0
FI1: 3 3 0 3(u)4(p) 0 3 0
FI1: 3 3 0 3(t)*4(u) 0 2 0
FI1: 3 2 0 4(t) 1 2 0
******** After Second output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:2 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0

 *** Enter anything to run again ***

This one shows the issue that with 2 Shifters 0 and 1, when 0 finishes 1 does not output anymore...
screenshot.jpg

Probably all for now. May do some other diversion
 
@KurtE
Know this is going to sound strange but could you put you LA on it again using these prints:
Code:
  SerialFlex.print ("Flex112345");
  SerialFlex2.print("Flex2 More");
 …...
  
  SerialFlex.print (" second Flex output1");
  SerialFlex2.print(" Flex 2 output again");
 
@KurtE
Know this is going to sound strange but could you put you LA on it again using these prints:
Code:
  SerialFlex.print ("Flex112345");
  SerialFlex2.print("Flex2 More");
 …...
  
  SerialFlex.print (" second Flex output1");
  SerialFlex2.print(" Flex 2 output again");

Yep - But all of this is strange....

Here is debug output:
Code:
pin 3 maps to: 20000bc0, port: 401ac000(FLEXIO1) pin 5
timer index: 0 shifter index: 0 mask: 1
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 0
SHIFTSTAT:0 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 0 0 0
SHIFTCFG:32 0 0 0
TIMCTL:1c00501 0 0 0
TIMCFG:2222 0 0 0
TIMCMP:f81 0 0 0
pin 4 maps to: 20000bc0, port: 401ac000(FLEXIO1) pin 6
timer index: 1 shifter index: 1 mask: 2
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 40
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3(F)* 0 0 0
FI1: 2 3 0 4(F) 0 3 0
FI1: 1 3 0 3(l) 0 3 0
FI1: 2 3 0 4(l) 0 3 0
FI1: 1 3 0 3(e) 0 3 0
FI1: 2 3 0 4(e) 0 3 0
FI1: 1 3 0 3(x) 0 3 0
FI1: 2 3 0 4(x) 0 3 0
FI1: 1 3 0 3(1) 0 3 0
FI1: 2 3 0 4(2) 0 3 0
FI1: 1 3 0 3(1) 0 3 0
FI1: 2 3 0 4( ) 0 3 0
FI1: 1 3 0 3(2) 0 3 0
FI1: 2 3 0 4(M) 0 3 0
FI1: 1 3 0 3(3) 0 3 0
FI1: 2 3 0 4(o) 0 3 0
FI1: 1 3 0 3(4) 0 3 0
FI1: 2 3 0 4(r) 0 3 0
FI1: 1 3 0 3(5)* 0 2 0
[COLOR="#B22222"]FI1: 2 2 0 4(e)* 0 0 0[/COLOR]
******** After first output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3( ) 0 1 0
FI1: 3 3 0 3(s)4( ) 0 3 0
FI1: 3 3 0 3(e)4(F) 0 3 0
FI1: 3 3 0 3(c)4(l) 0 3 0
FI1: 3 3 0 3(o)4(e) 0 3 0
FI1: 3 3 0 3(n)4(x) 0 3 0
FI1: 3 3 0 3(d)4( ) 0 3 0
FI1: 3 3 0 3( )4(2) 0 3 0
FI1: 3 3 0 3(F)4( ) 0 3 0
FI1: 3 3 0 3(l)4(o) 0 3 0
FI1: 3 3 0 3(e)4(u) 0 3 0
FI1: 3 3 0 3(x)4(t) 0 3 0
FI1: 3 3 0 3( )4(p) 0 3 0
FI1: 3 3 0 3(o)4(u) 0 3 0
FI1: 3 3 0 3(u)4(t) 0 3 0
FI1: 3 3 0 3(t)4( ) 0 3 0
FI1: 3 3 0 3(p)4(a) 0 3 0
FI1: 3 3 0 3(u)4(g) 0 3 0
FI1: 3 3 0 3(t)4(a) 0 3 0
FI1: 3 3 0 3(1)*4(i) 0 2 0
[COLOR="#B22222"]FI1: 3 2 0 4(n)* 1 0 0[/COLOR]
******** After Second output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0

 *** Enter anything to run again ***
So you are going to say it looks like maybe it output the last stuff? BUT again the odd part...
screenshot.jpg
In each case it looks like the last character is output (as shown in RED, but in both cases the character is not shifted out. In the first set of outputs, it does get shifted out when the first byte is output of the next sequence...
 
So you are going to say it looks like maybe it output the last stuff? BUT again the odd part...

In each case it looks like the last character is output (as shown in RED, but in both cases the character is not shifted out. In the first set of outputs, it does get shifted out when the first byte is output of the next sequence...
Yeah, that's kind of what I wanted to check. It is strange. Its almost like you have to flush the last character or send a 0xff or 0x00 just to complete the sequence - think I saw that someplace but I cant remember what it was referring too.
 
@KurtE
Started playing again this morning and I did add a couple more debug prints to your callback function. In the SDK it has this as a test:
Code:
    /* Send data register empty and the interrupt is enabled. */
    if ((kFLEXIO_UART_TxDataRegEmptyFlag & status) && (base->flexioBase->SHIFTSIEN & (1U << base->shifterIndex[0])))
so I changed it to print this which I think is the same or equivalent:
Code:
Serial.printf(" (index %d, SDK flag %d)",_tx_shifter, (0x1 & p->SHIFTSTAT) && (p->SHIFTSIEN & (1U << _tx_shifter)));
Now when I run the example in post #27.

Code:
pin 3 maps to: 20000be0, port: 401ac000(FLEXIO1) pin 5
timer index: 0 shifter index: 0 mask: 1
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 0
SHIFTSTAT:0 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 0 0 0
SHIFTCFG:32 0 0 0
TIMCTL:1c00501 0 0 0
TIMCFG:2222 0 0 0
TIMCMP:f81 0 0 0
pin 4 maps to: 20000be0, port: 401ac000(FLEXIO1) pin 6
timer index: 1 shifter index: 1 mask: 2
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 40
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3 (index 0, SDK flag 1)(h!t1: F)* 0 0 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: l) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: e) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: x) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: 1)* 0 2 0
FI1: 2 2 0 4 (index 1, SDK flag 0)(h!t1: 2) 0 2 0
******** After first output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:2 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: s)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: M) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: c)4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: r) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: n)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: d)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: F)4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: 2) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)4 (index 1, SDK flag 0)(h!t1: u) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: p)4 (index 1, SDK flag 0)(h!t1: t) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: p) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)*4 (index 1, SDK flag 0)(h!t1: u) 0 2 0
FI1: 3 2 0 4 (index 1, SDK flag 1)(h!t1: t) 1 2 0
******** After Second output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:2 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
that flag seems to be set only for index 0? And if I hit return:
Code:
 *** Enter anything to run again ***
[COLOR="#FF0000"]FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: a) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1: g) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: 1)*4 (index 1, SDK flag 0)(h!t1: a) 0 2 0
FI1: 3 2 0 4 (index 1, SDK flag 1)(h!t1: i) 1 2 0[/COLOR]
******** After first output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:2 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: s)4 (index 1, SDK flag 0)(h!t1: n) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: c)4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: n)4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: d)4 (index 1, SDK flag 0)(h!t1: 2) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: F)4 (index 1, SDK flag 0)(h!t1: M) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: r) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: p)4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
[COLOR="#FF0000"]FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)*4 (index 1, SDK flag 0)(h!t1: 2) 0 2 0
FI1: 3 2 0 4 (index 1, SDK flag 1)(h!t1:  ) 1 2 0[/COLOR]
******** After Second output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:2 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0

 *** Enter anything to run again ***
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: F)* 0 2 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: u) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1: t) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: 1)*4 (index 1, SDK flag 0)(h!t1: p) 0 2 0
FI1: 3 2 0 4 (index 1, SDK flag 1)(h!t1: u) 1 2 0
Is it possible the index is getting messed some how?

PS: yes I changed a couple of the other prints just because.....
 
Hi @mjs513....

Not sure about the line: Serial.printf(" (index %d, SDK flag %d)",_tx_shifter, (0x1 & p->SHIFTSTAT) && (p->SHIFTSIEN & (1U << _tx_shifter)));

In particular the part in RED. Looks like it will only be TRUE if Index is 1...?
 
Hi @mjs513....

Not sure about the line: Serial.printf(" (index %d, SDK flag %d)",_tx_shifter, (0x1 & p->SHIFTSTAT) && (p->SHIFTSIEN & (1U << _tx_shifter)));

In particular the part in RED. Looks like it will only be TRUE if Index is 1...?

I converted that piece from the SDK code frag I posted:
Code:
kFLEXIO_UART_TxDataRegEmptyFlag & status
. In the SDK its was specified as
Code:
    kFLEXIO_UART_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */
just as an aside I extracted from here:
Code:
/*! @brief Define FlexIO UART status mask. */
enum _flexio_uart_status_flags
{
    kFLEXIO_UART_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */
    kFLEXIO_UART_RxDataRegFullFlag = 0x2U,  /*!< Receive buffer full flag. */
    kFLEXIO_UART_RxOverRunFlag = 0x4U,      /*!< Receive buffer over run flag. */
};

As I said just took a guess that was the right conversion.\

EDIT: Looking back at the output it does show for index 0, the SDK flag 1 which is from that serial output. Think I am interpreting right. Still playing and figuring things out. Index is _tx_shifter.
 
Hi @mjs513 - Still does not make sense to me... Maybe I am just being dense.

For example:
If you look at the SHIFTSEIN register P3049, the bits are defined for Transmit:
Code:
bits 3-0
SSIE
Shifter Status Interrupt Enable
Enables interrupt generation when corresponding SSF is set.
0b - Shifter Status Flag interrupt disabled.
1b - Shifter Status Flag interrupt enabled.

And SSF is defined in SHIFTSTAT: (P3046) -
Code:
3-0
SSF
Shifter Status Flag
The shifter status flag is updated when one of the following events occurs:
For SMOD=Receive, the status flag is set when SHIFTBUF has been loaded with data from Shifter
(SHIFTBUF is full), and the status flag is cleared when SHIFTBUF register is read.
For SMOD=Transmit, the status flag is set when SHIFTBUF data has been transferred to the Shifter
(SHIFTBUF is empty) or when initially configured for SMOD=Transmit, and the status flag is cleared
when the SHIFTBUF register is written.
For SMOD=Match Store, the status flag is set when a match has occured between SHIFTBUF and
Shifter, and the status flag is cleared when the SHIFTBUF register is read.
For SMOD=Match Continuous, returns the current match result between the SHIFTBUF and Shifter.
For SMOD=State, the status flag for a shifter will set when it is selected by the current state pointer.
For SMOD=Logic, returns the current value of the programmable logic block output.
The status flag can also be cleared by writing a logic one to the flag for all modes except Match
Continuous/State/Logic.
0b - Status flag is clear.
1b - Status flag is set.
Note: These bits are W1C where as the SHIFTSEIN they are simply READ/WRITE...

Again :confused:
 
@KurtE
Confused is the normal state for me :) Guess I will have to go back to the manual and bounce the two off each other. Either that or I can run the SDK interrupt example on the 1062EVKB and try to duplicate what is being done in the sketch to see what happens :) Waiting for wife at Dr's now so may be awhile....
 
@KurtE
I loaded up the interrupt SDK example on the 1062EVKB and saw a couple of things. First, the way the sdk is set up is it transmits on one pin and recieives on another. So I hooked up the USB converter to the pc and opened the serial monitor. Sent it a input string of "12345678":
Code:
12345  (CR/NL) 1st send 12345678
678    (CR/NL) 2nd send 12345678
123

45678  (NL)  3rd send 12345678
1

Do a reset and select no line ending
12345678
not sure it means anything for us or just a quirk with the SDK.

But played some more with padding the shorter prints with spacers instead of number, i.e.,
Code:
  SerialFlex.printf("Flex1     ");
  SerialFlex2.printf("Flex2 More");
…
  SerialFlex.print(" second Flex output     ");
  SerialFlex2.print(" Flex 2 output again");
and I think it worked this time>>>>> heres the output:
Code:
pin 3 maps to: 20000bf0, port: 401ac000(FLEXIO1) pin 5
timer index: 0 shifter index: 0 mask: 1
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 0
SHIFTSTAT:0 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 0 0 0
SHIFTCFG:32 0 0 0
TIMCTL:1c00501 0 0 0
TIMCFG:2222 0 0 0
TIMCMP:f81 0 0 0
pin 4 maps to: 20000bf0, port: 401ac000(FLEXIO1) pin 6
timer index: 1 shifter index: 1 mask: 2
Before configure flexio
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 40
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=0
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3 (index 0, SDK flag 1)(h!t1: F) 0 1 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: l) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: e) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: x) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1: 1) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: 2) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  ) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  ) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: M) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  ) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  ) 0 3 0
FI1: 2 3 0 4 (index 1, SDK flag 0)(h!t1: r) 0 3 0
FI1: 1 3 0 3 (index 0, SDK flag 1)(h!t1:  )* 0 2 0
FI1: 2 2 0 4 (index 1, SDK flag 0)(h!t1: e)* 0 0 0
******** After first output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3 (index 0, SDK flag 1)(h!t1:  )* 0 0 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: s)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: c)4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: n)4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: d)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: 2) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: F)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: u) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1: t) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: p) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: u) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: t) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: p)4 (index 1, SDK flag 0)(h!t1: a) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: g) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)4 (index 1, SDK flag 0)(h!t1: a) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: i) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: n)* 0 1 0
FI1: 3 1 0 3 (index 0, SDK flag 1)(h!t1:  ) 2 1 0
FI1: 3 1 2 3 (index 0, SDK flag 1)(h!t1:  )(err) 4$ 0 1 0
FI1: 3 1 0 3 (index 0, SDK flag 1)(h!t1:  )* 2 0 0
on second output:
Code:
 *** Enter anything to run again ***
FI1: 3 1 2 3 (index 0, SDK flag 1)(h!t1: F)(err) 4$ 0 1 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: 1)4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: 2) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: M) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )*4 (index 1, SDK flag 0)(h!t1: r) 0 2 0
FI1: 3 2 0 4 (index 1, SDK flag 1)(h!t1: e)* 1 0 0
******** After first output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:1 SHIFTERR=0 TIMSTAT=3
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
FI1: 1 1 0 3 (index 0, SDK flag 1)(h!t1:  )* 0 0 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: s)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: F) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: c)4 (index 1, SDK flag 0)(h!t1: l) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: e) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: n)4 (index 1, SDK flag 0)(h!t1: x) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: d)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: 2) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: F)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: l)4 (index 1, SDK flag 0)(h!t1: o) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: e)4 (index 1, SDK flag 0)(h!t1: u) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: x)4 (index 1, SDK flag 0)(h!t1: t) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: p) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: o)4 (index 1, SDK flag 0)(h!t1: u) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: t) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)4 (index 1, SDK flag 0)(h!t1:  ) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: p)4 (index 1, SDK flag 0)(h!t1: a) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: u)4 (index 1, SDK flag 0)(h!t1: g) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1: t)4 (index 1, SDK flag 0)(h!t1: a) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: i) 0 3 0
FI1: 3 3 0 3 (index 0, SDK flag 1)(h!t1:  )4 (index 1, SDK flag 0)(h!t1: n)* 0 1 0
FI1: 3 1 0 3 (index 0, SDK flag 1)(h!t1:  ) 2 1 0
FI1: 3 1 2 3 (index 0, SDK flag 1)(h!t1:  )(err) 4$ 0 1 0
FI1: 3 1 0 3 (index 0, SDK flag 1)(h!t1:  )* 2 0 0
******** After Second output ************
CCM_CDCDR: 33f71f92
VERID:1010001 PARAM:2100808 CTRL:1 PIN: 60
SHIFTSTAT:3 SHIFTERR=2 TIMSTAT=3
SHIFTSIEN:0 SHIFTEIEN=0 TIMIEN=0
SHIFTSDEN:0 SHIFTSTATE=0
SHIFTCTL:30502 1030602 0 0
SHIFTCFG:32 32 0 0
TIMCTL:1c00501 1c00601 0 0
TIMCFG:2222 2222 0 0
TIMCMP:f81 f81 0 0
Don't know just throwing things out there and seeing if something clicks..... Now to read the manual.
 
@mjs513 (and others) - I may have fixed my multiple FlexSerial transmit issue...

I believe: The TIMCTL register did not have the right TRGSEL value (I think).
I think it needs to 4* Shifter number + 1 (was hard coded to 1) so was specific to shifter 0...

The documentation for this at times is a bit confusing.
Code:
Trigger Select
The valid values for TRGSEL will depend on the FLEXIO_PARAM register.
• When TRGSRC = 1, the valid values for N will depend on PIN, TIMER, SHIFTER fields in the
FLEXIO_PARAM register.
• When TRGSRC = 0, the valid values for N will depend on TRIGGER field in FLEXIO_PARAM
register.
Refer to the chip configuration section for external trigger selection.
NOTE: For a pin, N=0 to 31. For a Shifter/Timer, N=0 to 3.
The internal trigger selection is configured as follows:
• 4*N - Pin 2*N input
• 4*N+1 - Shifter N status flag
• 4*N+2 - Pin 2*N+1 input
• 4*N+3 - Timer N trigger output

At least I think my two FlexSerial on pins 3 and 4 appears to be working now. Will try the big one next
 
:D - looks like the big test may be working now...
screenshot.jpg

EDIT: Although turning off debug appears to cause things to not work right??? So still debugging
 
The debug prints? If so, try enabling the lpuart clock, CANFD wont work without lpuart clock enabled....
 
Thanks @tonton81 - CANFD - needs LUPUART... Looks like they are pretty similar in the clock tree...

As for this one, I isolated down which set of Serial.printf(...) statements when disabled caused things to screw up.
At first I thought maybe it was because these prints, were outputting most of the FlexIO registers, so maybe one or more of them needed to be read... So I put code in to read all of them, and still failed. However if I add a delay(1) it works, which is how I left it. As this is done on the FlexSerial::begin() method, not worried about a 1ms delay...

So hopefully things are now working OK (fingers crossed)
 
@KurtE
Cool that you got FlexIO Serial working. I read that section a couple of times and still gets me confused. :) Nothing new :)

Yeah - FlexCAN seems to need LPUART enabled to work for some reason. If we don't enable it just hangs on initialization. Worked before in testing because it was enabled in startup.c because debug.prints were turned on.
 
I know what you mean, some of these descriptions are not very obvious. And their examples are like here is it working on Pin X timer0 shifter 0... No where to they explain how each of the fields in their example would change if they changed one of those parameters...

Next hurtle, is so far I have not done SerialFlex.flush()... I had a version for awhile that was hanging.

I can easily (in theory) get flush to go until the queue is empty, but not sure yet on how to get it to wait until the last byte transferred. I am going to try to hack in maybe setting a timer interrupt at this point and see what it does... But that is just a guess!
 
Just an FYI - I just pushed up an update, that I believe makes flush work reasonably well.

The simple version that simply waits for us to output the last byte in the queue into the shift buffer is not sufficient. It would end up returning from flush() with part of two characters left to be output.

So this version enables the Timer interrupt to happen when we sense that our queue is empty, and then we need to process two of these timer interrupts. On the second one we disable it and set the flag that says that we are no longer transmitting. If we do another write after we start up the trigger, we reset the timer status and again turn off the ISR...

I added a one second timeout into flush() in case it totally hangs.

Again depending on if anyone is going to use this, I could add in the Transmitter Enable pin code...
 
Hi.
Is there any example source code using FlexioSPI as slave with DMA?
I also have a question, can I choose any group of free pins of Flexio1 or Flexio2 ?, I need to add a SPI port to my application, but the LPSPIs are busy, so it just occurs to me that maybe it could be done with Flexio.

In MCUXpresso I do see example sources for the RT1062 for this development, I suppose the same could be done with Teensy 4.

Regards
 
Sorry to be bumping this old thread, but Kurt - you're my best option right now to point out if anything is missing and it's relevant to the content of this thread.

After I successfully got FlexIO to wring 8 bit parallel data on a single shifter/timer in a blocking method and driving an ILI9488, I now want to get all 8 shifters working and loading them with data via DMA.

The code attached has been referenced from two sources, NXP's RT1050 FlexIO lcd demo, and the KL28 FlexIO lcd demo.
It has been setup for a Teensy 4.0/4.1 using FlexIO pins 0-3. Pin 0 is routed to Timer0 output and pins 1-3 are to the shifters output

If I understand what is being done - a DMA channel has been set up to load 32 bytes of data into the 8 shifters as a minor loop iteration. It will go through so many major loops based on the length of the data/32.
Once it has gotten through all the minor loops (in my test code, just 1) it will complete the major loop and trigger the interrupt and completion.

For some reason, it's not triggering. I can only blame the DMA setup I have written, as I am not understanding some of the register settings or missing something crucial?
 

Attachments

  • FlexIO_MultiBeat_DMA_demo.ino
    10.3 KB · Views: 57
@Rezo

I took a look through your code. Your DMA and FlexIO setups look good. The problem seems to be that FlexIO1 and FlexIO2 shifters 0-3 are the only ones that can generate DMA requests. I believe Shifters 4-7 do not have that capability. (Nor do any of the FlexIO3 shifters.)

The following line of code in your FlexIO setup selects shifter 7 to generate DMA requests (SHIFTNUM is defined to be 8):
Code:
p->SHIFTSDEN |= 1U << (SHIFTNUM-1);
However, the reference manual says that you can only select shifters 0-3 here (section 50.5.1.12, page 2923).

Also, the following line of code in your DMA setup selects the DMA request from shifter 0, not shifter 7:
Code:
flexDma.triggerAtHardwareEvent( DMAMUX_SOURCE_FLEXIO2_REQUEST0 );
If you take a look at the list of DMA requests in the manual (Table 4-3, page 52) it only lists FlexIO1 and FlexIO2 Requests 0 through 3. Therefore, I believe that shifters 4-7 cannot generate DMA requests.

However, I think it's fine to use a different shifter for your DMA request, since all of the shifter status flags should be set simultaneously with your setup.

I would also suggest 32 bit source size for your DMA transfer (instead of 8 bit) to speed up the DMA process by about 4x, and I left a few other comments tagged with my initials (EVE)...
 

Attachments

  • FlexIO_MultiBeat_DMA_demo.ino
    16.1 KB · Views: 51
Sorry, I have been distracted..

My assumption as well that Shifters 4-7 do not have DMA Source associated with them.

Also note: That there are only two DMA Sources on FlexIO1 and 2 on Flex IO2 and none on FlexIO3

And that each of these sources handle two shifters, so you can use it on one or the other...
 
KurtE said:
Also note: That there are only two DMA Sources on FlexIO1 and 2 on Flex IO2 and none on FlexIO3
Well aware of FlexIO 3 not supporting DMA, but its good to be explicit about it for others that might come across this thread/post

KurtE said:
And that each of these sources handle two shifters, so you can use it on one or the other...
Which shifters can the sources handle? Is it shifters 0&1? The reference manual is not clear on the sources or the triggers.

I've messaged NXP over at the support center to get some clarifications on this matter as the RT1050 and KL28 FlexIO LCD demo's uses the 8th shifter as the DMA trigger source.
 
Here's my interpretation of Table 4-3 in the manual:

DMA signal 0 = FlexIO1 Shifter 0 OR Shifter 1
DMA signal 1 = FlexIO2 Shifter 0 OR Shifter 1
DMA signal 64 = FlexIO1 Shifter 2 OR Shifter 3
DMA signal 65 = FlexIO2 Shifter 2 OR Shifter 3

If there are any signals for shifters 4-7, they are not documented and not defined in the Teensy core...
 
Thanks Eric, that's makes more sense to me.

So I changed the number of shifters used to 4 and updated the trigger to DMA signal 65
And now I get a DMA error from the error register.
I'm using the map on page 123 to figure out what each bit being set it causing the error, but I can't get to a point where it's happy with the setup.

Attached is a revised sketch, and the current error I get is 0x800000F0

ATTACH]25835[/ATTACH]
 

Attachments

  • FlexIO_MultiBeat_DMA_demo_2.ino
    16.9 KB · Views: 57
Back
Top