Search results

  1. B

    Sub microsecond time measurement-again

    There's a previous thread, "Teensy 3.1 Time Measurements", started 30 Apr 2015, that shows some results for ARM_DWT_CYCNT. Probably too much information but it appears some task occasionally stops ARM_DWT_CYCNT. I also found the code did not execute correctly when I power cycled the teensy and...
  2. B

    Sub microsecond time measurement-again

    I'm using part of freqMeasureMulti to measure time intervals without using flextimer. flextimer is a bit much for me to understand and this is work around that uses documented and tested commands. I use a 74HC4046 PLL chip and "FREQMEASUREMULTI_MARK_ONLY -> A new value becomes available at...
  3. B

    Measuring pulse width, interrupts

    Thanks for the info on FASTRUN and using an ISR for a full port. Anything under 1.5 usec is great for me. I'll check it out and test it in the real program when I get back in town. Sounds like I need to check into which pins go to which ports and maybe move my input pin.
  4. B

    Measuring pulse width, interrupts

    I've been testing different ways to measure pulse width using Teensy 3.1 and 48 MHz clock. The signal is a narrow positive going pulse at a 10 msec rate. First, pulseIn, 1 usec resolution. Second, polling with digitalRead, about 0.5 usec resolution. Third, polling with digitalReadFast, about...
  5. B

    Connecting a Speaker to Teensy 3.1 DAC / A14 ?

    I found this info in the manual for the K20 Sub-Family Data Sheet, Rev. 3, 11/2012 posted at pjrc.com in the teensy 3.1 reference section. Looks like the DAC will need a buffer to run a speaker. 6.6.3 12-bit DAC electrical characteristics 6.6.3.1 12-bit DAC operating requirements Table 29...
  6. B

    Teensy 3.1 time measurements

    First, a minor item. I measured my teensy cpu clock at 15.999749 MHz, 16 ppm low and that matches the result of 479992-3 using FreqMeasure for a 100 Hz input. My result of 239994 for the pulse width of a nominal 50% duty cycle 100 Hz signal, which is 25 ppm low, probably indicates a deviation...
  7. B

    Teensy 3.1 time measurements

    Thanks for the comments. I tested 2. Some of the others are over my head but I'll look at them some more. FreqMeasure works very well. With a 100 Hz input I measured values of 479992-3 with no exceptions for over 3 hours run time. I changed the code to capture the cpu cycle count in the...
  8. B

    Teensy 3.1 time measurements

    This thread is related to previous threads Sub micro timing and Teensyduino access to counting cpu cycles I've been using the teensy 3.1 to measure an external time interval. I use a very stable 100 Hz signal applied to 2 pins, one for the rising edge and one for the falling edge. The...
  9. B

    Teensyduino access to counting cpu cycles

    Thanks all. I understand more now. I'm not worried about overflow or the occasional low readings. I remember a comment about that somewhere, just have to find it again. I split out my first test into a separate program, shown below. I'm not sure what happens if the counter overflow happens...
  10. B

    Teensyduino access to counting cpu cycles

    Thanks. This works great. I expected to see overflows every 89.5 seconds based on 48 MHz cpu clock and 32 bits. But no overflows. The counter must reset when I call the function below. Don't know if this should move to tech support... unsigned long gpsTest() { unsigned long period =...
  11. B

    Teensyduino access to counting cpu cycles

    Is there a way I can count cpu cycles from teensyduino? I would like to measure the time interval between a rising edge on 1 pin to a rising edge on a different pin. Using attachInterrupt(pin, ISR, RISING) and micros() works well with my teensy 3.1 with reliable resolution to 1 usec but I'd...
  12. B

    Copper sheet for ground and power busses

    I think this will work. Regular house wiring is copper and it works for many years when held by screws. Be sure to check a chart for what size wire to use. 20 A for house wiring takes 12 AWG wire. That's pretty conservative. If your wire gets warm, it's too small. The wire can deform over...
  13. B

    Teensy 3.1 and pulseIn

    I did some more testing and found this whole pulseIn thing was due to an extra pulse my circuit puts out as the receiver finds the first satellite. Sorry! It fooled me because I only saw one occasional bad pulseIn reading, never more than one, and the pulse train looked OK on my scope. I went...
  14. B

    Teensy 3.1 and pulseIn

    I cut out more of the program and I still see the error. I left gpsTest in because it holds the program until the pulse turns on. I wasn't sure how much to take out before. The GIF shows an example of the error. Thanks, Bob. // 4/12/2015 - more deletions // global variables const int gpsPin =...
  15. B

    Teensy 3.1 and pulseIn

    Thanks for the help by the way. I cut out part of the program. Probably could have cut more but I didn't want to take out too much. Let me know if you want me to take out more. align_edges has the pulseIn calls. The GIF shows a bad first reading.
  16. B

    Teensy 3.1 and pulseIn

    I ran another test with the added line, see attached GIF. A "1" did print. I'm not sure why, but the text in the serial monitor window went from black to gray so it's a little light. This time I only had to run the program one time.
  17. B

    Teensy 3.1 and pulseIn

    Sorry if I'm not replying in the forum the best way. I got a bit mixed up when I tried to add an attachment to the reply. I hadn't noticed that the first value looked OK except for an extra 9. I first added the serial monitor to help debug occasional odd behavior. The program also responds...
  18. B

    Teensy 3.1 and pulseIn

    I have a program that works most of the time but it occasionally gives what looks like a bad reading the first time I call pulseIn. In the attached GIF the column of numbers at the far right is the pulseIn value sent via the serial monitor. pulseIn measures the width of a pulse with period of...
  19. B

    Teensy 3.1 analogReadResolution

    Thanks for the help. I put your code in and it compiled without error. I found the problem in my code is where I placed my statements. I had them above the setup function. When I moved them inside setup it worked.
  20. B

    Teensy 3.1 analogReadResolution

    I'm trying to use analogReadResolution() with a Teensy 3.1. I thought I'd found the problem when I found this example. 1. void setup() { // ============================================================== 2. pinMode(LED1,OUTPUT); // enable digital output for turning on LED...
Back
Top