Open neurologic opened 3 years ago
Hi @neurologic!
Cool that you are building this one too. Let us know how the practicals go?? We would also be keen to see some photos and videos if possible?? :)
About the issue, it seems the Every board uses a different chip, namely a ATMega4809. On your error message I see in the beginning the following: Board: "Arduino Nano Every, ATMEGA328"
I have installed the board definitions on my arduino IDE, and although I do not have one of these here to test, I can see that if you go on "tools" you have something called "Register Emulation" and I suspect selecting "none (ATMEGA 4809)" could fix this issue?
Related to this and to having smaller costs, we sometimes use "generic" Arduino Nano boards that we buy in amazon/ebay... They work quite reliably and are the exact chipset, etc to the Arduino Nanos we used to develop Spikeling and Flypi...
You can find one example here (note they come already with an USB cable, making them even more attractive :P )
Thank you! I need to update my email on github so I see these response notifications (face palm). I will try this tomorrow when I am back at lab. Sounds promising. And thanks for the nano amazon link to a known working cheap controller build.
I definitely need to send videos and photos soon! The FlyPi is coming along and I will be soldering the Spikelings so that every student in the class has one for class.
I was able to select the nano every and try the None (ATMEGA4809) option in tools. It looks like I am still getting the same ADMUX error:
Arduino: 1.8.15 (Windows 10), Board: "Arduino Nano Every, None (ATMEGA4809)"
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void ADC_init()':
SettingsArduino.h:90:2: error: 'ADMUX' was not declared in this scope
ADMUX = _BV(REFS0); // Reference voltage = Vcc (5V)
^~~~~
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:90:16: error: 'REFS0' was not declared in this scope
ADMUX = _BV(REFS0); // Reference voltage = Vcc (5V)
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:90:16: note: suggested alternative: 'VREF_t'
SettingsArduino.h:91:7: error: 'ADCSRA' was not declared in this scope
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:91:3: note: in expansion of macro 'sbi'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:91:7: note: suggested alternative: 'ADC_t'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:91:3: note: in expansion of macro 'sbi'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^~~
SettingsArduino.h:91:14: error: 'ADPS2' was not declared in this scope
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:91:3: note: in expansion of macro 'sbi'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^~~
SettingsArduino.h:92:14: error: 'ADPS1' was not declared in this scope
cbi(ADCSRA,ADPS1);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:92:3: note: in expansion of macro 'cbi'
cbi(ADCSRA,ADPS1);
^~~
SettingsArduino.h:93:14: error: 'ADPS0' was not declared in this scope
cbi(ADCSRA,ADPS0);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:93:3: note: in expansion of macro 'cbi'
cbi(ADCSRA,ADPS0);
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:93:14: note: suggested alternative: 'ADC0'
cbi(ADCSRA,ADPS0);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:93:3: note: in expansion of macro 'cbi'
cbi(ADCSRA,ADPS0);
^~~
SettingsArduino.h:94:16: error: 'ADEN' was not declared in this scope
ADCSRA |= _BV(ADEN); // Enable ADC
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:94:16: note: suggested alternative: 'ADC0'
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'uint16_t ADC_read(uint8_t)':
SettingsArduino.h:103:2: error: 'ADMUX' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^~~~~
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:103:18: error: 'MUX3' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:103:30: error: 'MUX2' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:103:42: error: 'MUX1' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:103:54: error: 'MUX0' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
SettingsArduino.h:105:2: error: 'ADCSRA' was not declared in this scope
ADCSRA |= _BV(ADSC);
^~~~~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:105:2: note: suggested alternative: 'ADC_t'
ADCSRA |= _BV(ADSC);
^~~~~~
ADC_t
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:105:16: error: 'ADSC' was not declared in this scope
ADCSRA |= _BV(ADSC);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:105:16: note: suggested alternative: 'ADC0'
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
SettingsArduino.h:107:10: error: 'ADC' was not declared in this scope
return ADC;
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:107:10: note: suggested alternative: 'ADC0'
return ADC;
^~~
ADC0
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void initializeHardware()':
SettingsArduino.h:129:3: error: 'TCCR2B' was not declared in this scope
TCCR2B = TCCR2B & 0b11111000 | 0x01; // sets PWM pins 3 and 11 (timer 2) to 31250 Hz
^~~~~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:129:3: note: suggested alternative: 'TCB2'
TCCR2B = TCCR2B & 0b11111000 | 0x01; // sets PWM pins 3 and 11 (timer 2) to 31250 Hz
^~~~~~
TCB2
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void housekeeping()':
SettingsArduino.h:147:5: error: 'ADMUX' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^~~~~
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:147:21: error: 'MUX3' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:147:33: error: 'MUX2' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:147:45: error: 'MUX1' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:147:57: error: 'MUX0' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
SettingsArduino.h:149:5: error: 'ADCSRA' was not declared in this scope
ADCSRA |= _BV(ADSC);
^~~~~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:149:5: note: suggested alternative: 'ADC_t'
ADCSRA |= _BV(ADSC);
^~~~~~
ADC_t
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:149:19: error: 'ADSC' was not declared in this scope
ADCSRA |= _BV(ADSC);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:149:19: note: suggested alternative: 'ADC0'
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
SettingsArduino.h:151:32: error: 'ADC' was not declared in this scope
ADCData[iADCData[i] -A0] = ADC;
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:151:32: note: suggested alternative: 'ADC0'
ADCData[iADCData[i] -A0] = ADC;
^~~
ADC0
exit status 1
'ADMUX' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This seems similar, but there was no reply posted: https://github.com/Yveaux/Arduino_Vcc/issues/5
Do I maybe need different syntax for these functions (ADC_init, ADC_read, etc) on an ATmega4809 based Arduino versus a ATmega328 based Arduino? See the following: https://tomalmy.com/reading-the-chip-temperature/
I have never worked with this level of control on microcontrollers before.
Hi, I had a look at the differences between the two chips on these boards, and from what I could gather, the 4809 is a cheaper much more capable chip, but to make it "backward compatible" with the Nano footprint and programming interface/functions, they needed add some sort of "emulation" layer, which does not seem to work 100% smoothly...
I am not sure how to tackle this other than learning more about the Nano every and reimplementing the analog reading functions on new code... but at the moment, this is not something I can dedicate time to... Maybe @TomBaden or other people that are the main developers of Spikeling could chime in?
From what I read the Nano will/is discontinued, so it might be a good thing to do this anyway? At the same time, I doubt the chinese clones will simply stop being produced...
Hi, we used direct register access to the ADC for speed reasons. The relevant registers seem not to be defined in the new Nano, hence the errors above. I think that could be relatively easily fixed. As the new microcontroller seems more capable, the hardware access is likely not needed any longer and instead, the ADC library functions could be used. This said, I can try to make the needed edits in the next days and I can make sure that it is still "old" Nano compatible. But I cannot test the code on a new Nano, as I don't have one.
@neurologic
Hi,
can you please comment out the following lines in SettingsArduino.h
, try to recompile and tell us what the compiler reports?
The changes should look like this:
//#define USES_FAST_ADC
//#define USES_HOUSEKEEPING
Thanks
Hi @teuler,
I tried that suggestion and received the error 'MAX_ADC_DATA' was not declared in this scope.
Error was highlighted on for(uint8_t i=0; i<MAX_ADC_DATA; i+=1) {
of void ADC_init(void)
in SettingsArduino.h.
See details from the copied error log in the dropdown below:
```python
Arduino: 1.8.15 (Windows 10), TD: 1.54, Board: "Arduino Nano Every, None (ATMEGA4809)"
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void ADC_init()':
SettingsArduino.h:85:22: error: 'MAX_ADC_DATA' was not declared in this scope
for(uint8_t i=0; i
Something that I did try next:
Since I saw that MAX_ADC_DATA was defined inside of the #ifdef USES_HOUSEKEEPING
condition and we took out the USES_HOUSEKEEPING definition -- I placed the following outside of that conditional.
#define MAX_ADC_DATA 8
uint16_t ADCData[MAX_ADC_DATA];
(after bringing #define MAX_ADC_DATA 8
out of the conditional the next error was ADCData not defined
so I brought that one out too)
The next error that I got was the following (see details in the dropdown):
```python
Arduino: 1.8.15 (Windows 10), TD: 1.54, Board: "Arduino Nano Every, None (ATMEGA4809)"
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void ADC_init()':
SettingsArduino.h:93:2: error: 'ADMUX' was not declared in this scope
ADMUX = _BV(REFS0); // Reference voltage = Vcc (5V)
^~~~~
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:93:16: error: 'REFS0' was not declared in this scope
ADMUX = _BV(REFS0); // Reference voltage = Vcc (5V)
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:93:16: note: suggested alternative: 'VREF_t'
SettingsArduino.h:94:7: error: 'ADCSRA' was not declared in this scope
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:94:3: note: in expansion of macro 'sbi'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:94:7: note: suggested alternative: 'ADC_t'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:94:3: note: in expansion of macro 'sbi'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^~~
SettingsArduino.h:94:14: error: 'ADPS2' was not declared in this scope
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:94:3: note: in expansion of macro 'sbi'
sbi(ADCSRA,ADPS2); // Prescaler 1 MHz
^~~
SettingsArduino.h:95:14: error: 'ADPS1' was not declared in this scope
cbi(ADCSRA,ADPS1);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:95:3: note: in expansion of macro 'cbi'
cbi(ADCSRA,ADPS1);
^~~
SettingsArduino.h:96:14: error: 'ADPS0' was not declared in this scope
cbi(ADCSRA,ADPS0);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:96:3: note: in expansion of macro 'cbi'
cbi(ADCSRA,ADPS0);
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:96:14: note: suggested alternative: 'ADC0'
cbi(ADCSRA,ADPS0);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:96:3: note: in expansion of macro 'cbi'
cbi(ADCSRA,ADPS0);
^~~
SettingsArduino.h:97:16: error: 'ADEN' was not declared in this scope
ADCSRA |= _BV(ADEN); // Enable ADC
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:97:16: note: suggested alternative: 'ADC0'
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'uint16_t ADC_read(uint8_t)':
SettingsArduino.h:106:2: error: 'ADMUX' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^~~~~
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:106:18: error: 'MUX3' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:106:30: error: 'MUX2' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:106:42: error: 'MUX1' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
SettingsArduino.h:106:54: error: 'MUX0' was not declared in this scope
ADMUX &= ~(_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0));
^
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
SettingsArduino.h:108:2: error: 'ADCSRA' was not declared in this scope
ADCSRA |= _BV(ADSC);
^~~~~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:108:2: note: suggested alternative: 'ADC_t'
ADCSRA |= _BV(ADSC);
^~~~~~
ADC_t
In file included from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\kperks\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/String.h:31,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/IPAddress.h:24,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/ArduinoAPI.h:30,
from C:\Users\kperks\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:23,
from sketch\Spikeling.ino.cpp:1:
SettingsArduino.h:108:16: error: 'ADSC' was not declared in this scope
ADCSRA |= _BV(ADSC);
^
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:108:16: note: suggested alternative: 'ADC0'
In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0:
SettingsArduino.h:110:10: error: 'ADC' was not declared in this scope
return ADC;
^~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:110:10: note: suggested alternative: 'ADC0'
return ADC;
^~~
ADC0
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void initializeHardware()':
SettingsArduino.h:132:3: error: 'TCCR2B' was not declared in this scope
TCCR2B = TCCR2B & 0b11111000 | 0x01; // sets PWM pins 3 and 11 (timer 2) to 31250 Hz
^~~~~~
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:132:3: note: suggested alternative: 'TCB2'
TCCR2B = TCCR2B & 0b11111000 | 0x01; // sets PWM pins 3 and 11 (timer 2) to 31250 Hz
^~~~~~
TCB2
D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void housekeeping()':
SettingsArduino.h:149:22: error: 'N_ADC_IND' was not declared in this scope
for(uint8_t i=0; i
Thanks for the explanation in your last reply. Helps me understand more what is going on. Do you have any next steps to try? I can try to be more quick at responding to close the troubleshooting loop better (this week is the end of the summer research program so I have been very side-tracked by students this week). Just to confirm, I am able to load other programs to the NanoEverys that I have (such as a 'Blink' program). So the basic IDE --> NanoEvery communication is in theory working.
Thanks!
Hi @neurologic thanks for doing the tests. This was helpful. I made some changes to the code and tested it on my Arduino Nano.
USES_FAST_ADC
, the code should not use any direct register access any more. This should make the code compatible with your chipUSES_HOUSEKEEPING
active; if probably does not have a big effect on speed, but it keeps all the analog-in reads in one place, allowing to optimize this in one place easier, if needed.USES_FASTER_PWM
, which is now also commented out. Activating this, will set the PWM to higher frequencies, again using registers. I assume that this would also cause errors with your chip. If everything else works, you may try uncommenting this switch to see if it works.Please let me know if these changes work for you. Again, as I don't have an Nano Every, I cannot test it directly. Therefore, another round of debugging may be needed. Thanks for your patience.
I did a git pull (it sounds like you made the changes to the repository code, correct?).
It did not fail on upload via Arduino IDE!
I did get this message after upload:
avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
But it does not seem like a fatal error/warning (at least for now) because the Nano every is now driving the Spikeling PCB! Thank you!!
I subsequently tried USES_FASTER_PWM and it did fail on the Nano Every chip: (so for now with the nano every, I can just comment out that flag)
```python Arduino: 1.8.15 (Windows 10), TD: 1.54, Board: "Arduino Nano Every, ATMEGA328" In file included from D:\Spikeling\Arduino\Spikeling\Spikeling.ino:10:0: D:\Spikeling\Arduino\Spikeling\SettingsArduino.h: In function 'void initializeHardware()': SettingsArduino.h:141:5: error: 'TCCR2B' was not declared in this scope TCCR2B = TCCR2B & 0b11111000 | 0x01; // sets PWM pins 3 and 11 (timer 2) to 31250 Hz ^~~~~~ D:\Spikeling\Arduino\Spikeling\SettingsArduino.h:141:5: note: suggested alternative: 'TCB2' TCCR2B = TCCR2B & 0b11111000 | 0x01; // sets PWM pins 3 and 11 (timer 2) to 31250 Hz ^~~~~~ TCB2 exit status 1 'TCCR2B' was not declared in this scope This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. ```
I did get this message after upload: avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
Searching for this message brings up, for instance, this: https://forum.arduino.cc/t/nano-every-avrdude-jtagmkii_initialize/607462
It says you can ignore it; I have looked at this thread only briefly, but maybe you find information there about how to fix it.
I subsequently tried USES_FASTER_PWM and it did fail on the Nano Every chip: (so for now with the nano every, I can just comment out that flag) 'TCCR2B' was not declared in this scope
This is a similar issue as the one with the ADC, the Arduino port to the Nano every seems not to define these hardware registers. Probably because it has a different internal structure and it would be too complicated/ technically impossible to provide the same low level of hardware access.
I am making some Spikelings for the Neurophysiology lab that I am teaching for the spring. I made two to test and they are awesome! To scale up, I got the pin-equivalent Nano Every that was much cheaper from Arduino in a pack of 6. I am getting an error that I do not understand how to troubleshoot myself (see below). It seems like there are some differences in some of the code needed for this Processor. (for example, in FlyPi, I had to change "B00001111" to "0B00001111" in the matrix pattern specification to get it to work). The following seems like a more complicated modificaiton: Do you have any suggestion? Thank you!