Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T4 timer #48

Merged
merged 5 commits into from
Jan 18, 2020
Merged

T4 timer #48

merged 5 commits into from
Jan 18, 2020

Conversation

KurtE
Copy link
Collaborator

@KurtE KurtE commented Jan 5, 2020

@pedvide and @mjs513 -

This Branch has support for a DMA object that supports either round robin of two buffers or a single buffer that stops when full and you can manually restart.

Also the branch has Timer support to T4 using QTimer.

There are 4 new examples in this branch:

adc_dma - Does DMA operation, this uses the two buffer mode in continuous mode. And runs on LC, 3.x and 4.0

adc_timer - like adc_pdb but runs on both T3.x and T4. Also has an additional command T that fills a buffer and prints out details.. uses ISRs no DMA

adc_timer_dma - sort of combines the two. Instead of using ISR it uses DMA...

adc_time_dma_oneshot - like above, but instead of round robin it runs once, and prints out values and waits for you to type something and it runs again...

Let me know what you think

Have an example which is almost a direct copy of the adc_pdb app, except change PDB to Timer...

But I also extended the test app, to do do a timed read into buffers.  Currently defaulting to 500 count.  When the count is reached, the code will print out things like delta time, computed frquency  (currently using millis, micros would be closer), plus min, max, avg, and then a sort of RMS...

Next up debug DMA
This adds support for Timers as well as allows the DMA buffer object to
run with just one buffer.  In this mode, the dma buffer will code will
stop the dma operation when the buffer is filled.  It then allows you to
call a method to get another buffer full of analog samples.

Added examples that use the timer object.  On Teensy 3.x boards this
will use the PDB code.  On Teensy 4, this will use unused Quad timers.

There are three examples.

The first simply uses the timers and interrupts on each analog
conversion which happens at the frequency specified.

A second one use the DMA buffer object with two buffers, and runs
continuous analog samples round robins between them and prints out
info, like min, max, average.

A third one is like the second one, except you only pass one buffer to
the dma buffer object, so it halts doing conversions when the buffer is
filled and then restarts it, when you call a method on the dma buffer
object.

All three of these should compile on Teensy 3.x and 4 boards.  I tested
a few of them on T3.6 and the second one on T3.2 as well as T4.
Added a DMA buffer example that did not use a timer.  Runs on TLC, 3.x and 4

Turned off debug printing in DMA object

Updated examples to save last average value as user value in dma object
@KurtE KurtE mentioned this pull request Jan 5, 2020
The Interval Timer example did not compile on a T4.  Example was using T3.x register name, plus the reverse table from channel to pin was not defined for T4
@pedvide
Copy link
Owner

pedvide commented Jan 8, 2020

It looks great @KurtE! I'll have time to play with this and add it in two weeks, I want to think a bit about the API.

@pedvide pedvide merged commit 15d55ba into pedvide:master Jan 18, 2020
@KurtE KurtE deleted the T4_Timer branch January 19, 2020 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants