Open buxit opened 5 years ago
weird - we're not sure if/when we'll get to figuring this out because its more advanced usage - let us know if you figure it out!
by trial and error (inserting returns at random positions, commenting out code lines) i have just found out that changing the clock source_generator
in Adafruit_CPlay_FreeTouch::setupClock()
to 3
(instead of 1) makes it work in my case, though i have absolutely no idea what this means and why it works.
yeah that could do it - wanna send a PR in? we'll look at it next time we do a sweep
that's what i thought … until i tested the part of the sketch that uses the microphone. with source_generator = 3
the call to pdm.configure()
– oddly enough – again breaks Adafruit_NeoMatrix_ZeroDMA
. i would have expected it to break the PTC, if at all. so if i then use 4 as gclk for Adafruit_ZeroPDM Adafruit_CPlay_Mic::pdm = Adafruit_ZeroPDM(34, 35, 4);
in Adafruit_CPlay_Mic.cpp
everything i currently need works as expected. not being able to use arbitrary sources/generators for the touch clock tells me that there's probably something wrong with clock setup in Adafruit_CPlay_FreeTouch.cpp
i think i'll have to read up on samd21 clocks and gain some more understanding before i can send a PR.
maybe you can persuade atmel / microchip / arm to provide full low-level documentation for the PTC?
there's no documentation for PTC - we've asked :( its all under NDA - we had to hand reverse engineer it from binary ;)
@PaintYourDragon do you know what this could be? its an obscure one but perhpas you're like "oh yeah i know this!"
I know why! See https://github.com/adafruit/Adafruit_FreeTouch/issues/17 for full details of how FreeTouch code affects DMA.
The copy of FreeTouch in Circuit Playground has the same issue.
This sketch demonstrates the issue using the Circuit Playground version of the code: https://gist.github.com/mzero/89955e14d41d7e37a439ba806746f632
On Circuit Playground Express, calling
CircuitPlayground.readCap()
makes Adafruit_NeoPixel_ZeroDMA display random pixels. Try with the following sketch:This is just the simplest example to show the problem without additional hardware. I'm in fact trying to use Adafruit_NeoMatrix_ZeroDMA on pin A2, but it exhibits exactly the same problem. When commenting out the
readCap()
line everything works as expected.Arduino board: Circuit Playground Express
Arduino IDE version: 1.8.8
Using Adafruit SAMD Boards 1.2.9 definition from https://adafruit.github.io/arduino-board-index/package_adafruit_index.json (otherwise Adafruit_NeoMatrix_DMA doesn't work at all)