telekom / LibNbiot

Non-blocking MQTT-SN Library for NB-IoT
Apache License 2.0
20 stars 6 forks source link

Error with arduino mega 2560 #1

Open reece762 opened 6 years ago

reece762 commented 6 years ago

HI, thank for your libraries, it is what i need to find, but here are some error, first, I can change include to this to soft libraries not foucd image

I try to fix not found problem like this image

All this solve, it have more error, can you help me? error log:

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Archiving built core (caching) in: C:\Users\LIKONG~1\AppData\Local\Temp\arduino_cache_244122\core\core_arduino_avr_mega_cpu_atmega2560_0c812875ac70eb4a9b385d8fb077f54c.a C:\Users\LIKONG~1\AppData\Local\Temp\ccHVqBnB.ltrans0.ltrans.o: In function `subscriptionHandler(MessageData*)':

ccHVqBnB.ltrans0.o:(.text+0x3e0): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text+0x3f8): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text+0x404): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text+0x41c): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text+0x428): undefined reference to `debugPrintf'

C:\Users\LIKONG~1\AppData\Local\Temp\ccHVqBnB.ltrans0.ltrans.o:ccHVqBnB.ltrans0.o:(.text+0x43c): more undefined references to `debugPrintf' follow

C:\Users\LIKONG~1\AppData\Local\Temp\ccHVqBnB.ltrans0.ltrans.o: In function `main':

ccHVqBnB.ltrans0.o:(.text.startup+0x19e): undefined reference to `setDebugWriteFunction'

ccHVqBnB.ltrans0.o:(.text.startup+0x2c0): undefined reference to `Timer1'

ccHVqBnB.ltrans0.o:(.text.startup+0x2c2): undefined reference to `Timer1'

ccHVqBnB.ltrans0.o:(.text.startup+0x2c4): undefined reference to `TimerOne::initialize(long)'

ccHVqBnB.ltrans0.o:(.text.startup+0x2ce): undefined reference to `tick'

ccHVqBnB.ltrans0.o:(.text.startup+0x2d0): undefined reference to `tick'

ccHVqBnB.ltrans0.o:(.text.startup+0x2d2): undefined reference to `Timer1'

ccHVqBnB.ltrans0.o:(.text.startup+0x2d4): undefined reference to `Timer1'

ccHVqBnB.ltrans0.o:(.text.startup+0x2d6): undefined reference to `TimerOne::attachInterrupt(void (*)(), long)'

ccHVqBnB.ltrans0.o:(.text.startup+0x336): undefined reference to `nbiotCoreConfig'

ccHVqBnB.ltrans0.o:(.text.startup+0x378): undefined reference to `nbiotConfig'

ccHVqBnB.ltrans0.o:(.text.startup+0x390): undefined reference to `nbiotStart'

ccHVqBnB.ltrans0.o:(.text.startup+0x3a2): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text.startup+0x3bc): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text.startup+0x3c8): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text.startup+0x3fe): undefined reference to `isNbiotConnected'

ccHVqBnB.ltrans0.o:(.text.startup+0x41c): undefined reference to `isNbiotSubscribedTo'

ccHVqBnB.ltrans0.o:(.text.startup+0x42c): undefined reference to `nbiotSubscribe'

ccHVqBnB.ltrans0.o:(.text.startup+0x448): undefined reference to `nbiotPublish'

ccHVqBnB.ltrans0.o:(.text.startup+0x4a0): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text.startup+0x4ac): undefined reference to `debugPrintf'

ccHVqBnB.ltrans0.o:(.text.startup+0x4cc): undefined reference to `nbiotPublish'

ccHVqBnB.ltrans0.o:(.text.startup+0x4e4): undefined reference to `nbiotConnect'

ccHVqBnB.ltrans0.o:(.text.startup+0x4ec): undefined reference to `nbiotEventLoop'

collect2.exe: error: ld returned 1 exit status

exit status 1 Error compiling for board Arduino/Genuino Mega or Mega 2560. Invalid library found in C:\Program Files (x86)\Arduino\libraries\LibNbiot-master: C:\Program Files (x86)\Arduino\libraries\LibNbiot-master Invalid library found in C:\Users\likonglam\Documents\Arduino\libraries\LibNbiot-master: C:\Users\likonglam\Documents\Arduino\libraries\LibNbiot-master Invalid library found in C:\Program Files (x86)\Arduino\libraries\LibNbiot-master: C:\Program Files (x86)\Arduino\libraries\LibNbiot-master Invalid library found in C:\Users\likonglam\Documents\Arduino\libraries\LibNbiot-master: C:\Users\likonglam\Documents\Arduino\libraries\LibNbiot-master

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

per1234 commented 6 years ago

You only need to follow the instructions for use with Arduino: https://github.com/telekom/LibNbiot/tree/master/examples/arduino

reece762 commented 6 years ago

Thank you so much it work successful.

Can I ask a question about the setting? As i know this part of arduino code is use to setup the network, right? I change this 4, but it show error, am I missing something?

core_conf.tickFrequency core_conf.apn conf.gateway conf.port

image

if(1 == ret) { NbiotCoreConf core_conf; core_conf.tickFrequency = 900; <<B8(900) core_conf.readstatus_fu = readStatus; core_conf.readbyte_fu = readByte; core_conf.putchar_fu = writeByte; core_conf.writestatus_fu = writeStatus; core_conf.apn = "apn name"; <<(our apn) core_conf.apnUser = ""; core_conf.apnPwd = ""; core_conf.operMccMnc = "26201"; core_conf.imsi = imsi; core_conf.imsiPwd = pw;

    unsigned int retCoreConf = nbiotCoreConfig(&core_conf);

    NbiotConf conf;
    conf.keepAliveInterval = 10000;
    conf.autoPollInterval = 3000;
    conf.maxTopicCount = 10;
    conf.gateway = "IP";                                                           <<mqtt-sn ip
    conf.port = 1884;                                                                <<port
    conf.notify_fu = notificationHandler;
    conf.pollInterval = 1000;
reece762 commented 6 years ago

The mqtt-sn is setting of no key/password connect

It show connect error, I think it must be setting problem. enum ErrorNumber { Success = 0, InitializeError, GprsNotConnected, IpNotConnected, ConnectionError, NotStartedError, MaxTopicsExceeded, LoopCtrlBusyError, InvalidTopicID };

yassine-amraue commented 6 years ago

Hello reonsee,

Please try to explain the problem in more detail.

Actually the Notification you get with "ErrorNumber: 5" is not an actual error in this case. ErrorNumber: 5 means "NotStartedError" and is not critical. From the looks of it everything seems fine and your program should work properly.

If you still have problems please try to enable more debug outputs in the file nbiotdebug.h and post your outputs here, so that we can try to figure it out.

Kind regards,

Yassine