That shows the TeensyDuino install library location - is that were the latest Github Download was installed? The latest T_4 version isn't included in a TeensyDuino install yet AFAIK.
ADC_Module.cpp: In constructor 'ADC_Module::ADC_Module(uint8_t, const uint8_t*, ADC_settings::ADC_REGS_t&)':
ADC_Module.cpp:61:28: error: 'XBARA1_IN_QTIMER4_TIMER3' was not declared in this scope
, XBAR_IN(ADC_num? XBARA1_IN_QTIMER4_TIMER3 : XBARA1_IN_QTIMER4_TIMER0)
ADC_Module.cpp:61:55: error: 'XBARA1_IN_QTIMER4_TIMER0' was not declared in this scope
, XBAR_IN(ADC_num? XBARA1_IN_QTIMER4_TIMER3 : XBARA1_IN_QTIMER4_TIMER0)
ADC_Module.cpp:62:29: error: 'XBARA1_OUT_ADC_ETC_TRIG10' was not declared in this scope
, XBAR_OUT(ADC_num? XBARA1_OUT_ADC_ETC_TRIG10 : XBARA1_OUT_ADC_ETC_TRIG00)
ADC_Module.cpp:62:57: error: 'XBARA1_OUT_ADC_ETC_TRIG00' was not declared in this scope
, XBAR_OUT(ADC_num? XBARA1_OUT_ADC_ETC_TRIG10 : XBARA1_OUT_ADC_ETC_TRIG00)
ADC_Module.cpp: In member function 'void ADC_Module::startQuadTimer(uint32_t)':
ADC_Module.cpp:1506:24: error: 'struct IMXRT_REGISTER32_t' has no member named 'CTRL'
if ( IMXRT_ADC_ETC.CTRL & ADC_ETC_CTRL_SOFTRST) {// SOFTRST
ADC_Module.cpp:1506:31: error: 'ADC_ETC_CTRL_SOFTRST' was not declared in this scope
if ( IMXRT_ADC_ETC.CTRL & ADC_ETC_CTRL_SOFTRST) {// SOFTRST
ADC_Module.cpp:1508:44: error: 'struct IMXRT_REGISTER32_t' has no member named 'CTRL'
atomic::clearBitFlag(IMXRT_ADC_ETC.CTRL, ADC_ETC_CTRL_SOFTRST);
ADC_Module.cpp:1512:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'CTRL'
IMXRT_ADC_ETC.CTRL |=
ADC_Module.cpp:1513:14: error: 'ADC_ETC_CTRL_TSC_BYPASS' was not declared in this scope
(ADC_ETC_CTRL_TSC_BYPASS | ADC_ETC_CTRL_DMA_MODE_SEL | ADC_ETC_CTRL_TRIG_ENABLE(1 << ADC_ETC_TRIGGER_INDEX)); // 0x40000001; // start with trigger 0
ADC_Module.cpp:1513:40: error: 'ADC_ETC_CTRL_DMA_MODE_SEL' was not declared in this scope
(ADC_ETC_CTRL_TSC_BYPASS | ADC_ETC_CTRL_DMA_MODE_SEL | ADC_ETC_CTRL_TRIG_ENABLE(1 << ADC_ETC_TRIGGER_INDEX)); // 0x40000001; // start with trigger 0
ADC_Module.cpp:1513:119: error: 'ADC_ETC_CTRL_TRIG_ENABLE' was not declared in this scope
(ADC_ETC_CTRL_TSC_BYPASS | ADC_ETC_CTRL_DMA_MODE_SEL | ADC_ETC_CTRL_TRIG_ENABLE(1 << ADC_ETC_TRIGGER_INDEX)); // 0x40000001; // start with trigger 0
ADC_Module.cpp:1514:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'TRIG'
IMXRT_ADC_ETC.TRIG[ADC_ETC_TRIGGER_INDEX].CTRL = ADC_ETC_TRIG_CTRL_TRIG_CHAIN(0); // chainlength -1 only us
ADC_Module.cpp:1514:88: error: 'ADC_ETC_TRIG_CTRL_TRIG_CHAIN' was not declared in this scope
IMXRT_ADC_ETC.TRIG[ADC_ETC_TRIGGER_INDEX].CTRL = ADC_ETC_TRIG_CTRL_TRIG_CHAIN(0); // chainlength -1 only us
ADC_Module.cpp:1515:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'TRIG'
IMXRT_ADC_ETC.TRIG[ADC_ETC_TRIGGER_INDEX].CHAIN_1_0 =
ADC_Module.cpp:1516:37: error: 'ADC_ETC_TRIG_CHAIN_IE0' was not declared in this scope
ADC_ETC_TRIG_CHAIN_IE0(1) /*| ADC_ETC_TRIG_CHAIN_B2B0 */
ADC_Module.cpp:1517:41: error: 'ADC_ETC_TRIG_CHAIN_HWTS0' was not declared in this scope
| ADC_ETC_TRIG_CHAIN_HWTS0(1) | ADC_ETC_TRIG_CHAIN_CSEL0(adc_pin_channel) ;
ADC_Module.cpp:1517:85: error: 'ADC_ETC_TRIG_CHAIN_CSEL0' was not declared in this scope
| ADC_ETC_TRIG_CHAIN_HWTS0(1) | ADC_ETC_TRIG_CHAIN_CSEL0(adc_pin_channel) ;
ADC_Module.cpp:1523:27: error: 'struct IMXRT_REGISTER32_t' has no member named 'DMA_CTRL'
IMXRT_ADC_ETC.DMA_CTRL |= ADC_ETC_DMA_CTRL_TRIQ_ENABLE(ADC_ETC_TRIGGER_INDEX);
ADC_Module.cpp:1523:89: error: 'ADC_ETC_DMA_CTRL_TRIQ_ENABLE' was not declared in this scope
IMXRT_ADC_ETC.DMA_CTRL |= ADC_ETC_DMA_CTRL_TRIQ_ENABLE(ADC_ETC_TRIGGER_INDEX);
ADC_Module.cpp:1528:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'CTRL'
IMXRT_ADC_ETC.CTRL &= ~(ADC_ETC_CTRL_TSC_BYPASS); // 0x40000001; // start with trigger 0
ADC_Module.cpp:1528:33: error: 'ADC_ETC_CTRL_TSC_BYPASS' was not declared in this scope
IMXRT_ADC_ETC.CTRL &= ~(ADC_ETC_CTRL_TSC_BYPASS); // 0x40000001; // start with trigger 0
ADC_Module.cpp:1529:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'CTRL'
IMXRT_ADC_ETC.CTRL |= ADC_ETC_CTRL_DMA_MODE_SEL | ADC_ETC_CTRL_TRIG_ENABLE(1 << ADC_ETC_TRIGGER_INDEX); // Add trigger
ADC_Module.cpp:1529:31: error: 'ADC_ETC_CTRL_DMA_MODE_SEL' was not declared in this scope
IMXRT_ADC_ETC.CTRL |= ADC_ETC_CTRL_DMA_MODE_SEL | ADC_ETC_CTRL_TRIG_ENABLE(1 << ADC_ETC_TRIGGER_INDEX); // Add trigger
ADC_Module.cpp:1529:110: error: 'ADC_ETC_CTRL_TRIG_ENABLE' was not declared in this scope
IMXRT_ADC_ETC.CTRL |= ADC_ETC_CTRL_DMA_MODE_SEL | ADC_ETC_CTRL_TRIG_ENABLE(1 << ADC_ETC_TRIGGER_INDEX); // Add trigger
ADC_Module.cpp:1530:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'TRIG'
IMXRT_ADC_ETC.TRIG[ADC_ETC_TRIGGER_INDEX].CTRL = ADC_ETC_TRIG_CTRL_TRIG_CHAIN(0); // chainlength -1 only us
ADC_Module.cpp:1530:88: error: 'ADC_ETC_TRIG_CTRL_TRIG_CHAIN' was not declared in this scope
IMXRT_ADC_ETC.TRIG[ADC_ETC_TRIGGER_INDEX].CTRL = ADC_ETC_TRIG_CTRL_TRIG_CHAIN(0); // chainlength -1 only us
ADC_Module.cpp:1531:23: error: 'struct IMXRT_REGISTER32_t' has no member named 'TRIG'
IMXRT_ADC_ETC.TRIG[ADC_ETC_TRIGGER_INDEX].CHAIN_1_0 =
ADC_Module.cpp:1532:35: error: 'ADC_ETC_TRIG_CHAIN_IE0' was not declared in this scope
ADC_ETC_TRIG_CHAIN_IE0(1) /*| ADC_ETC_TRIG_CHAIN_B2B0 */
ADC_Module.cpp:1533:39: error: 'ADC_ETC_TRIG_CHAIN_HWTS0' was not declared in this scope
| ADC_ETC_TRIG_CHAIN_HWTS0(1) | ADC_ETC_TRIG_CHAIN_CSEL0(adc_pin_channel) ;
ADC_Module.cpp:1533:83: error: 'ADC_ETC_TRIG_CHAIN_CSEL0' was not declared in this scope
| ADC_ETC_TRIG_CHAIN_HWTS0(1) | ADC_ETC_TRIG_CHAIN_CSEL0(adc_pin_channel) ;
ADC_Module.cpp:1536:27: error: 'struct IMXRT_REGISTER32_t' has no member named 'DMA_CTRL'
IMXRT_ADC_ETC.DMA_CTRL |= ADC_ETC_DMA_CTRL_TRIQ_ENABLE(ADC_ETC_TRIGGER_INDEX);
ADC_Module.cpp:1536:89: error: 'ADC_ETC_DMA_CTRL_TRIQ_ENABLE' was not declared in this scope
IMXRT_ADC_ETC.DMA_CTRL |= ADC_ETC_DMA_CTRL_TRIQ_ENABLE(ADC_ETC_TRIGGER_INDEX);
I just tried to compile some of the examples(adc_test, analogRead) in the updated library and get quite a few "not declared in this scope" and "has no member" errors. The same happens with my own sketches. Did I not download the repository correctly or is there something else I missed?
There is a version of it that works today that I believe was included in Teensyduino 1.49.will the ADC library be available for the teensy 4 soon ?
... questions regarding ADC:
- Do I understand correctly that when I start a continuous conversion with e.g. "adc->startContinuous(A9)" this will be performed by a separate controller/CPU and won't slow down the main execution of my loop?
- When I read a value with "adc->analogReadContinuous(A9)" does that read the latest measured value? If so, what happens with the previous values? (I don't need them anyway but I ask just to clarify the concept for myself, are these values discarded?)
- If I read a value with "adc->analogReadContinuous(A9)" too soon after I started a continuous measurement, will this call block until the conversion is finished or it will return immediately. If it will return immediately, what value will I receive, zero?
- Depending on the answer of previous questions, is there any chance that a call to "analogReadContinuous" can block for some reason until a value is obtained? To clarify, I would like to avoid that, I prefer having an older value served immediately, rather than block and wait there.
- Can I supply an arbitrary resolution number, or there are predefined ones? For instance, can I configure a 9-bit resolution? If so, is the measurement automatically scaled to fit entirely in that range or there are some other considerations? If so, what's the max value that I can use to determine the proper voltage?
...
There is an example for ReadContinuous() :: …\hardware\teensy\avr\libraries\ADC\examples\analogContinuousRead\analogContinuousRead.ino
Adjust that for personal use case and looking at that should allow seeing the function and performance. Can add elapsedMicros() to observe timing.
That is the only way to get best specific answers. There is a DOC HTML in the library - but such details are not provided as the example will quickly provide.
Post if that leaves questions on function within that sketch.
Yes, I’ve seen this example but I hoped I could have precise answers (probably from the author) based on the hardware architecture and the ADC library design rather than having to measure since measuring won’t answer most of my questions that are related to synchronization and concurrent executions. I believe those should be easy answers, am I right? Measuring seems like a last resort.
If you are looking for precise information, sometimes the best thing to do is to look at the reference manual for the chip you are using.Yes, I’ve seen this example but I hoped I could have precise answers (probably from the author) based on the hardware architecture and the ADC library design rather than having to measure since measuring won’t answer most of my questions that are related to synchronization and concurrent executions. I believe those should be easy answers, am I right? Measuring seems like a last resort.
int analogReadContinuous() __attribute__((always_inline)) {
#ifdef ADC_TEENSY_4
return (int16_t)(int32_t)adc_regs.R0;
#else
return (int16_t)(int32_t)adc_regs.RA;
#endif
}
Controls the overwriting of the next converted Data onto the existing (previous) unread data into the Data
result register.
1 Enable the overwriting.
0 Disable the overwriting. Existing Data in Data result register will not be overwritten by subsequent
converted data.