Hi everyone. Hope someone can help me with this.
I'm working on a Teensy-based MIDI-controller. Over the course of the last couple of years I've gone through many prototypes using Teensy 3.1 and 3.2, but with my recent switch to the Teensy 3.6 I've run into some problems.
Part of my controller interface is capacitive. The Teensy touchRead() function is awesome, and I have been able to get good sensitivity and speed, with all kinds of sensor types, materials and sizes, by adjusting the "CURRENT", "NSCAN" and "PRESCALE" in touch.c. I have settings for each of these for each of my prototypes, which produce similar output range, while (and this is very important) not introducing much latency.
However, there doesn't seem to be a "CURRENT" setting in touch.c for the chip used in the Teensy 3.6 (MK66FX1M0), and now I'm having a hard time getting sufficient resolution and sensitivity without making things too slow. My own rough bench-marking (specific to my setup) shows: best case 10 times slower for equivalent resolution/sensitivity, now that I can't adjust the current.
Is there a fix for this? Maybe it's some not yet implemented feature of the chip? Maybe just the harsh and painful reality of electronics development trade-offs?
I would appreciate any input on this. I'm really hoping to stay with the Teensy 3.6 because of it's raw speed and floating point unit, but if this isn't possible I'll go back to the Teensy 3.2 and not look back (or forward, or whatever...)
Thanks!
Edit. Here's the section of touch.c where I adjust the settings:
I'm working on a Teensy-based MIDI-controller. Over the course of the last couple of years I've gone through many prototypes using Teensy 3.1 and 3.2, but with my recent switch to the Teensy 3.6 I've run into some problems.
Part of my controller interface is capacitive. The Teensy touchRead() function is awesome, and I have been able to get good sensitivity and speed, with all kinds of sensor types, materials and sizes, by adjusting the "CURRENT", "NSCAN" and "PRESCALE" in touch.c. I have settings for each of these for each of my prototypes, which produce similar output range, while (and this is very important) not introducing much latency.
However, there doesn't seem to be a "CURRENT" setting in touch.c for the chip used in the Teensy 3.6 (MK66FX1M0), and now I'm having a hard time getting sufficient resolution and sensitivity without making things too slow. My own rough bench-marking (specific to my setup) shows: best case 10 times slower for equivalent resolution/sensitivity, now that I can't adjust the current.
Is there a fix for this? Maybe it's some not yet implemented feature of the chip? Maybe just the harsh and painful reality of electronics development trade-offs?
I would appreciate any input on this. I'm really hoping to stay with the Teensy 3.6 because of it's raw speed and floating point unit, but if this isn't possible I'll go back to the Teensy 3.2 and not look back (or forward, or whatever...)
Thanks!
Edit. Here's the section of touch.c where I adjust the settings:
Code:
#if defined(__MK20DX128__) || defined(__MK20DX256__)
// These settings give approx 0.02 pF sensitivity and 1200 pF range
// Lower current, higher number of scans, and higher prescaler
// increase sensitivity, but the trade-off is longer measurement
// time and decreased range.
#define CURRENT 15 // 0 to 15 - current to use, value is 2*(current+1)
#define NSCAN 1 // number of times to scan, 0 to 31, value is nscan+1
#define PRESCALE 1 // prescaler, 0 to 7 - value is 2^(prescaler+1)
static const uint8_t pin2tsi[] = {
//0 1 2 3 4 5 6 7 8 9
9, 10, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 13, 0, 6, 8, 7,
255, 255, 14, 15, 255, 12, 255, 255, 255, 255,
255, 255, 11, 5
};
// Teensy 3.6:
#elif defined(__MK66FX1M0__)
#define NSCAN 5
#define PRESCALE 1
static const uint8_t pin2tsi[] = {
//0 1 2 3 4 5 6 7 8 9
9, 10, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 13, 0, 6, 8, 7,
255, 255, 14, 15, 255, 255, 255, 255, 255, 11,
12, 255, 255, 255, 255, 255, 255, 255, 255, 255
};
#elif defined(__MKL26Z64__)
#define NSCAN 9
#define PRESCALE 2
static const uint8_t pin2tsi[] = {
//0 1 2 3 4 5 6 7 8 9
9, 10, 255, 2, 3, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 13, 0, 6, 8, 7,
255, 255, 14, 15, 255, 255, 255
};
#endif
Last edited: