Forum Rule: Always post complete source code & details to reproduce any issue!
Page 4 of 4 FirstFirst ... 2 3 4
Results 76 to 80 of 80

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

  1. #76
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,724
    Sorry, sometimes this stuff can be a pain in the ...

    That is why most of my flexIO system code includes debug stuff, like:
    Code:
    		// Lets print out some of the settings and the like to get idea of state
    		#ifdef DEBUG_FlexSerial
    		Serial.printf("CCM_CDCDR: %x\n", CCM_CDCDR);
    		Serial.printf("VERID:%x PARAM:%x CTRL:%x PIN: %x\n", p->VERID, p->PARAM, p->CTRL, p->PIN);
    		Serial.printf("SHIFTSTAT:%x SHIFTERR=%x TIMSTAT=%x\n", p->SHIFTSTAT, p->SHIFTERR, p->TIMSTAT);
    		Serial.printf("SHIFTSIEN:%x SHIFTEIEN=%x TIMIEN=%x\n", p->SHIFTSIEN, p->SHIFTEIEN, p->TIMIEN);
    		Serial.printf("SHIFTSDEN:%x SHIFTSTATE=%x\n", p->SHIFTSDEN, p->SHIFTSTATE);
    		Serial.printf("SHIFTCTL:%x %x %x %x\n", p->SHIFTCTL[0], p->SHIFTCTL[1], p->SHIFTCTL[2], p->SHIFTCTL[3]);
    		Serial.printf("SHIFTCFG:%x %x %x %x\n", p->SHIFTCFG[0], p->SHIFTCFG[1], p->SHIFTCFG[2], p->SHIFTCFG[3]);
    		Serial.printf("TIMCTL:%x %x %x %x\n", p->TIMCTL[0], p->TIMCTL[1], p->TIMCTL[2], p->TIMCTL[3]);
    		Serial.printf("TIMCFG:%x %x %x %x\n", p->TIMCFG[0], p->TIMCFG[1], p->TIMCFG[2], p->TIMCFG[3]);
    		Serial.printf("TIMCMP:%x %x %x %x\n", p->TIMCMP[0], p->TIMCMP[1], p->TIMCMP[2], p->TIMCMP[3]);
    So that I can go through and look at the actual state of each of the registers.

    It looked like you setup the interrupt vector and enabled it... So something should be called

    But also part of the flexio_t4 code is a function addIOHandlerCallback.... which sets up the ISR with it's own IRQ handler where you could setup callbacks for different timers...

    Beyond that I am not sure.

  2. #77
    Senior Member
    Join Date
    Oct 2019
    Posts
    240
    Quote Originally Posted by KurtE View Post
    But also part of the flexio_t4 code is a function addIOHandlerCallback.... which sets up the ISR with it's own IRQ handler where you could setup callbacks for different timers...
    I was hoping to try this, but couldn't find a code example of it.
    My interpretation was I setup my own callback function, and pass it in addIOHandlerCallback() - it gets called based on whichever interrupts I enabled on the relevant instance (timer interrupt, shifter interrupt or error interrup).
    But talking another look, Im not sure that's the way to do it.

  3. #78
    Senior Member
    Join Date
    Oct 2019
    Posts
    240
    @KurtE been trying to register a callback with addIOHandlerCallback but to no avail.
    I created a callback handler:
    Code:
    FlexIOHandlerCallback *cb;
    I pass cb to addIOHandlerCallback
    Code:
    addIOHandlerCallback(cb);
    I have my own callback function,
    Code:
    bool myCB(){
    return true;
    }
    But how to I assign myCB to the callback handler cb?

  4. #79
    @Rezo - I've made some good progress which might be useful to you. I successfully got the interrupt method working. Functional proof of concept here:
    https://github.com/easone/FlexIO_interrupt

    The ISR needs to clear the interrupt signal - this is done by writing to the TIMSTAT register in case of a timer status interrupt, or writing data to the shifter buffers in case of a shifter status interrupt. Although, one subtlety is that the shifter status interrupt also triggers after a transfer is complete, so you have to disable the interrupt signal in the SHIFTSIEN register once the transfer is done... It's not sufficient to write to the SHIFTSTAT register to clear that interrupt, because clearing the shifter status flag also triggers FlexIO to shift more data.

  5. #80
    Im just making sure i get the flex io right.

    I needed another spi bus on a project, all dedicated buses are already in use, so i looked into flexIO and i have some pins on the MicroMod teensy available (44, 46, 48, 73) which is part of flexIO "2" which should be fully featured with dma support?

    So im hoping this config is possible: pin 44 mosi, pin 46 miso, pin 48 clk, pin 73 cs.

    other then that, are there any downsides to using the flexIO for spi rather then the dedicated spi?
    Last edited by mah; 11-12-2021 at 03:04 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •