Search results

  1. L

    Using the analog comparator to build a frequency counter with the Teensy 4.0

    This is a nice example, but I was able to accomplish the same result myself. The problem is that the hysteresis levels provided by the built in analog comparator are not always enough, hence I asked about setting two different compare voltages. Is this possible or is there some other way like...
  2. L

    Using the analog comparator to build a frequency counter with the Teensy 4.0

    Hello everyone, I would like to use the analog comparator of the Teensy 4.0 (page 3425 of the manual and onward) to build a frequency counter. I would like to set it to generate an interrupt when the value of my pin of choice exceeds a certain value and another when the value falls below a...
  3. L

    OCOTP_ANA1 register does not exist?

    I want to read the temperature from the internal sensor. My Code for this is #include <Arduino.h> void setup() { } void loop() { Serial.println((TEMPMON_TEMPSENSE0 & 0x000FFF00) >> 8); delay(20); } This works, but in order to convert the raw value into an actual temperature, you need...
  4. L

    Teensy 4.0 DMA SPI Speed issues

    Your code doesn't compile for me. It gives the errors 'DMASPI0' was not declared in this scope 'DMASIZE0' was not declared in this scope and 'src0' was not declared in this scope Any idea why?
  5. L

    Letting the SPI generate an interrupt after every byte sent/read in an array

    Thank you, this clears up the issue. I'm using the Teensy 4.0. The single hardware CS pin is not enough and the other pins do influence how the device uses the actual bytes (it's a digital-analog-converter). I don't think it's that big of an issue, I just won't get to produce a suitable sine...
  6. L

    Letting the SPI generate an interrupt after every byte sent/read in an array

    The SPI library lets you send and receive data to and from an SPI device. I want to send and read a lot of data to and from devices without putting too much load on the core, so I'd like to do this via DMA. But the devices also need specific signals from pins so is it possible to send or read an...
  7. L

    Pushing the limits with timers and interrupts on the Teensy 4.0

    I have experimented with the general purpose timer (GPT) and am quite pleased with how it works (except the fact that reading from and writing to the status register takes incredibly long *ahem*). There are two entirely independent GPTs (GPT1 and GPT2) that offer three output-compare channels...
  8. L

    How to use the general purpose timer (GPT) output conpare interrupt

    OK, so this works if you want to use only one interrupt per timer (which is two in total). Is there a way to attach three different routines to the three output-compare events of one timer?
  9. L

    Reading from and writing to the GPTx_SR register takes incredibly long

    The overhead of digitalWriteFast() is nothing compared to the problem here (3 ns = 150 MHz). Here is what your code produces:
  10. L

    Reading from and writing to the GPTx_SR register takes incredibly long

    Here is what the reading of the oscilloscope looks like:
  11. L

    Reading from and writing to the GPTx_SR register takes incredibly long

    Update: With the 150 MHz clock it only takes about 80 ns. But that is still way too long for just setting or reading a value. This is the sketch I used for testing this: #include <Arduino.h> void setup() { pinMode(13, OUTPUT); CCM_CSCMR1 &= 0xFFFFFFBF;// Use the Root-Clock CCM_CCGR1 |=...
  12. L

    Reading from and writing to the GPTx_SR register takes incredibly long

    But I am using the peripheral clock, which runs at 150 MHz...
  13. L

    Reading from and writing to the GPTx_SR register takes incredibly long

    I have been working on a project where I use timer controlled interrupts. One of the things necessary for that is to reset the respective bits in the GPT Status Register. Reading a value from that register via uint32_t value = GPT1_SR; or writing to it via GPT1_SR = 0x00000001; takes both...
  14. L

    How to pull down an input pin on the Teensy 4.0

    It seems that the Pins are connected to GND via a 100 kOhm resistor by default. It is possible to disconnect them though using pinMode(pin, INPUT_PULLUP); See also https://www.pjrc.com/teensy/td_digital.html. If a pin was set as an output and you want to change it to an input, it will...
  15. L

    How to pull down an input pin on the Teensy 4.0

    Is there any way to pull down an input pin on the Teensy 4.0 other that manually connecting it to GND via a resistor?
  16. L

    How to use the general purpose timer (GPT) output conpare interrupt

    Thanks manitou for the inspiration. I've been working on the project for some time now and was able to get it working the way I wanted it to (I'd still like the structure to be a bit better, but interrupts demand quick response times). I wrote two libraries (one for general use of projects like...
  17. L

    How to use the general purpose timer (GPT) output conpare interrupt

    I am trying to create multiple interrupts that use the gpt. The project should look something like this: // compare values that will trigger the interrupts uint32_t ocvalue1 = 1000; uint32_t ocvalue2 = 1500; void setup() { // Whatever has to be done to get this working } // Stuff that...
Back
Top