First of all, sorry for posting, but "every" is a noisy word for the search engines...
I've written a code using both MAX30102 oximetry sensor (Sparkfun 3010x library) and SD card for data logging.
The code is reduced to the bone, so the memory is predominantly used by the libraries.
Using Arduino Nano che code cannot be uploaded because it reaches 120% of memory, so I decided to try with Nano Every.
The weird thing is that using Nano Every I get exactly the same result: 120% memory request.
Is it an IDE 2.1.0 problem?
Any suggestions?
Thank You all.
Not possible, the Nano Every has 50% more ram.
Did you select Nano Every in the boards list?
Edit: @PaulRB 50% more Flash memory. 200% more ram.
That was my first idea, but IDE 2.1.0 (the last, as far as i know) only lists Arduino Nano....
50% more Flash memory. 200% more ram.
You will havr to install the Arduino megaAvr board package using the board manager. After that the Nano Every will show in the list.
Just done. Thank you! Now it works. Now the Every's memory is seen and the code occupies 44% of memory.
But new problems with libraries conflicts occur.... Are there any methods to solve them?
Thanks again.
It depends on the errors that you get. Some are reasonably easy to solve, others near impossible. Post your sketch and the errors. Please also provide the information how / from where you installed the libraries so we don't have to hunt for them (and possibly find the wrong one).
It's very easy to describe the environment:
- library is Sparkfun MAX3010x Pulse and Proximity 1.1.2
- the code is Example8_SPO2.ino provided as an example in the library package
- Arduino IDE is 2.1.0 with megaAVR board package
- Processor in Arduino Nano Every by Arduino - Italy
the message sent by the compiler is:
In file included from C:\Users\Vaio\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.h:20:0,
from C:\Users\Vaio\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.cpp:12:
C:\Users\Vaio\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h: In member function 'uint8_t MAX30105::readRegister8(uint8_t, uint8_t)':
C:\Users\Vaio\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:63:12: note: candidate 1: size_t TwoWire::requestFrom(int, int)
size_t requestFrom(int, int);
^~~~~~~~~~~
C:\Users\Vaio\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:61:12: note: candidate 2: virtual size_t TwoWire::requestFrom(uint8_t, size_t)
size_t requestFrom(uint8_t, size_t);
^~~~~~~~~~~
Lo sketch usa 11193 byte (22%) dello spazio disponibile per i programmi. Il massimo è 49152 byte.
Le variabili globali usano 2153 byte (35%) di memoria dinamica, lasciando altri 3991 byte liberi per le variabili locali. Il massimo è 6144 byte.
avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
The good news is that you don't have errors but warnings. If you set the "compiler warnings" to ALL in file → preferences, you will find the problematic part of the library
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.cpp: In member function 'uint8_t MAX30105::readRegister8(uint8_t, uint8_t)':
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.cpp:740:53: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
_i2cPort->requestFrom((uint8_t)address, (uint8_t)1); // Request 1 byte
^
In file included from c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.h:20:0,
from c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.cpp:12:
C:\Users\Wim\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:63:12: note: candidate 1: size_t TwoWire::requestFrom(int, int)
size_t requestFrom(int, int);
^~~~~~~~~~~
C:\Users\Wim\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:61:12: note: candidate 2: virtual size_t TwoWire::requestFrom(uint8_t, size_t)
size_t requestFrom(uint8_t, size_t);
^~~~~~~~~~~
The first line tells you where the warning came from. So you can open the library file using a normal editor, navigate to line 740 in MAX30105.cpp and modify it. The full function where the problem is
//
// Low-level I2C Communication
//
uint8_t MAX30105::readRegister8(uint8_t address, uint8_t reg) {
_i2cPort->beginTransmission(address);
_i2cPort->write(reg);
_i2cPort->endTransmission(false);
//_i2cPort->requestFrom((uint8_t)address, (uint8_t)1); // Request 1 byte <<== line 740
_i2cPort->requestFrom((uint8_t)address, (size_t)1); // Request 1 byte
if (_i2cPort->available())
{
return(_i2cPort->read());
}
return (0); //Fail
}
You will find a few more problems and I think that the below is a bug in the library (file heartRate.cpp).
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\heartRate.cpp: In function 'bool checkForBeat(int32_t)':
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\heartRate.cpp:108:33: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
if ((IR_AC_Max - IR_AC_Min) > 20 & (IR_AC_Max - IR_AC_Min) < 1000)
That should be a double &
if ((IR_AC_Max - IR_AC_Min) > 20 && (IR_AC_Max - IR_AC_Min) < 1000)
Please be aware that any update to the library will undo the changes that you made manually !!
Note:
the last line that you posted from he upload output is normal; it might be confusing though.
Thak you very much sterretje.
I went ahead a few steps. The correction on the data size in the Low-level I2C Communication decreased the warnings and made the program hang later , so being capable to execute a few more function calls.
The correction about replacing && instead of & produced an error so preventing the code from being generated. As a matter of fact I've noticed that the code contains several boolean evaluations suspiciously built using & instead of &&, but they work!
Now the program (Example8-SPO2.ino) hangs after the first execution of
redBuffer[i] = particleSensor.getRed();
forgotten: I've also set the Register Emulation mode at "None (ATMEGA4809)"
Not for me
Modified line 108 in heartRate.cpp
if ((IR_AC_Max - IR_AC_Min) > 20 && (IR_AC_Max - IR_AC_Min) < 1000)
Compile results; the remaining warnings can be ignored,
In file included from C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202364-10956-1teqoa4.iddh\Example8_SPO2\Example8_SPO2.ino:31:0:
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src/spo2_algorithm.h:84:17: warning: 'an_y' defined but not used [-Wunused-variable]
static int32_t an_y[ BUFFER_SIZE]; //red
^~~~
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src/spo2_algorithm.h:83:17: warning: 'an_x' defined but not used [-Wunused-variable]
static int32_t an_x[ BUFFER_SIZE]; //ir
^~~~
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.cpp: In member function 'void MAX30105::enableSlot(uint8_t, uint8_t)':
c:\Users\Wim\Documents\Arduino\libraries\SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library\src\MAX30105.cpp:292:11: warning: unused variable 'originalContents' [-Wunused-variable]
uint8_t originalContents;
^~~~~~~~~~~~~~~~
Sketch uses 11121 bytes (22%) of program storage space. Maximum is 49152 bytes.
Global variables use 2153 bytes (35%) of dynamic memory, leaving 3991 bytes for local variables. Maximum is 6144 bytes.
I don't have a Nano Every and I don't have the sensor board so can't help further.
PS
My register emulation was also set to 'none'
Thank you very much. I will try againg. Should I solve everything, I will post the solution.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.