Search results

  1. T

    Hardware Quadrature Code for Teensy 3.x

    wushumike: I'm not exactly sure what you are asking. If you want to stop the hardware counting, my question is what is the encoder doing during this time. If the encoder is not moving, then there is no counting. If the encoder continues to move, there are issues with starting and stopping...
  2. T

    Teensy functionality controlled by DIP switches

    Do you need the loop functionality? Otherwise, just do all the programming with setup(). Read the dip switches and decide which of several programs to execute during the setup() routine. You never have to exit setup(). TLB
  3. T

    MCGIRCLK Clock

    There are two clocks, MCGIRCLK, which is off the 4 Mhz internal reference and OSCERCLK which is directly off the 16 Mhz crystal. OSCERCLK is easier to setup (after the default initialization), which is all I care about. So for future reference for anyone else who wants to set up LPTMR: //...
  4. T

    Hardware Quadrature Code for Teensy 3.x

    Its always 4x, the only option. You are probably interpreting your spec's wrong. PPR is pulses per revolution, versus LPR, lines per revolution. The PPR number already assumes the 4x reading. Welcome to the world of specsmanship.:rolleyes:
  5. T

    Hardware Quadrature Code for Teensy 3.x

    I don't know where you read this, but I have two Teensy's running my QuadDecode code - two encoder channels on one Teensy and the third on a 2nd Teensy. I communicate between the two with I2C. The one with two channels is the master and the one with the third channel is the slave. I am using...
  6. T

    Hardware Quadrature Code for Teensy 3.x

    Are your grounds hooked up correctly? You get this kind of a pattern when one encoder line is not toggling. One line goes high, counts 1, same line goes low again, counts down again. The line may be toggling but have some kind of an offset such that it never goes below the switching...
  7. T

    MCGIRCLK Clock

    So I don't have to wade thru all the details: For the default Teensy3.1 setup (48 Mhz) is MCGIRCLK the same frequency as the system clock? Or what frequency is it at? I want to use LPTMR Low Power Timer just as an extra simple timer and it is run off this clock. Need to decide on the...
  8. T

    Multi Line Frequency Measurement with Teensy 3.1?

    Chapter 10: Signal Multiplexing and Signal Descriptions 10.3.1 is table for Signal Multiplexing And then set up Pin Control Register (PORTx_PCRn) (Chapter 11.14.1) bits 10-8 for Pin Mux Control. Reasonably straightforward unless the same pin happens to be defined for two different uses you...
  9. T

    Can't get __disable_irq() to work on Teensy LC

    So much for backward compatibility! I realized after I posted, I was looking at the the Teensy3.1 manual. Doesn't make me think very nice thoughts about the designers of this part, switching the polarity of this bit. Makes one wonder where else they have done something else like this. From...
  10. T

    Can't get __disable_irq() to work on Teensy LC

    Just a quick look at your code and I am not exactly sure what is happening but some thoughts. From the Reference Manual pg 780: So first of all you should be writing a 0, and then you need to read the FTM0_SC register before you can clear it, and I'm not sure whether FTM0_SC |= (1 <<...
  11. T

    Is there a way to start a program on the Windows PC?

    You could have the PC start a program (Python) when Windows starts(Scheduled Tasks). And then this program runs in the background and talks to the Teensy. I use Python on Windows. Pyserial to talk to Teensy over USBSerial. And look for a string that commands the program to do something...
  12. T

    Select from multiple Teensies for updating?

    I'm using Windows so hopefully this also applies to Mac. I have two Teensy's hooked up to two separate USB ports. To update a given Teensy, I point the bootloader (teensy.exe) to the appropriate .hex file (drag the file onto the bootloader window works) and then press the button on the...
  13. T

    64 bit Windows 7 Support

    Is there any issue with Windows 7 - 64 bit support for any of the Teensy toolset? I'm looking at getting a new laptop and running Teensy is one of the must have applications. Thanks, TLB
  14. T

    Hardware Quadrature Code for Teensy 3.x

    This is due to the use of templates in the code. Templates are used to allow the same logical code for both decoder channels (separate hardware). The compiler must see QuadDecode_def.h only once otherwise it makes multiple copies. It is generally included in main.cpp. Also QuadDecode_def.h...
  15. T

    Hardware Quadrature Code for Teensy 3.x

    I am doing something fairly similar - reading an encoder and exporting the count over a serial channel. So your application should fit right in. The calcPosn() method sends back the position as a 32 bit integer, +- 2 billion. I designed for lax interrupt latency requirements. As long as the...
  16. T

    Hardware Quadrature Code for Teensy 3.x

    Teensy3.1 has hardware quadrature counting support, however it is only a 16 bit counter, giving 64K counts. The issue, and the reason for the interrupts is if the system requires more than 64k encoder counts. If your system is always below 64K counts, just reading the counter is okay. Also...
  17. T

    Programming Multiple Teensy's

    Simple answer to programming multiple Teensy's - just plug the Teensy's into different USB ports, and press the download button on the appropriate Teensy. So I just drag the .hex files to the Teensy loader, and press the button. And kept my same gvim/makefile system. I did lose the automatic...
  18. T

    Accessing Comparator Hangs Serial on Teensy 3.1

    Thanks. I had noticed this post before but couldn't find it again.
  19. T

    Accessing Comparator Hangs Serial on Teensy 3.1

    I am trying to use the comparator on Teensy3.1. I am talking to Teensy over USBSerial. If I do any accesses to the comparator, Serial will not initiate, even if the comparator code is after the Serial.begin(9600). The program works fine, and then if I add the line: uint8_t testVar...
  20. T

    Coming Soon: Teensy-LC (low cost Teensy)

    Got Robin's email and started looking up about this part. Have been busy figuring out the one path for resource allocation to add position latching with my Teensy 3.1's and not doing much Forum monitoring. Got a hold of the Freescale documentation and read: Looks like I will have to add...
  21. T

    Comparator used in Teensy3.1 startup code?

    Just want to verify - is the Comparator (CMP) used for anything in the default Teensy3.1 startup code. I searched thru the code and couldn't find anything, so it looks like I will be okay. I found some reference in the comments for AnalogWrite. If I use the Comparator, will I interfere with...
  22. T

    Hardware Quadrature Code for Teensy 3.x

    The quadrature decode hardware on the processor only has the capability for what would be 4x count mode, and that is what is supported. No other options. TLB
  23. T

    Hardware Quadrature Code for Teensy 3.x

    Not exactly sure what you are asking. The code assumes a quadrature input signal and determines position and direction from that. TLB
  24. T

    Hardware Quadrature Code for Teensy 3.x

    Yes, those are the Teensy pin numbers. The others are the ARM pin numbers. TLB
  25. T

    Hardware Quadrature Code for Teensy 3.x

    My system does not have an index channel, so I did not write code for it. As far as the hardware goes, there is not much it supports completely. There are enough pieces to do just about anything (while cursing the marketing department - a slight addition to the hardware would have made some...
  26. T

    Programming Multiple Teensy's

    Could you tell me what you are doing? How is your system set up and how did you set up the download port for the individual projects. I am still in the 'stumble thru' mode using this system. Thanks, TLB
  27. T

    Programming Multiple Teensy's

    I loaded the Atmel Studio/Visual Micro IDE and have two Teensy 3.1's hooked up. I am having trouble getting automatic compile and download to switch between the two Teensy's. I select between the two COM ports (COM9 and COM10) on my system, and the output says "Uploading to I/O board using...
  28. T

    Hardware Quadrature Code for Teensy 3.x

    Hi Brian, Teensy 3.1 can decode two encoders. And from your other post you have an encoder edge rate of 53 kHz. This would give an interrupt rate of about 10 Hz to update position with the attached code. You don't say what your PID control loop rate is. So for the 3rd encoder - put this...
  29. T

    Programming Multiple Teensy's

    Can I run Teensy 3.x with Atmel Studio without the VisualMicro plugin? I'm using some Teensyduino routines, but I don't have a standard Arduino setup, I use the makefile. I was satisfied with my setup (like gvim), except that now I need the capability to program two Teensy's hooked up...
  30. T

    Register Addressing

    Hi Michael, Thanks for the pointer (hate to use that term, but couldn't think of a better one). This is a post that it took a while to figure out the answer and reply. I decided I did need two pieces of code at the implementation level, and I just wanted one algorithm at the development...
  31. T

    Hardware Quadrature Code for Teensy 3.x

    Attached is my code for utilizing the hardware quadrature decode for Teensy3.x. As others have noted, it is not straightforward. The marketing department must have decided the applications that utilized more than 64K encoder counts or were not at least piecewise uni-directional were a small...
  32. T

    Programming Multiple Teensy's

    How do I program multiple Teensy 3.1's, different code in the two Teensy's? I have seen it referred to, but can't find any instructions. (And forum search doesn't work very well with multiple words.) I would like to have the two Teensy's both hooked up to my computer at the same time on...
  33. T

    Register Addressing

    For Teensy 3, in mk20dx128.h, there is: #define FTM1_CNT *(volatile uint32_t *)0x40039004 // Counter and #define FTM2_CNT *(volatile uint32_t *)0x400B8004 // Counter so one can write statements such as Posn=FTM1_CNT; without having to worry about pointer details. Is there any way to set...
  34. T

    Teensy 3.1 GPIO interrupts

    The Vector handler and IRQ numbers are fixed in hardware. (Table 3-4 in the reference manual). mk20dx128.h defines the variable names for these. NVIC_ENABLE_IRQ(IRQ_PORTA); would enable the interrupts from PORTA. Looking thru the initialization code, it looks like these might already be...
  35. T

    Teensy 3.1 External Interrupt on pin - please provide guidance

    Just looking around quickly, looks like they are defined in wiring.h as __enable_irq() and __disable_irq(). __enable_irq() and __disable_irq() are defined in mk20dx128.h Make sure these files get #include d TLB
  36. T

    Teensy 3.1 GPIO interrupts

    BTW, as far as includes, the only include I have is #include "WProgram.h" from the sample main.cpp in ...\arduino-1.0.5\hardware\teensy\cores\teensy3 I believe that ends up including pretty much everything in that directory. I haven't bothered sorting out what I need and don't need. TLB
  37. T

    Teensy 3.1 GPIO interrupts

    I don't know how much information you have, but pieces to refer to: From http://www.pjrc.com/teensy/datasheets.html Download the MK20DX256 Manual. From this you will see there are many ways to configure pins. Look in Chapter 11 (PORT). You will have to set your pin to GPIO in PORTx_PCRn...
  38. T

    usb_serial Makefile problem (Teensy 3.1)

    Here is the Makefile I am using. It is a derivative of the sample in ...\arduino-1.0.5\hardware\teensy\cores\teensy3. You have to copy the .c and .h files from that same directory to the directory of the Makefile. Not sure how many of those files I really need; I just left them all in...
  39. T

    FTM1 Reassignment for Teensy 3.1

    I want to use the FTM1 timer module on my Teensy 3.1. It looks like it is being initialized by the function _init_Teensyduino_internal_(void) in pins_teensy.c It appears this initialization is only needed if I do AnalogWrite to pins 3,4 or 25. If I do not do AnalogWrite to these pins, will...
  40. T

    More Teensy3.1 Makefile Questions

    Is there an updated version of the sample Makefile past the one that has # options needed by many Arduino libraries to configure for Teensy 3.0 OPTIONS += -D__MK20DX128__ -DARDUIO=104 If so, it is not showing up in the Windows XP version of Teensyduino 1.18-rc1. Re your response I have...
  41. T

    More Teensy3.1 Makefile Questions

    BTW, the previous is on a Windows XP system. TLB
  42. T

    More Teensy3.1 Makefile Questions

    Is there supposed to be a teensy31 directory somewhere? Or am I looking in a completely wrong place. I am looking at the default Makefile included under arduino-1.0.5\hardware\teensy\cores\teensy3 From the website: I just ran the Teensyduino 1.18-rc1 Installer. The date stamp shows it...
  43. T

    More Teensy3.1 Makefile Questions

    Quick question: The default Makefile included under arduino-1.0.5\hardware\teensy\cores\teensy3 includes the line: # options needed by many Arduino libraries to configure for Teensy 3.0 OPTIONS += -D__MK20DX128__ -DARDUIO=104 Does DARDUIO refer to the Arduino version and have to be updated to...
  44. T

    Serial Latency T2

    Thanks for your reply, and sorry for the delay in responding. Previously I received an email when there was a reply to my posts, but this time I didn't get any email so I didn't realize there was a response. Yes, this is your serial code from the website. I'm using WindowsXP running...
  45. T

    More Teensy3.1 Makefile Questions

    I am switching over to a Teensy3.1 from a Teensy 2.0. I want to use C code to be able to access some features (Quadrature Decoding on the Flex Timer Module). So the first step is getting the Makefile working and I am a Makefile newbie. I edited the included Makefile # The name of your...
  46. T

    Setting PORTF on Teensy 2.0 is asynchronous?

    The read has up to a 1.5 clock cycle delay to synchronize the inputs. Since there can be one instruction per clock, it could get in ahead. Also, this could be a compiler 'feature'. Without the delay the compiler has no way of knowing there is any relation between PORTF and PORTB. So if it...
  47. T

    Serial Latency T2

    I have something that is working but I don't fully understand. This is with Teensy2, running a serial channel to a WindowsXP laptop. My concern is not missing 200 uSec period timer interrupts due to serial channel latency. It looks like I am not missing interrupts, but there is a 7 mSec...
  48. T

    C Syntax to Change Multiple Bits

    Is there any C syntax to change multiple bits on a port while leaving the others the same? I would like to do something like PORTD.[7:6] = 0b01; i.e. PORTD.7=0; PORTD.6=1; in a single statement while leaving bits 5-0 unchanged. I know how to set and clear individual bits, or to write the...
  49. T

    USB Serial and Interrupt Latency

    Since there was no answer, I set up an experiment to measure the latency. I did set up a timer interrupt to interrupt on compare. The first operation in the interrupt routine was to read the timer. The difference in this value and the compare value gave me the interrupt latency. Depending...
  50. T

    USB Serial and Interrupt Latency

    I am running USB serial to a Windows PC from a Teensy 2.0 running at 16 MHz, using the C libraries. I am doing both send and receive at a fairly low data rate, less than 100 bytes/sec. How will this affect my interrupt latency rate? I would like to get an interrupt latency rate of 10's of...
Back
Top