Forum Rule: Always post complete source code & details to reproduce any issue!

Search:

Type: Posts; User: LAtimes

Page 1 of 3 1 2 3

Search: Search took 0.00 seconds.

  1. This still works for me using Teensyduino: ...

    This still works for me using Teensyduino:

    Teensy 4.0
    Arduino 1.8.19
    Teensyduino 1.56
    Windows 10
  2. TeensyMM SparkFun Input and Display Board demo

    Here is a program I wrote to demonstrate all the features of the SparkFun MicroMod Input and Display Board when using a TeensyMM processor:

    25898

    Features are:

    2.4" TFT ILI9341 display
    ...
  3. Replies
    1,019
    Views
    99,107

    I'm working on a demo program to show how to use...

    I'm working on a demo program to show how to use all the features on the "Input and Display" carrier board. It took some digging to find all the info on it.

    For the display, CS is pin 4 and DC is...
  4. I ran the sketch from the first post with...

    I ran the sketch from the first post with Teensyduino 1.54, Arduino 1.8.15, compiled with Debug, and it worked. So it appears the issue was fixed in 1.54.
  5. Replies
    66
    Views
    9,948

    It looks like this is caused by using unsigned...

    It looks like this is caused by using unsigned integers in tempmon.c. As temperature goes up, nmeas goes down. When it gets below s_hotCount (i.e. above 95 degrees), the value goes negative, which is...
  6. Replies
    29
    Views
    2,854

    To set the pins as GPIO Inputs: ...

    To set the pins as GPIO Inputs:


    pinMode(16, INPUT);
    pinMode(17, INPUT);
    pinMode(20, INPUT);
    pinMode(21, INPUT);
    pinMode(22, INPUT);
    pinMode(23, INPUT);
    pinMode(26, ...
  7. Replies
    29
    Views
    2,854

    Here's a short sketch that reads 1024 32-bit...

    Here's a short sketch that reads 1024 32-bit values from Port 6 in an efficient manner:


    #define BUFFER_SIZE 1024

    uint32_t buffer[BUFFER_SIZE];

    void setup() {
    uint32_t *buffer_ptr =...
  8. Replies
    29
    Views
    2,854

    If you really only have about 10-18 clock cycles,...

    If you really only have about 10-18 clock cycles, assembly language is probably the only way. I wrote a logic analyzer that reads and stores 32 bits in 8 clock cycles, but it is in assembly. On the...
  9. Replies
    26
    Views
    2,034

    It's declared volatile, which tells the compiler...

    It's declared volatile, which tells the compiler to not optimize it out but read it every time.



    The &= and |= will do a read/write sequence. A plain = will only do a write.
  10. Replies
    26
    Views
    2,034

    GPIO reads take longer than writes. If you can...

    GPIO reads take longer than writes. If you can eliminate as many reads as possible, it will help. If you know the GPIO7_GDIR isn't changed except by the ISR, you can read it once at startup and...
  11. Replies
    6
    Views
    862

    For a Teensy 4,...

    For a Teensy 4, TEMPERATURE_NO_ADC_SETTING_CHANGES and TEMPERATURE_MAX_ACCURACY aren't used. InternalTemperature is just a wrapper around tempmonGetTemp.

    The original poster was probably using a...
  12. Replies
    6
    Views
    862

    Try adding a call to "begin" in setup: ...

    Try adding a call to "begin" in setup:



    #include <InternalTemperature.h>

    void setup() {
    Serial.begin(9600);
    InternalTemperature.begin (TEMPERATURE_NO_ADC_SETTING_CHANGES);
    ...
  13. What if you use an output from the...

    What if you use an output from the And-Or-Inverter (AOI) module?

    xbar_connect(XBARA1_IN_AOI1_OUT0, XBARA1_IN_IOMUX_XBAR_INOUT07);
    xbar_connect(XBARA1_IN_AOI1_OUT0, XBARA1_IN_IOMUX_XBAR_INOUT08);...
  14. Replies
    12
    Views
    6,811

    See thread here...

    See thread here for an example of disabling dual issue. Be aware that code will run significantly slower if dual issue is disabled.
  15. Apparently setting those bits in ACTLR doesn't...

    Apparently setting those bits in ACTLR doesn't disable all instructions. There is a bit, DISFOLD (bit 2), that completely disables dual issue. After setting it, the example takes 9 cycles.

    Replace...
  16. Replies
    68
    Views
    38,018

    Yes! Many of us have an extra teensy sitting...

    Yes! Many of us have an extra teensy sitting around. My intent was to make it as easy as possible to set up and run. The instructions are here. It is just a zip/tar file that unpacks to a single...
  17. You can read a PWM signal via software. Here's a...

    You can read a PWM signal via software. Here's a program that outputs a 38kHz signal on pin 10 and reads 40 samples 1 microsecond apart. You will see the sample change value every 12-13 samples.

    ...
  18. I went back and verified my results just to make...

    I went back and verified my results just to make sure. I looked at the timing in the interrupt routine before the callback and after the callback.

    GPT Pre-callback time: 108 nsec
    ...
  19. I made some more measurements. I increased the...

    I made some more measurements. I increased the logic analyzer to 120 MHz and removed all of the dsb's, so the measurements are more consistent now. Note that clock cycles are more precise at lower...
  20. The "150 MHz" is actually F_BUS for the GPT. I...

    The "150 MHz" is actually F_BUS for the GPT. I printed out F_BUS_ACTUAL and it is 75.6 for 150, 150 for 450 and 600, and 204 for 816. So that should make the points in the graph more linear.


    ...
  21. I decided to get the logic analyzer out and...

    I decided to get the logic analyzer out and measure how long the timer interrupts take in the TeensyTimerTool library with a Teensy 4.0. I varied both CPU speed and Timer clock speed (I used the GPT...
  22. For writing a pulse, in the timer interrupt...

    For writing a pulse, in the timer interrupt callback, I would set the pin high, delayNanoseconds (500), set the pin low, start the timer for the next interrupt.
  23. I haven't used interrupts much as I wanted to go...

    I haven't used interrupts much as I wanted to go as fast as possible. I am sampling at a specific rate, so I poll on ARM_DWT_CYCCNT, which increments every CPU clock cycle. It takes about 4 or 5...
  24. A better solution instead of TimerOne would be to...

    A better solution instead of TimerOne would be to use analogWriteFrequency. The Teensy 3.2 allows up to 3 different frequencies (FTM0,1,2).

    You could use pins 3 and 5, for example, as follows:

    ...
  25. For the Teensy 3.2, the lowest frequency possible...

    For the Teensy 3.2, the lowest frequency possible with TimerOne is a function of F_BUS/2. The maximum timer count is 32768 * 128 = 4,194,304.

    If CPU Speed is the default 96 MHz, F_BUS is 48 MHz,...
  26. Replies
    68
    Views
    38,018

    New release for using your Teensy as a logic...

    New release for using your Teensy as a logic analyzer - now supports 8 channels on Teensy 4.x, up to 75 MHz sample rate.

    https://github.com/LAtimes2/TeensyLogicAnalyzer
  27. Teensy 4 does have port names - ports 6/7/8/9....

    Teensy 4 does have port names - ports 6/7/8/9. See this forum entry for more details. In the diagrams, the GPIO column is the port and bit number, but you need to add 5 to the port number. For...
  28. More digging this morning. Appears to be a timing...

    More digging this morning. Appears to be a timing issue near this line in startup.c:

    usb_pll_start(); reset_PFD(); //TODO: is this really needed?

    If I comment out the reset_PFD, it starts...
  29. The change does cause the problem to go away....

    The change does cause the problem to go away. However, it is because it changes the memory map. I can make the problem re-appear by adding nop's to align the memory such that it fails again. So if...
  30. I've traced this problem down to the last line of...

    I've traced this problem down to the last line of configure_cache in startup.c. By adjusting the number of nop's in front of it, I can make it consistently work or fail.

    Also, if this line only...
  31. Thanks for the info. I will continue to...

    Thanks for the info. I will continue to investigate - maybe a good excuse to try gdb.
  32. Can anyone else duplicate the problem in the...

    Can anyone else duplicate the problem in the first post or is it just me?

    Note that it locks up the Teensy and you have to press the button to get into the bootloader.
  33. I started digging into this in startup.c, and as...

    I started digging into this in startup.c, and as soon as I uncommented any of the debug lines 59-63, it started working.

    I add 1 nop and it still failed, but 2 nop's work. The nop's can be added...
  34. You would connect one color (e.g. red) to pins 24...

    You would connect one color (e.g. red) to pins 24 (LSB), 25, 19, 18, 14, 15 (MSB). The next color (green) to 40 (LSB) through 23 (MSB), and last color (blue) to 20 (LSB) through 27 (MSB).



    ...
  35. No USB serial with Teensy 4.x compiled Optimize: Debug

    I compiled the short sketch below with Optimize: Debug and no USB serial port is created under Windows or Linux. It works when using any other Optimize setting, and works with Teensy 3.5 compiled...
  36. Replies
    13
    Views
    4,302

    The library is now available via the Arduino...

    The library is now available via the Arduino library manager:

    Tools -> Manage Libraries ...
    Search for InternalTemperature
    Install
  37. Replies
    13
    Views
    4,302

    I will do that. Thanks

    I will do that. Thanks
  38. Replies
    13
    Views
    4,302

    I have added support for Teensy 4, so you can...

    I have added support for Teensy 4, so you can have common routines for both T3 and T4. Also added overtemp and undertemp alarms that you can attach ISR functions that are called when the temperature...
  39. Teensy 4 has a delayNanoseconds(), but not Teensy...

    Teensy 4 has a delayNanoseconds(), but not Teensy 3.

    This line has about 40 nanosecond overhead plus 40 nanosecond delay per loop at 240 MHz (80 nanoseconds at 120 MHz):


    for (int volatile...
  40. I tried my example above compiled with "Fastest...

    I tried my example above compiled with "Fastest with LTO" at speeds up to 240 MHz and it worked every time. It may be a subtle timing issue with your setup - what defines 'not working'.



    If a...
  41. I was not able to duplicate your problem. Both...

    I was not able to duplicate your problem. Both ways always set both pins. I first set and cleared the bits individually, then set and cleared them together.

    19923

    Here is my code:


    pinMode...
  42. Sorry, I've been using PDOR and didn't notice the...

    Sorry, I've been using PDOR and didn't notice the one letter difference. It looks like it should work with PSOR, but I've never used those registers so don't have any experience with them. I'll give...
  43. It looks like you are setting bits 18 and 19 in...

    It looks like you are setting bits 18 and 19 in GPIOB. In the second example, both bits are set from i at the same time. In the first example, the first line sets bit 18 from i with bit 19 set to 0,...
  44. Replies
    68
    Views
    38,018

    It's here! Teensy 4.0 beta release. Currently...

    It's here! Teensy 4.0 beta release. Currently only supports 3 channels, final release will have 8 channels.

    https://github.com/LAtimes2/TeensyLogicAnalyzer

    The high-computation modes...
  45. Replies
    68
    Views
    38,018

    For speed and consistency, it reads an entire...

    For speed and consistency, it reads an entire input port at once. So it is limited by the number of pins tied to each port. 12 pins is about the max, and I've thought about adding that, but it would...
  46. Replies
    68
    Views
    38,018

    I've been busy at work, but still hope to get to...

    I've been busy at work, but still hope to get to this soon :)
  47. Pins 24 and above are on different GPIO ports...

    Pins 24 and above are on different GPIO ports between Teensy 3.2 and Teensy 3.5/3.6. For 3.5/3.6, here is a table of pin numbers to port/bit number, and also a table of ports A-E to pin numbers. It...
  48. I've been experimenting with using a PWM pin for...

    I've been experimenting with using a PWM pin for the clock and polling on it. It works consistently at 10 MHz using the code below. If all the pins are on a single GPIO port, I can read it and store...
  49. One thought I have is to use a hardware PWM...

    One thought I have is to use a hardware PWM signal with 50% duty cycle to drive the clock and synchronize the software to read the ADC at the right time, perhaps via interrupt or polling.

    Here an...
  50. I was running your examples and was able to...

    I was running your examples and was able to duplicate the timing numbers. With a few small changes as shown below, I was able to get your next-to-last example to be about 10 times faster. [I had to...
Results 1 to 50 of 119
Page 1 of 3 1 2 3