Forum Rule: Always post complete source code & details to reproduce any issue!
Page 152 of 174 FirstFirst ... 52 102 142 150 151 152 153 154 162 ... LastLast
Results 3,776 to 3,800 of 4350

Thread: Teensy 4.0 First Beta Test

  1. #3776
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354

    FreqMeasureMulti Fails to compile

    I was able to successfully compile the serial.ino FreqMeasure example, but failed to compile the FreqMeasureMulti serial.ino example for Teensy 4-Beta2.
    The Arduino IDE returned the following errors:
    Code:
    Error compiling for board Teensy 4-BETA2
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp: In member function 'bool FreqMeasureMulti::begin(uint32_t, uint8_t)':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:48:59: error: 'PORT_PCR_MUX' was not declared in this scope
       case 22: channel = 0; CORE_PIN22_CONFIG = PORT_PCR_MUX(4); break;
                                                               ^
    In file included from C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/core_pins.h:32:0,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/wiring.h:38,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                     from C:\Users\Rober\AppData\Local\Temp\arduino_build_67275/pch/Arduino.h:6,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.h:4,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:27:
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:77:19: error: 'IRQ_FTM0' was not declared in this scope
      NVIC_DISABLE_IRQ(IRQ_FTM0);
                       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/imxrt.h:8293:52: note: in definition of macro 'NVIC_DISABLE_IRQ'
     #define NVIC_DISABLE_IRQ(n)     (*(&NVIC_ICER0 + ((n) >> 5)) = (1 << ((n) & 31)))
                                                        ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:78:6: error: 'FTM0_MOD' was not declared in this scope
      if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM_SC_VALUE) {
          ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:78:29: error: 'FTM0_SC' was not declared in this scope
      if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM_SC_VALUE) {
                                 ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:29:23: error: 'FTM_SC_TOIE' was not declared in this scope
     #define FTM_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
                           ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:78:48: note: in expansion of macro 'FTM_SC_VALUE'
      if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM_SC_VALUE) {
                                                    ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:29:50: error: 'FTM_SC_CLKS' was not declared in this scope
     #define FTM_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
                                                      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:78:48: note: in expansion of macro 'FTM_SC_VALUE'
      if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM_SC_VALUE) {
                                                    ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:29:65: error: 'FTM_SC_PS' was not declared in this scope
     #define FTM_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
                                                                     ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:78:48: note: in expansion of macro 'FTM_SC_VALUE'
      if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM_SC_VALUE) {                                                ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:80:3: error: 'FTM0_CNT' was not declared in this scope
       FTM0_CNT = 0;
       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:95:28: error: 'FTM0_C0SC' was not declared in this scope
      volatile uint32_t *csc = &FTM0_C0SC + channel * 2;
                                ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:30:26: error: 'FTM_CSC_CHIE' was not declared in this scope
     #define FTM_CSC_RAISING (FTM_CSC_CHIE | FTM_CSC_ELSA)
                              ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:100:9: note: in expansion of macro 'FTM_CSC_RAISING'
      *csc = FTM_CSC_RAISING; // first capture is always rising
             ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:30:41: error: 'FTM_CSC_ELSA' was not declared in this scope
     #define FTM_CSC_RAISING (FTM_CSC_CHIE | FTM_CSC_ELSA)
                                             ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:100:9: note: in expansion of macro 'FTM_CSC_RAISING'
      *csc = FTM_CSC_RAISING; // first capture is always rising
             ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp: In member function 'void FreqMeasureMulti::end()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:173:28: error: 'FTM0_C0SC' was not declared in this scope
      volatile uint32_t *csc = &FTM0_C0SC + channel * 2;
                               ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp: In function 'void ftm0_isr()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:180:6: error: 'FTM0_SC' was not declared in this scope
      if (FTM0_SC & FTM_SC_TOF) {
          ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:180:16: error: 'FTM_SC_TOF' was not declared in this scope
      if (FTM0_SC & FTM_SC_TOF) {
                    ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:189:17: error: 'FTM0_STATUS' was not declared in this scope
      uint8_t mask = FTM0_STATUS & channelmask;
                     ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp: In member function 'void FreqMeasureMulti::isr(bool)':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqMeasureMulti\FreqMeasureMulti.cpp:206:28: error: 'FTM0_C0SC' was not declared in this scope
      volatile uint32_t *csc = &FTM0_C0SC + channel * 2;
                                ^
    Error compiling for board Teensy 4-Beta2.
    I noticed that Paul had made modifications to FreqMeasure in January.
    Also FreqCount and FreqTimer2 Failed... I'll list the errors separately below.
    Let me know if this is not appropriate.
    Last edited by Wozzy; 07-21-2019 at 09:05 PM. Reason: clarify formatting

  2. #3777
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354

    FreqCount Fails to compile.

    Below are the errors returned by the Arduino IDE when compiling the FreqCount serial_output.ino example for Teensy 4-Beta2:
    Code:
    Error compiling for board Teensy 4-BETA2
    In file included from C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:27:0:
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\util/FreqCountTimers.h:64:4: error: #error "Unknown chip, please edit me with timer+counter definitions"
       #error "Unknown chip, please edit me with timer+counter definitions"
        ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp: In static member function 'static void FreqCountClass::begin(uint16_t)':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:44:15: error: 'counter_init' was not declared in this scope
      counter_init();
                   ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:45:31: error: 'timer_init' was not declared in this scope
      gate_length = timer_init(msec);
                                   ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:46:19: error: 'SREG' was not declared in this scope
      uint8_t status = SREG;
                       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:48:14: error: 'timer_start' was not declared in this scope
      timer_start();
                  ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:50:16: error: 'counter_start' was not declared in this scope
      counter_start();
                    ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp: In static member function 'static uint32_t FreqCountClass::read()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:64:11: error: 'SREG' was not declared in this scope
      status = SREG;
               ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp: In static member function 'static void FreqCountClass::end()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:79:17: error: 'timer_shutdown' was not declared in this scope
      timer_shutdown();
                     ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:80:19: error: 'counter_shutdown' was not declared in this scope
      counter_shutdown();
                       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp: At global scope:
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FreqCount\FreqCount.cpp:84:4: error: expected constructor, destructor, or type conversion before '(' token
     ISR(TIMER_ISR_VECTOR)
        ^
    Error compiling for board Teensy 4-Beta2.
    Last edited by Wozzy; 07-21-2019 at 09:06 PM.

  3. #3778
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354

    FrequencyTimer2 fails to compile

    Below are the errors returned by the Arduino IDE when compiling the FrequencyTimer2 test.ino sketch example for Teensy 4-Beta2:
    Code:
    Error compiling for board Teensy 4-BETA2
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp: In static member function 'static void FrequencyTimer2::setPeriod(long unsigned int)':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:190:13: error: 'F_BUS' was not declared in this scope
      period *= (F_BUS / 1000000);
                 ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:301:2: error: 'SIM_SCGC4' was not declared in this scope
      SIM_SCGC4 |= SIM_SCGC4_CMT;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:301:15: error: 'SIM_SCGC4_CMT' was not declared in this scope
      SIM_SCGC4 |= SIM_SCGC4_CMT;
                   ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:302:2: error: 'CMT_MSC' was not declared in this scope
      CMT_MSC = 0;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:303:2: error: 'CMT_PPS' was not declared in this scope
      CMT_PPS = bdiv;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:304:2: error: 'CMT_CMD1' was not declared in this scope
      CMT_CMD1 = ((period - 1) >> 8) & 255;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:305:2: error: 'CMT_CMD2' was not declared in this scope
      CMT_CMD2 = (period - 1) & 255;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:306:2: error: 'CMT_CMD3' was not declared in this scope
      CMT_CMD3 = (period >> 8) & 255;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:307:2: error: 'CMT_CMD4' was not declared in this scope
      CMT_CMD4 = period & 255;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:308:2: error: 'CMT_OC' was not declared in this scope
      CMT_OC = 0x60;
      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp: In static member function 'static long unsigned int FrequencyTimer2::getPeriod()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:316:12: error: 'CMT_CMD3' was not declared in this scope
      period = (CMT_CMD3 << 8) | CMT_CMD4;
                ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:316:29: error: 'CMT_CMD4' was not declared in this scope
      period = (CMT_CMD3 << 8) | CMT_CMD4;
                                 ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:317:13: error: 'CMT_PPS' was not declared in this scope
      period *= (CMT_PPS + 1);
                 ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:318:15: error: 'CMT_MSC' was not declared in this scope
      period <<= ((CMT_MSC >> 5) & 3) + 4;
                   ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:319:13: error: 'F_BUS' was not declared in this scope
      period /= (F_BUS / 1000000);
                 ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp: In static member function 'static void FrequencyTimer2::enable()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:326:35: error: 'PORT_PCR_MUX' was not declared in this scope
      CORE_PIN5_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_DSE|PORT_PCR_SRE;
                                       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:326:37: error: 'PORT_PCR_DSE' was not declared in this scope
      CORE_PIN5_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_DSE|PORT_PCR_SRE;
                                         ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:326:50: error: 'PORT_PCR_SRE' was not declared in this scope
      CORE_PIN5_CONFIG = PORT_PCR_MUX(2)|PORT_PCR_DSE|PORT_PCR_SRE;
                                                      ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp: In static member function 'static void FrequencyTimer2::disable()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:332:35: error: 'PORT_PCR_MUX' was not declared in this scope
      CORE_PIN5_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_DSE|PORT_PCR_SRE;
                                       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:332:37: error: 'PORT_PCR_DSE' was not declared in this scope
      CORE_PIN5_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_DSE|PORT_PCR_SRE;
                                         ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:332:50: error: 'PORT_PCR_SRE' was not declared in this scope
      CORE_PIN5_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_DSE|PORT_PCR_SRE;
                                                      ^
    In file included from C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/core_pins.h:32:0,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/wiring.h:38,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                     from C:\Users\Rober\AppData\Local\Temp\arduino_build_13904/pch/Arduino.h:6,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2/FrequencyTimer2.h:27,
                     from C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:30:
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp: In static member function 'static void FrequencyTimer2::setOnOverflow(void (*)())':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:340:19: error: 'IRQ_CMT' was not declared in this scope
       NVIC_ENABLE_IRQ(IRQ_CMT);
                       ^
    C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/imxrt.h:8292:52: note: in definition of macro 'NVIC_ENABLE_IRQ'
     #define NVIC_ENABLE_IRQ(n)      (*(&NVIC_ISER0 + ((n) >> 5)) = (1 << ((n) & 31)))
                                                        ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:342:20: error: 'IRQ_CMT' was not declared in this scope
       NVIC_DISABLE_IRQ(IRQ_CMT);
                        ^
    C:\Arduino189_T147B4\hardware\teensy\avr\cores\teensy4/imxrt.h:8293:52: note: in definition of macro 'NVIC_DISABLE_IRQ'
     #define NVIC_DISABLE_IRQ(n)     (*(&NVIC_ICER0 + ((n) >> 5)) = (1 << ((n) & 31)))
                                                        ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp: In function 'void cmt_isr()':
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:351:40: error: 'CMT_MSC' was not declared in this scope
      uint8_t __attribute__((unused)) tmp = CMT_MSC;
                                            ^
    C:\Arduino189_T147B4\hardware\teensy\avr\libraries\FrequencyTimer2\FrequencyTimer2.cpp:352:8: error: 'CMT_CMD2' was not declared in this scope
      tmp = CMT_CMD2;
            ^
    Error compiling for board Teensy 4-Beta2.

  4. #3779
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    @Kurt,

    I'm having problem, getting updateScreenAsync(true) to work, with your ILI9341_t3n library. Is the "master" branch the right one?
    Does it work, or am I doing something wrong? It's not the cache - it just don't work for me (no continous screen-update)
    Can you please post a short example?

    Thank you, Frank.

  5. #3780
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    Quote Originally Posted by manitou View Post
    One possible use of GPT1 is for FreqCount (pin 25 is the external trigger). Here is a proof-of-concept (32-bit counter)
    https://github.com/manitou48/teensy4.../gpt_count.ino
    Jumper PWM pin 11 to 25 for testing.

    GPTn can also do PWM, but NONE of the GPTn output pins are available on T4 (1050).
    Hi @manitou

    Just getting around to play with this now again. Was trying to get it to work on GPT2 using your code as the base - GPT2_clk is on pin 14 as alt8 - unless my eyes are getting crossed it that is right then should be easy enough to convert your sketch - but all I get is 0 as outputs - what am I missing here:
    Code:
    // GPT1 counter like FreqCount
    // external pin is 14 GPIO_AD_B1_02 ALT8  (Frontside - A0)
    // test with  PWM pin 11 jumpered to 14
    
    // FreqCount API
    static inline void counter_init(void)
    {
      CCM_CCGR0 |= CCM_CCGR0_GPT2_BUS(CCM_CCGR_ON) ;  // enable GPT1 module
      //CCM_CCGR0 |= CCM_CCGR0_GPT2_SERIAL(CCM_CCGR_ON) ;
      GPT2_CR = 0;
      GPT2_SR = 0x3F; // clear all prior status
      GPT2_CR =  GPT_CR_CLKSRC(3);// | GPT_CR_FRR ;// 3 external clock
      //*(portConfigRegister(14)) = 8;  // ALT 1
      //CORE_PIN14_CONFIG = 8; 
      IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_02 = 8;
    }
    
    static inline void counter_start(void)
    {
      GPT2_CR |= GPT_CR_EN; // enable
    }
    
    static inline void counter_shutdown(void)
    {
      GPT2_CR = 0;
    }
    
    static inline uint32_t counter_read(void)  // was uint16_t in FreqCount?
    {
      return GPT2_CNT;
    }
    
    static inline uint8_t counter_overflow(void)
    {
      return GPT2_SR & GPT_SR_ROV;
    }
    
    static inline void counter_overflow_reset(void)
    {
      GPT2_SR |= GPT_SR_ROV;
    }
    
    volatile uint32_t count_ready, count_output, count_prev;
    void tmr_callback() {
      uint32_t count = counter_read();
    
      //track rollover ?
      count_output = count - count_prev;
      count_prev = count;
      count_ready = 1;
    }
    
    IntervalTimer it1;
    
    void setup() {
      Serial.begin(9600);
      while (!Serial);
      delay(2000);
      analogWriteFrequency(11, 1234);  // test jumper 11 to 25
      analogWrite(11, 128);
    
      counter_init();
      it1.begin(tmr_callback, 1000000);  // us
      counter_start();
    
    }
    
    void loop() {
      if (count_ready) {
        Serial.println(count_output);
        count_ready = 0;
      }
    }

  6. #3781
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,231
    Quote Originally Posted by mjs513 View Post
    Hi @manitou

    Just getting around to play with this now again. Was trying to get it to work on GPT2 using your code as the base - GPT2_clk is on pin 14 as alt8 - unless my eyes are getting crossed it that is right then should be easy enough to convert your sketch - but all I get is 0 as outputs - what am I missing here:
    I never tried it on 1062 cause my breakout board doesn't have pogo pin on pin 25. It should work with pin 25 just like it does with 1050.

    i've not tried GPT2 -- GPT2 CLK pin is not listed in table in post #3? can you pogo pin 25 and try GPT1

    EDIT: i think more pin magic is required, since the ALT8 config is the 2nd choice. there is another config command ... looking ....

    you need to set low bit in IOMUXC_GPT2_IPP_IND_CLKIN_SELECT_INPUT (ref pg 1000)

  7. #3782
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,563
    Quote Originally Posted by Frank B View Post
    @Kurt,

    I'm having problem, getting updateScreenAsync(true) to work, with your ILI9341_t3n library. Is the "master" branch the right one?
    Does it work, or am I doing something wrong? It's not the cache - it just don't work for me (no continous screen-update)
    Can you please post a short example?

    Thank you, Frank.
    I will take a look, but I am away from desk, so might be in a while.

  8. #3783
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    Quote Originally Posted by manitou View Post
    I never tried it on 1062 cause my breakout board doesn't have pogo pin on pin 25. It should work with pin 25 just like it does with 1050.

    i've not tried GPT2 -- GPT2 CLK pin is not listed in table in post #3? can you pogo pin 25 and try GPT1
    @manitou - yep it does work on pin 25 gave it a try first - Sermon shows 1234, which is what you set up for analogWriteFreq

    I was curious so I took a look at the 1060 manual and saw what AD_B1_02 shows GPT2_CLK as alt8. So decided to give it a try since it is an edge pin. See page 490 of the RM. EDIT: also page 304

  9. #3784
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    Quote Originally Posted by KurtE View Post
    I will take a look, but I am away from desk, so might be in a while.
    Not sure but you may want t4-beta branch? https://github.com/KurtE/ILI9341_t3/tree/T4_Beta

  10. #3785
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,231
    Quote Originally Posted by mjs513 View Post
    @manitou - yep it does work on pin 25 gave it a try first - Sermon shows 1234, which is what you set up for analogWriteFreq

    I was curious so I took a look at the 1060 manual and saw what AD_B1_02 shows GPT2_CLK as alt8. So decided to give it a try since it is an edge pin. See page 490 of the RM. EDIT: also page 304
    i edited my previous post ....you need to set low bit in IOMUXC_GPT2_IPP_IND_CLKIN_SELECT_INPUT (ref pg 1000)

  11. #3786
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    Quote Originally Posted by manitou View Post
    i edited my previous post ....you need to set low bit in IOMUXC_GPT2_IPP_IND_CLKIN_SELECT_INPUT (ref pg 1000)
    Yep - that got it. Now showing 1234
    Should have know because I had to do that when playing with FLEXCAN. Argh.

  12. #3787
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,231
    Quote Originally Posted by mjs513 View Post
    Yep - that got it. Now showing 1234
    Should have know because I had to do that when playing with FLEXCAN. Argh.
    Right. it is such an intuitive architecture

  13. #3788
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,563
    @Frank B @mjs513 and ...

    Quote Originally Posted by KurtE View Post
    I will take a look, but I am away from desk, so might be in a while.
    Now that I played for awhile, some of it is coming back to me.

    Actually today I started playing around with st7735_t3 library to add frame buffer and async support. I have some of it working now, it is up in the fork/branch: https://github.com/KurtE/ST7735_t3/tree/FB_Asynch

    In a test app for playing with, I hacked in some simple continuous update test... Which is NOT working:
    Code:
    void testContinuousUpdate() {
      Serial.println("Start Continuous update test");
      tft.fillScreen(ST7735_RED);
      tft.updateScreenAsync(true);
      Serial.println("After updateScreenAsync");
      while(tft.frameCount() < 10) {
      tft.fillScreen(ST7735_GREEN);
      while(tft.frameCount() < 20) ;
      tft.fillScreen(ST7735_BLUE);
      while(tft.frameCount() < 30) ;
      tft.fillScreen(ST7735_RED);
      tft.drawRect(0,0, tft.width(), tft.height(), ST7735_BLUE);
      tft.setCursor(10, tft.height() / 2 - 4);
      tft.printf("R:%d W:%d H:%d", rotation, tft.width(), tft.height());
      while(tft.frameCount() < 35) ;
      Serial.println("Finished all frames");
      tft.endUpdateAsync();
      Serial.println("After call to endUpdateAsync");
      while (tft.asyncUpdateActive());  
      Serial.println("Test completed");
    }
    The output on debug terminal...
    Code:
    init CS:10 DC:9 MOSI:11 SCLK:13 RST:20
     Row Start:3  Col Start: 2
    Set Rotation: 0 width: 128 height: 128
    Hit any key to continue
    Start Continuous update test
    After updateScreenAsync
    ....................................Finished all frames
    After call to endUpdateAsync
    So I have hang to figure out at end...

    BUT also the screen is all RED, never changed, after the first redraw...

    Why? Probably because, I did not set the frame buffer, but instead allowed to be allocated by malloc. So there is the issue that SPI is using the data in actual memory, but the main code is updating the cache...

    The first screen comes out correct, as I have code at the start of updateScreenAsync that does:
    // Maybe have to flush cache to make DMA work...
    if ((uint32_t)_pfbtft >= 0x20200000u) arm_dcache_flush(_pfbtft, _width*_height*2);

    The problem is that is the only place it is done. So updates are not flushed out.

    Question is who/where should do this again? With this small display I may see if I add a call like this to the DMA interrupt, if that will work, or will it miss caching out some of the first pixels....

    EDIT: adding a flush of cache in the ISR appears to help in this case

  14. #3789
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Thank you Kurt, I'll try that when I'm back home.
    I was pretty sure that it was no caching issue, but maybe I was wrong.

  15. #3790
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    FREQCOUNT LIBRARY

    @manitou and ….

    Using got the FreqCount library working with GPT2 which uses pin 14. If you want to test it out before I do a PR I am attaching the zip file.

    FreqCount.zip

    Probably have to add a few notes to the examples though for the T4

    EDIT: Think the max freq would be 37Mhz, approximately 1/4 IPG_CLK. I don't have a freq generator to test with just analogWriteFreq (not sure how high this can go)
    Last edited by mjs513; 07-22-2019 at 01:22 PM.

  16. #3791
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,563
    @Frank B - I will try it out again on the ILI9341_t3n code base, I easily could have left the continuous stuff not working on T4 there due to frustration with the caching and the like.

    The actual code snip-it I showed was my little test for the ST7735 display. Which appears to be working on it. Right now trying to also get the code in my branch/fork to compile and (maybe run) on T3.5. It does compile for T3.6. Will then do quick hook up to some boards to see what happens on those, At which time I will merge those back into my other temporary branch which has an outstanding PR into the master st7735_t3 code base.

    Edit: I now have it compiling on all three...

    However I now need to make it such that more than one display can be used with DMA... did not worry about it with ili9341 as only enough memory for one (although we T4), maybe 2?
    Last edited by KurtE; 07-22-2019 at 02:22 PM.

  17. #3792
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    @manitou

    I incorporated @Frank B modified QTimer code from @TelephoneBill into the FreqCount test sketch to see what I got:
    @1.5Mhz ==> 1499999
    @150Khz ==> 150000
    @ 15khz ==> 15000

    Not to bad. Is there a way to get Qtimer up to 15Mhz?

    Code:
    /* FreqCount - Example with serial output
     * http://www.pjrc.com/teensy/td_libs_FreqCount.html
     *
     * This example code is in the public domain.
     */
    #include <FreqCount.h>
    
    void setup() {
      Serial.begin(57600);
    
      pinMode(13, OUTPUT);              //pin 13 as digital output
    
      
      //enable clocks for QTIMER3
      CCM_CCGR6 |= 0xC0000000;                    //enable clocks to CG15 of CGR6 for QT3
    
      //configure QTIMER1 Timer0 for test. Period = 65,536 = 436.9 uS (times 2) - rollover
      TMR3_CTRL0 = 0b0000000000100000;  // stop all functions of timer 
      TMR3_SCTRL0 = 0b0100000000000001; // 0(TimerCompareFlag),1(TimerCompareIntEnable),000000,00(Capture Disabled),00000,1(OFLAG to Ext Pin)
      TMR3_CNTR0 = 0;
      TMR3_LOAD0 = 0;
      TMR3_COMP10 = 10000 -1;              // 6.7nS per clock = 66.7uS for 10,000 clocks on each half cycle
      TMR3_CMPLD10 = 10000 -1;
      TMR3_CSCTRL0 = 0b0000000001000001;  //Compare1 interrupt enable
      TMR3_CTRL0 = 0b0011000000100011;  // 001(Count rising edges Primary Source),1000(IP Bus Clock),00 (Secondart Source), 
                                        // 0(Count Once),1(Count up to Compare),0(Count Up),0(Co Channel Init),011(Toggle OFLAG on Compare)
      
      //configure Teensy pin Compare output
      IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00 = 1;    // QT3 Timer0 is now on pin 19
      
      //enable GPT1 interrupt within NVIC table
      attachInterruptVector(IRQ_QTIMER3, QT3_isr);  //declare which routine performs the ISR function
      NVIC_ENABLE_IRQ(IRQ_QTIMER3);
    
      
      FreqCount.begin(1000000);
    }
    
    void QT3_isr(void) {
      digitalWriteFast(13, 1);
      TMR3_SCTRL0 = 0b0100000000000001;
      TMR3_CSCTRL0 = 0b0000000001000001;
      digitalWriteFast(13, 0);
      asm volatile("dsb");
    }
    
    void loop() {
      if (FreqCount.available()) {
        unsigned long count = FreqCount.read();
        Serial.println(count);
      }
    }
    EDIT: Just created PR #11 to the FreqCount Library
    Last edited by mjs513; 07-22-2019 at 03:10 PM.

  18. #3793
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    Quote Originally Posted by KurtE View Post
    @Frank B - I will try it out again on the ILI9341_t3n code base, I easily could have left the continuous stuff not working on T4 there due to frustration with the caching and the like.

    The actual code snip-it I showed was my little test for the ST7735 display. Which appears to be working on it. Right now trying to also get the code in my branch/fork to compile and (maybe run) on T3.5. It does compile for T3.6. Will then do quick hook up to some boards to see what happens on those, At which time I will merge those back into my other temporary branch which has an outstanding PR into the master st7735_t3 code base.

    Edit: I now have it compiling on all three...

    However I now need to make it such that more than one display can be used with DMA... did not worry about it with ili9341 as only enough memory for one (although we T4), maybe 2?
    Nice work Kurt - should be interesting if you can get it to work with 2 displays

  19. #3794
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,311
    Quote Originally Posted by KurtE View Post
    @Frank B - I will try it out again on the ILI9341_t3n code base, I easily could have left the continuous stuff not working on T4 there due to frustration with the caching and the like.

    The actual code snip-it I showed was my little test for the ST7735 display. Which appears to be working on it. Right now trying to also get the code in my branch/fork to compile and (maybe run) on T3.5. It does compile for T3.6. Will then do quick hook up to some boards to see what happens on those, At which time I will merge those back into my other temporary branch which has an outstanding PR into the master st7735_t3 code base.

    Edit: I now have it compiling on all three...

    However I now need to make it such that more than one display can be used with DMA... did not worry about it with ili9341 as only enough memory for one (although we T4), maybe 2?
    I think we've talked about this before in the context of uncanny eyes. As I understand it, unlike the T3.x, the T4 only has one CS pin for DMA access. I would imagine one technique would be to manage the CS pins for the actual display, doing the digitalWrite's manually when switching displays (making sure that the DMA queue is empty), and use pin 10 for the CS pin in the library, but don't actually connect that up to the displays.

    Or are you thinking of using the second SPI bus (pins 0, 1, 26, and 27)?

  20. #3795
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,231
    Quote Originally Posted by mjs513 View Post
    @manitou

    I incorporated @Frank B modified QTimer code from @TelephoneBill into the FreqCount test sketch to see what I got:
    @1.5Mhz ==> 1499999
    @150Khz ==> 150000
    @ 15khz ==> 15000

    Not to bad. Is there a way to get Qtimer up to 15Mhz?

    EDIT: Just created PR #11 to the FreqCount Library
    Don't you get 15 mhz with
    Code:
      TMR3_COMP10 = 5 -1;           
      TMR3_CMPLD10 = 5 -1;
    My scope shows 37MHz with "2-1"
    Code:
    // PWM qtimer 3 chnl 0 pin 19  16-bit timer
    //https://forum.pjrc.com/threads/54711-Teensy-4-0-First-Beta-Test?p=210440&viewfull=1#post210440
    
    void setup() {
      //enable clocks for QTIMER3
      CCM_CCGR6 |= CCM_CCGR6_QTIMER3(CCM_CCGR_ON);
    
      TMR3_CTRL0 = 0;  // stop  timer
      TMR3_SCTRL0 = TMR_SCTRL_OEN; // output enable
      TMR3_CNTR0 = 0;
      TMR3_LOAD0 = 0;
      TMR3_CMPLD10 = 2 - 1;
      TMR3_CSCTRL0 = TMR_CSCTRL_CL1(1);
      TMR3_CTRL0 =  TMR_CTRL_CM(1) | TMR_CTRL_PCS(8 ) | TMR_CTRL_LENGTH | TMR_CTRL_OUTMODE(3);
    
      //configure Teensy pin Compare output
      IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00 = 1;    // QT3 Timer0 on pin 19
    }
    
    void loop() {}
    Last edited by manitou; 07-23-2019 at 11:44 AM.

  21. #3796
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,207
    Quote Originally Posted by manitou View Post
    Don't you get 15 mhz with
    Code:
      TMR3_COMP10 = 5 -1;           
      TMR3_CMPLD10 = 5 -1;
    Best I can do and still get the FreqCount to give me output with 1000000us is with 17 -1; which reads 8822737hz. Same for freqMeasure. Have to pull out my scope to see what I am actually getting. Running out of room on my desk....

  22. #3797
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,231
    Quote Originally Posted by mjs513 View Post
    Best I can do and still get the FreqCount to give me output with 1000000us is with 17 -1; which reads 8822737hz. Same for freqMeasure. Have to pull out my scope to see what I am actually getting. Running out of room on my desk....
    FWIW, i added my sketch to post #3795

  23. #3798
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by KurtE View Post
    @Frank B - I will try it out again on the ILI9341_t3n code base,
    Hi Kurt,

    I modified now your graphicstest (attached to this post).
    Apart form the cache-issue (which is not really an issue, because we know how to solve it!), it stops/hangs:
    Code:
    ILI9341 Test!
    After TFT Begin
    13
    Screen fill              1171
    Text                     422
    Lines
    I've seen this in my own program, too.
    Attached Files Attached Files

  24. #3799
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,563
    Quote Originally Posted by MichaelMeissner View Post
    I think we've talked about this before in the context of uncanny eyes. As I understand it, unlike the T3.x, the T4 only has one CS pin for DMA access. I would imagine one technique would be to manage the CS pins for the actual display, doing the digitalWrite's manually when switching displays (making sure that the DMA queue is empty), and use pin 10 for the CS pin in the library, but don't actually connect that up to the displays.

    Or are you thinking of using the second SPI bus (pins 0, 1, 26, and 27)?
    Can probably do either: But if multiple ones on same SPI buss, you can obviously only do one at at a time using DMA...

    My ST7735_t3 branch/fork updated: https://github.com/KurtE/ST7735_t3/tree/FB_Asynch
    I have simple test program currently updating two displays I believe at same time:ST7735_t3_multiple-190722a.zip

    Which is going through lots of the Teensyview demo screens...
    Click image for larger version. 

Name:	IMG_0119.jpg 
Views:	4 
Size:	164.0 KB 
ID:	17056

    I probably want to test this out a little on at least T3.6 to see that it works before I then merge it into my other fork/branch with a current PR into the master...

  25. #3800
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by mjs513 View Post
    Best I can do and still get the FreqCount to give me output with 1000000us is with 17 -1; which reads 8822737hz. Same for freqMeasure. Have to pull out my scope to see what I am actually getting. Running out of room on my desk....
    The code is:
    Code:
      unsigned freq = 15000000; //15MHz or any other.. works up to F_BUS_ACTUAL / 2 = 75MHz (without overclocked F_BUS)
      TMR3_CMPLD10 = F_BUS_ACTUAL / 2 / freq - 1;
    Edit: Verified with my scope. It show a few Hz off - might be an issue with the scope.

Posting Permissions

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