Forum Rule: Always post complete source code & details to reproduce any issue!
Page 155 of 173 FirstFirst ... 55 105 145 153 154 155 156 157 165 ... LastLast
Results 3,851 to 3,875 of 4311

Thread: Teensy 4.0 First Beta Test

  1. #3851
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    @manitou - I agree - just got my coffee and was getting ready to make the edits to use the quad timer for FreqCount. Will let you know when I get it done - still waking up here
    I just ran 75mhz test with two T4B2 (and common ground) and i too get a reduced count 68291533. So with single T4B2 the PWM/timer clocks must somehow be "sync'd" to enable proper counting of 75mhz signal. Not quite correct for 50mhz PWM, with two T4's get 48516240 ticks. Counts are OK with 37.5mhz from 2nd T4. Someone with a signal generator needs to measure the "effective range" of our quad timer external signal counter.
    Last edited by manitou; 07-25-2019 at 04:58 PM.

  2. #3852
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    @manitou - I agree - just got my coffee and was getting ready to make the edits to use the quad timer for FreqCount. Will let you know when I get it done - still waking up here
    if you are going to cascade quad timer channels to get 32 bits, you can choose a PWM pin that has unused channels and not have to consume a 2nd PWM pin. All 4 channels of QT3 are used for PWM. (T3 monitored OVERFLOW bit to roll 16-bit FMT counter to 32 bits.)

  3. #3853
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Quote Originally Posted by manitou View Post
    if you are going to cascade quad timer channels to get 32 bits, you can choose a PWM pin that has unused channels and not have to consume a 2nd PWM pin. All 4 channels of QT3 are used for PWM. (T3 monitored OVERFLOW bit to roll 16-bit FMT counter to 32 bits.)
    Took a couple of reads but I think I know what you mean Anyway I updated FreqCount so if you want to give it a try here it is. I am seeing that at 75Mhz I am reading about the same as you. At 50Mhz is still seems to be good. FreqCountQT.zip. This still uses pin 19 as the input pin.

  4. #3854
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    Took a couple of reads but I think I know what you mean Anyway I updated FreqCount so if you want to give it a try here it is. I am seeing that at 75Mhz I am reading about the same as you. At 50Mhz is still seems to be good. FreqCountQT.zip. This still uses pin 19 as the input pin.
    On my sketch with two T4's my 50mhz PWM is not quite correct
    Code:
    48501143
    48353799
    48377919
    48532923
    48548770

  5. #3855
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Quote Originally Posted by manitou View Post
    On my sketch with two T4's my 50mhz PWM is not quite correct
    Code:
    48501143
    48353799
    48377919
    48532923
    48548770
    Yep that's what I am getting - have to figure out what I did that its so low now. Just needed a check and balance

  6. #3856
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    @Paul, don't know when you plan to release a non-beta TD version.. we have to take a look at the audio-lib, first. Looks like I have added some bugs for T3 :-(

    Mainly a different sequence of code lines, which i thought to be harmless... !"$%&/()
    There are also some things missing for the T4. I'm on a short vacation next week, after that I can add the code for T4 I2S-Slave.

    input-adc(s) is missing, for example. I don't plan to do it, don't know the best way how to do it.

  7. #3857
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,697
    @mjs513 - put above freqCnt into sketch where the 7 Serial Ports connected between to T4's transfer short msgs. Then I tied pin #19 to pin #20 for TX5 data transitions (or #21 for RX5) and it seems to be giving reasonable numbers and not causing any trouble with the 7 serial# ports running.

    The message length is generally consistent - but changing FreqCount alters with the bit transitions on the 5 Mbaud data.

  8. #3858
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    @manitou - @defragster

    Just put a scope on the T4 generating the signals to the other T4. First, neither the 50Mhz or 75Mhz waves are nice square waves or present a single frequency for my scope (this may be my scope of course). At 50Mhz on pin 11 I am seeing most 48Mhz and 51, 52Mhz sine waves. Also looking at 40 - getting more like 38Mhz on the scope.

    Using pin 10 (75 Mhz), again sine wave at that frequency and readings go between 70, 71, 72, 78Mhz.

    FreqCount measures the same as in previous posts. Really would be nice if some one with a freq generator could check this out for us to see the useful range.

    EDIT: Forgot to mention that if I do a measurement at the same time FreqCount is doing its thing the frequency count drops but the scope signal is still ok?

    EDIT2: FreqCount using T3.6
    Code:
    @75Mhz, freqCount:
    65562930
    65497396
    65562931
    65497390
    65562929
    65497391
    65562927
    65562922
    65497389
    
    @50Mhz
    50000032
    50000031
    50000032
    50000033
    50000032
    Made a slight mod and found a correction I had to make for the T.6 and left some extra code in for T4 I got this:
    Code:
    @50 (pin 11)
    49784147
    49785313
    49783724
    49785046
    49784796
    
    @37.5 (pin 10 - checked on scope as well)
    37499963
    37499951
    37499958
    37499954
    
    @75 (pin 10)
    68437066
    68432636
    68455751
    68470667
    Last edited by mjs513; 07-25-2019 at 11:20 PM.

  9. #3859
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    @manitou - @defragster

    Just tried it on a different T4B2 board and at 50MHz am now getting:
    Code:
    50000069
    50000071
    50000086
    50000070
    50000077
    This is on the first of the T4B2 boards without the white wire. Got same result on the T4B2 with the white wire on the bottom (second of the B2s).

    The T4B2 with the SD connector:
    Code:
    49999918
    49999917
    49999917
    49999926
    49999920
    49999917
    At 75Mhz still getting about 67.8 to 68.8Mhz.

    EDIT: Updated library at https://github.com/mjs513/FreqCount/...ount-T4-Branch
    Last edited by mjs513; 07-26-2019 at 01:18 AM.

  10. #3860
    Member
    Join Date
    Nov 2012
    Location
    Santa Fe, New Mexico, USA
    Posts
    28
    You could use one of https://www.adafruit.com/product/2045, as a frequency generator. It's a $7.95 breakout for an i2c programmable oscillator, with adafruit library.

  11. #3861
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    Re: github library, there are a few GPT comments still hanging around

    BUT I updated my qtmr_count sketch to use pin 9 (QT4 chnl 2, and chnl3) so that frees up pins 18 and 19 (I2C). I also went back to interval timer to get more precise counts, and used <<16 instead of multiply. On my T4B2R breakout I had a poor connection on pin 9 in female header, so I had to push down on jumper to get good values. (At high frequency, shorter jumpers would be good, I suspect). With two T4's, 50 mhz looks good (difference probably ppm of crystals). With two T4's, 75 mhz PWM only counted 66466033.

    Can you try my latest sketch to see if your pin 9 works?

    if you decide to update your lib to pin 9, take care, the timer/channel values and other register manipulations need changing....

  12. #3862
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Quote Originally Posted by manitou View Post
    Re: github library, there are a few GPT comments still hanging around

    BUT I updated my qtmr_count sketch to use pin 9 (QT4 chnl 2, and chnl3) so that frees up pins 18 and 19 (I2C). I also went back to interval timer to get more precise counts, and used <<16 instead of multiply. On my T4B2R breakout I had a poor connection on pin 9 in female header, so I had to push down on jumper to get good values. (At high frequency, shorter jumpers would be good, I suspect). With two T4's, 50 mhz looks good (difference probably ppm of crystals). With two T4's, 75 mhz PWM only counted 66466033.

    Can you try my latest sketch to see if your pin 9 works?

    if you decide to update your lib to pin 9, take care, the timer/channel values and other register manipulations need changing....
    I went ahead and closed the PR with Paul for now until we sort the limits out and I go through and clean up all the changes. I left it at 19 for awhile until we were happy with the frequency count. Must of messed something up - I tried changing it to us interval timer but it didn't work - so I left it. I will go ahead and make the change and see what I get.

    I did order one of clock breakout boards that @recri mentioned just as a test - should get it late this afternoon

    EDIT: Just tried going from board to board as a quick test:
    Code:
    @75Mhz
    70294404
    70775228
    70703755
    70786853
    70606666
    
    @50
    49999058
    49998854
    49998943
    For fun I did 40Mhz and 37.5Mhz on pin 11 and got:
    Code:
    37500019
    37500020
    37500020
    37500020
    37500019
    Last edited by mjs513; 07-26-2019 at 11:34 AM.

  13. #3863
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Quote Originally Posted by manitou View Post
    Re: github library, there are a few GPT comments still hanging around

    BUT I updated my qtmr_count sketch to use pin 9 (QT4 chnl 2, and chnl3) so that frees up pins 18 and 19 (I2C). I also went back to interval timer to get more precise counts, and used <<16 instead of multiply. On my T4B2R breakout I had a poor connection on pin 9 in female header, so I had to push down on jumper to get good values. (At high frequency, shorter jumpers would be good, I suspect). With two T4's, 50 mhz looks good (difference probably ppm of crystals). With two T4's, 75 mhz PWM only counted 66466033.

    Can you try my latest sketch to see if your pin 9 works?

    if you decide to update your lib to pin 9, take care, the timer/channel values and other register manipulations need changing....
    @manitou - @defragster

    Ok got everything incorporated and think I got rid of the extra GPTs: https://github.com/mjs513/FreqCount. Still can only get up to about 69Mhz for using 75Mhz test, but will test more tonight.

  14. #3864
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,697
    <edit below>
    @mjs513 - link to github.com/mjs513/FreqCount/tree/FreqCount-T4-Branch

    With prior ZIP version FreqCnt was giving 37500035 from:
    Code:
      FreqCount.begin(1000000);  //Time in microseconds
      analogWriteFrequency(2, 40000000);  // test jumper 19 to 2 :: READS 37500035
      analogWrite(2, 128);
    Downloaded and replaced :: Using library FreqCount at version 1.3 in folder: T:\tCode\libraries\FreqCount
    with above github and no sketch change and now there is never a print from:
    Code:
        if (FreqCount.available()) {
          unsigned long count = FreqCount.read();
          if (count > 0) Serial.println(count);
        }
    <EDIT>: Copied files from prior ZIP back to the libraries folder and recompiled and the FreqCnt prints again as it was - except now it is showing ::

    3,947,376 for 4,000,000 >> opps because I was trying a lower value to work

    But going back to 40M analogWriteFrequency(2, 40000000) it shows :: 37,500,062 to 37500025
    Last edited by defragster; 07-26-2019 at 04:50 PM.

  15. #3865
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    @manitou - @defragster

    Ok got everything incorporated and think I got rid of the extra GPTs: https://github.com/mjs513/FreqCount. Still can only get up to about 69Mhz for using 75Mhz test, but will test more tonight.
    Tested your lib with example on one T4 counting on pin 9. pin 11 PWM @50 MHz counting at 50000000. Pasted in pin 10 PWM@75MHz counts at 75000000. looks good on single T4. thanks

    cosmetic: the example has "test jumper 11 to 25" 25 should be 9

    On a 2nd T4 you could test a few other frequencies by toggling digital pin with N asm("nop") delays in a loop()...
    toggle pin 10 GPIO7_DR_TOGGLE = 1

  16. #3866
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,697
    <removed> - FreqCnt pin was moved ...
    Last edited by defragster; 07-26-2019 at 07:00 PM.

  17. #3867
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,697
    Quote Originally Posted by manitou View Post
    ...

    cosmetic: the example has "test jumper 11 to 25" 25 should be 9
    9 or 19? Prior ref said pin #19 was the FreqCnt pin? Prior version worked on #19 . Running sample libraries\FreqCount\examples\Serial_Output_T4\Seri al_Output_T4.ino on T4B2m with pin #19 jumpered to #11 only returns ZERO

    … okay - reading back now it shows there was a jump to PIN #9 and that works - moved pin on other T4 running Serial# to open pin #9 and the analogWriteFrequency(2, 40000000) is still showing values like :: 37500005

    The FreqCount.available() check is in loop() running at : lpHz=1,529,500

    Oh … and the Serial_Out example is giving this:
    49057719
    49074913
    49056063
    49071323
    49031735
    49039670

  18. #3868
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    @defragster
    … okay - reading back now it shows there was a jump to PIN #9 and that works - moved pin on other T4 running Serial# to open pin #9 and the analogWriteFrequency(2, 40000000) is still showing values like :: 37500005
    Yep that's right - when made a note of @manitou explained it: see https://forum.pjrc.com/threads/54711...l=1#post210831

    Oh … and the Serial_Out example is giving this:
    With the config I was testing I got somewhat better results with 50Mhz, see #3862 (this page) . Just did a double check and still getting:
    Code:
    50000016
    50000017
    49999999
    49999990
    49999997
    with the freq count library.

  19. #3869
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,697
    @mjs513 - odd the counts are off - but that is what I see ...

    Added two pull request for compile warnings from forum post: https://forum.pjrc.com/threads/57029...l=1#post211063

    https://github.com/PaulStoffregen/Audio/pull/308 :: #if define and assign of conditional var to stop compile warning

    https://github.com/PaulStoffregen/Audio/pull/307 :: Elimitate unused var 'dc' compile warning

  20. #3870
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,697
    @mjs513 - any chance the FreqCnt could work on both #9 and #19?

    When Pin #19 was used it was noted that #18 was no longer usable for PWM.

    Using pin #9 - does that preclude use of any other pin functions?

    I just put the Serial test for 14 T4 serial ports - where each of the 7 on one cross to the other and they run the same sketch to feed each other - onto a single Breakout now with 5 Serial#'s crossed and it is working and can loop faster without having to leave time for the two to synchronize.

    Running that I still don't get a true FreqCnt of 40,000,000 - but the old 37,499,999. I got github updated 10 hrs ago just 8 hours past.

  21. #3871
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Quote Originally Posted by defragster View Post
    @mjs513 - any chance the FreqCnt could work on both #9 and #19?

    When Pin #19 was used it was noted that #18 was no longer usable for PWM.

    Using pin #9 - does that preclude use of any other pin functions?

    I just put the Serial test for 14 T4 serial ports - where each of the 7 on one cross to the other and they run the same sketch to feed each other - onto a single Breakout now with 5 Serial#'s crossed and it is working and can loop faster without having to leave time for the two to synchronize.

    Running that I still don't get a true FreqCnt of 40,000,000 - but the old 37,499,999. I got github updated 10 hrs ago just 8 hours past.
    The way its setup right now is that it uses QT4 for the counter which is on pins 9 and 6 from @KurtE's spreadsheet so I would think it precludes using pin 6 but @manitou could tell you for sure.

    As for setting it up to run also on Pin 19 not in its present form, you can only use the pins with the QTx selected. For FreqMulti you might be able to set it up to use both but then I would think you would also need 2 interval timers - maybe.

    As for the PWM freq measurement at 40Mhz - yep, that's what I get as well but @manitou explained that to me in post https://forum.pjrc.com/threads/54711...l=1#post210831

    Now for the prof that is in the pudding - as an independent test I hooked up the freq generator from adafruit and ran it at 3 frequencies: 40, 60 and 75Mhz:
    Code:
    @40Mhz
    39999372
    39999372
    39999372
    39999373
    39999373
    39999374
    39999373
    
    @60Mhz
    59999040
    59999040
    59999040
    59999041
    59999042
    59999042
    
    @75Mhz
    71131340
    71136661
    71140964
    71036102
    71053074
    71137751
    71147690
    71188985
    71180746
    71198476
    Have to do some more testing with freq below 75Mhz to see where it starts diverging from actual.

  22. #3872
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    Now for the prof that is in the pudding - as an independent test I hooked up the freq generator from adafruit and ran it at 3 frequencies: 40, 60 and 75Mhz:
    Those results from Adafruit generator look good -- about 16 ppm for your 40mhz and 60mhz tests. I think the spec for the crystal on the Adafruit is 30 ppm. Frequency tests on T4 24mhz crystal are around 10 ppm.

    Your URL was mis-pasted, discrete PWM frequencies are noted in
    https://forum.pjrc.com/threads/54711...l=1#post210831

  23. #3873
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by Frank B View Post
    input-adc(s) is missing, for example. I don't plan to do it, don't know the best way how to do it.
    I couldn't figure out to use XBAR and ADC_ETC and DMA, to get timer-controlled (PIT) ADC with DMA double buffering for audio analog input, see
    https://forum.pjrc.com/threads/54711...l=1#post199666

    However, i just noticed that eflexPWM (ref 54.4.1.5) can trigger ADC, so this might provide the needed capability ... more study required.

    Relevant? https://www.nxp.com/docs/en/application-note/AN4675.pdf

    EDIT: I think the eflexPWM trigger must still go through XBAR to ADC_ETC and will not support double-buffered DMA (same as the PIT timer)
    Last edited by manitou; 07-27-2019 at 09:11 PM.

  24. #3874
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,101
    Quote Originally Posted by manitou View Post
    Those results from Adafruit generator look good -- about 16 ppm for your 40mhz and 60mhz tests. I think the spec for the crystal on the Adafruit is 30 ppm. Frequency tests on T4 24mhz crystal are around 10 ppm.

    Your URL was mis-pasted, discrete PWM frequencies are noted in
    https://forum.pjrc.com/threads/54711...l=1#post210831
    Oops sorry about the mis-referenced post.

    Did some more testing this morning with that clock generator chip especially between 60-70 Mhz. Looks like I would limit it to 68 or 70Mhz. To try and fine tune the errors I added a 16us correction factor for the timer but may need some more testing. I did post that change up my GitHub page.

    In regards to 40Mhz pwm signal. I put a scope on pin 2 this morning and did a analogwritefreq of 40Mhz and scope was alternating between 39.4 and 39.5 - saw a lot of overshoot and ringing in the signal though. When I hooked it up to the T4 I was getting 37,500,555 which is rather strange. Yet when I used the FreqGen breakout 40Mhz was just about 40Mhz.

  25. #3875
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,193
    Quote Originally Posted by mjs513 View Post
    In regards to 40Mhz pwm signal. I put a scope on pin 2 this morning and did a analogwritefreq of 40Mhz and scope was alternating between 39.4 and 39.5 - saw a lot of overshoot and ringing in the signal though. When I hooked it up to the T4 I was getting 37,500,555 which is rather strange. Yet when I used the FreqGen breakout 40Mhz was just about 40Mhz.
    I'm confused. "scope on pin 2" -- pin 2 of what? T4? T4 pin 2 uses eflexpwm, but on my scope i see 37.3mhz (jitter 37.9) with 40mhz on pin 8 (eflexpwm).
    "hooked it up to the T4" -- what is "it"? adafruit generator?

    FWIW, i changed my qtmr_count.ino sketch to use pin 8 PWM (eflexpwm) for testing. analogWriteFrequency(8,75000000) works for eflexpwm pins, doesn't for qtmr pwm pins. And i removed raw PWM 10 code, no longer needed.
    Last edited by manitou; 07-27-2019 at 01:40 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
  •