Wiz-IO / Arduino-Quectel-BC66

Arduino port for Quectel BC66 LTE Narow Band modules ( OpenCPU based )
46 stars 21 forks source link

undefined reference to `Wire' #12

Closed MirdoxCom closed 4 years ago

MirdoxCom commented 4 years ago

Hello,

Thanks for a nice project. The demo was working perfectly.

I'm trying to compile a simple sketch with Wire library, but it fails with error: undefined reference to `Wire'.

The library seems to be compiled from correct directory:

\Local\Temp\arduino_build_137153\sketch\SHT31_nolib_BC66.ino.cpp.o: In function `setup()':
\Arduino\SHT31_nolib_BC66/SHT31_nolib_BC66.ino:31: undefined reference to `Wire'
collect2.exe: error: ld returned 1 exit status
Using library Wire at version 1.0 in folder: \Local\Arduino15\packages\WizIO\hardware\bc66\2.0.0\libraries\Wire 
exit status 1
Error compiling for board Quectel BC66 Module.

The code:

#include "Wire.h"

#define SHT31_ADDR          0x44
#define SHT31_SOFTRESET   0x30A2

uint8_t _i2caddr = SHT31_ADDR;

void setup() {
  Wire.begin();
  Wire.beginTransmission(_i2caddr);
  Wire.write(SHT31_SOFTRESET >> 8);
  Wire.write(SHT31_SOFTRESET & 0xFF);
  Wire.endTransmission();
}

void loop() {
}

The code is compiled successfully for Arduino Uno core.

Any idea what I'm doing wrong?

Thank you in advance.

Wiz-IO commented 4 years ago

Hi declare wire as https://github.com/Wiz-IO/platformio-quectel-examples/blob/master/Arduino/bc66/i2c_oled/src/main.cpp#L13

Wiz-IO commented 4 years ago

and slave address must be 8-bits ... shift left

define SHT31_ADDR 0x44<<1

MirdoxCom commented 4 years ago

Hello,

Thank you for quick response and for the examples. Now it is compiling fine.

But I still have some issues. I've connected logic analyzer and it seems there are some problems with i2c starting and end conditions in most read/writes.

I guess I need to do some experiments with pullups.

Thank you

Wiz-IO commented 4 years ago

you need level shifter for pins - max is 1.8v

MirdoxCom commented 4 years ago

You are amazing. I've added level shifter and it is working now. I should better read the datasheet. :/

You helped me a lot and I don't want to bother you, but maybe you have also solution for this.

There seems to be some problem with single/double precision. e.g. when trying to print a float or during other operations.

undefined reference to `__aeabi_ui2d'
undefined reference to `__aeabi_dmul'
undefined reference to `__aeabi_ddiv'
undefined reference to `__aeabi_dsub'
undefined reference to `__aeabi_d2f'
undefined reference to `__aeabi_ui2d'
undefined reference to `__aeabi_dmul'
undefined reference to `__aeabi_ddiv'
undefined reference to `__aeabi_d2f'

I've seen that you are not using any floats in the examples. Is there any solution for this, or should I better use integers?

Thank you

Wiz-IO commented 4 years ago

yep, I know, math library is not added... you can add here https://github.com/Wiz-IO/Arduino-Quectel-BC66/blob/master/platform.txt#L51 as -lm -lgcc or use PlatformIO port for Quectel (tested) https://github.com/Wiz-IO/platform-quectel

Wiz-IO commented 4 years ago

btw: Arduino IDE for Quectel is old project... can be used for education I migrate "all" to PlatformIO: it's better and support more...

MirdoxCom commented 4 years ago

Thank you.

I will try.