Open mschlenstedt opened 1 year ago
For Arduino Uno you need to comment both
//#define HARDWARE_SERIAL_WITH_PINS
//#define HARDWARE_SERIAL
from NibeGW.h
Thanks for the quick reply. After comment both, I get this error:
In file included from C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:19:0:
C:\Users\michael\Desktop\NibeGW\NibeGw.h:90:7: error: 'Serial_' does not name a type; did you mean 'Serial'?
Serial_* RS485;
^~~~~~~
Serial
C:\Users\michael\Desktop\NibeGW\NibeGw.h:117:21: error: expected ')' before '*' token
NibeGw(Serial_* serial, int RS485DirectionPin);
^
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:27:15: error: expected constructor, destructor, or type conversion before '(' token
NibeGw::NibeGw(Serial_* serial, int RS485DirectionPin)
^
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'void NibeGw::connect()':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:57:7: error: 'RS485' was not declared in this scope
RS485->begin(9600, SERIAL_8N1);
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'void NibeGw::disconnect()':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:68:5: error: 'RS485' was not declared in this scope
RS485->end();
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'boolean NibeGw::messageStillOnProgress()':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:124:8: error: 'RS485' was not declared in this scope
if ( RS485->available() > 0)
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'void NibeGw::loop()':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:141:11: error: 'RS485' was not declared in this scope
if (RS485->available() > 0)
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:168:11: error: 'RS485' was not declared in this scope
if (RS485->available() > 0)
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'void NibeGw::sendData(const byte*, byte)':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:342:3: error: 'RS485' was not declared in this scope
RS485->write(data, len);
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'void NibeGw::sendAck()':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:357:3: error: 'RS485' was not declared in this scope
RS485->write(0x06);
^~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp: In member function 'void NibeGw::sendNak()':
C:\Users\michael\Desktop\NibeGW\NibeGw.cpp:372:3: error: 'RS485' was not declared in this scope
RS485->write(0x15);
^~~~~
In file included from C:\Users\michael\Desktop\NibeGW\NibeGW.ino:55:0:
C:\Users\michael\Desktop\NibeGW\NibeGw.h:90:7: error: 'Serial_' does not name a type; did you mean 'Serial'?
Serial_* RS485;
^~~~~~~
Serial
C:\Users\michael\Desktop\NibeGW\NibeGw.h:117:21: error: expected ')' before '*' token
NibeGw(Serial_* serial, int RS485DirectionPin);
^
C:\Users\michael\Desktop\NibeGW\NibeGW.ino:70:49: error: no matching function for call to 'NibeGw::NibeGw(HardwareSerial*, int)'
NibeGw nibegw(&RS485_PORT, RS485_DIRECTION_PIN);
^
In file included from C:\Users\michael\Desktop\NibeGW\NibeGW.ino:55:0:
C:\Users\michael\Desktop\NibeGW\NibeGw.h:75:7: note: candidate: NibeGw::NibeGw()
class NibeGw
^~~~~~
C:\Users\michael\Desktop\NibeGW\NibeGw.h:75:7: note: candidate expects 0 arguments, 2 provided
C:\Users\michael\Desktop\NibeGW\NibeGw.h:75:7: note: candidate: constexpr NibeGw::NibeGw(const NibeGw&)
C:\Users\michael\Desktop\NibeGW\NibeGw.h:75:7: note: candidate expects 1 argument, 2 provided
C:\Users\michael\Desktop\NibeGW\NibeGw.h:75:7: note: candidate: constexpr NibeGw::NibeGw(NibeGw&&)
C:\Users\michael\Desktop\NibeGW\NibeGw.h:75:7: note: candidate expects 1 argument, 2 provided
exit status 1
Compilation error: 'Serial_' does not name a type; did you mean 'Serial'?
Ok, try with following. It should at least compile.
//#define HARDWARE_SERIAL_WITH_PINS
#define HARDWARE_SERIAL
@paulianttila Many thanks - at least it compiled with these settings! Now we will see if it also works ;-) I will test today.
I think it is a good idea to include some compiling instructions for different hardware into the Readme. I will create a PullRequest for that if I succeeded.
Ok, finally it works somehow :-) It seems that I receive data from the pump, but I get an Alarm 251 at the Nibe F1245. Tx and Rx Leds flicker on the RS485 modul, remote debug on port 23 shows:
UDP packet sent succeed
Write token received from nibe
Write token received from nibe
Write token received from nibe
Read token received from nibe
Read token received from nibe
Read token received from nibe
Sending UDP packet to data out: 5C00206850C9AFFB00889C5A00A9A90A00839C5100449C5700489C10014E9CCB014D9CF10198A92F9DFFFF0000A3A91400FDA7EFFE939C0000FFFF0000919C0000FFFF00008F9C0000FFFF0000FAA90200D3AC000015
UDP packet sent succeed
Write token received from nibe
Write token received from nibe
Write token received from nibe
Read token received from nibe
Read token received from nibe
Read token received from nibe
Sending UDP packet to data out: 5C00206D0F010C2146313234352D36204520444575
UDP packet sent succeed
Sending UDP packet to data out: 5C0020EE00CE
UDP packet sent succeed
Sending UDP packet to data out: 5C0020EE00CE
UDP packet sent succeed
Write token received from nibe
Write token received from nibe
Write token received from nibe
Read token received from nibe
Read token received from nibe
Read token received from nibe
Write token received from nibe
Write token received from nibe
Write token received from nibe
Read token received from nibe
Read token received from nibe
Read token received from nibe
Sending UDP packet to data out: 5C00206850C9AFFB00889C5900A9A90A00839C5100449C5700489C10014E9CCB014D9CF10198A92F9DFFFF0000A3A91400FDA7EFFE939C0000FFFF0000919C0000FFFF00008F9C0000FFFF0000FAA90200D3AC000016
UDP packet sent succeed
Sending UDP packet to data out: 5C0020EE00CE
UDP packet sent succeed
Sending UDP packet to data out: 5C0020EE00CE
UDP packet sent succeed
Write token received from nibe
Write token received from nibe
Write token received from nibe
Read token received from nibe
Read token received from nibe
Read token received from nibe
Sending UDP packet to data out: 5C00206D0F010C2146313234352D36204520444575
UDP packet sent succeed
nc -lu 9999 on the target shows me some kind of binary data (maybe just an encoding problem...)
But the heatpump permanently shows an alarm 251 (communication problem with Modbus Unit).
Any hints are highly appreciated ;-)
Receiving data seems to work, but most probably sending doesn't. If heat pump doesn't receive acknowledges sent by the nibegw it will raise an alarm.
Arduino uno have only one serial port, which is shared with usb, so you shouldn't open usb connection (e.g. serial monitor in Arduino ide) to the Arduino while it's running as it will influence to the serial port communication. You should also disable serial port debugging for the same reason.
//#define ENABLE_SERIAL_DEBUG
Maybe you TX pin is wrongly connected? Nibegw software also change transfer or reception mode of the rs485 chip accordingly. Max1348 based rs485 boards don't have that direction pin as it handle that automatically, so I guess that should work, but just for your information as it could cause some issues as well.
Protocol is binary based, so you should pipe you netcat output to e.g. to hexdump to see the data.
nc -lu 9999 | hexdump -C
Thanks a lot - disabling serial debugging did the trick! Heating pump is now fine without any alarms and I receive data from the heat pump constantly.
Next problem: My test Raspberry which should receive the UDP messages stops receiving UDP packages after some time. These are the last lines I received:
0003c7e0 ff 00 00 8f 9c 00 00 ff ff 00 00 fa a9 02 00 d3 |................|
0003c7f0 ac 00 00 97 5c 00 20 6d 0f 01 0c 21 46 31 32 34 |....\. m...!F124|
0003c800 35 2d 36 20 45 20 44 45 75 5c 00 20 68 50 c9 af |5-6 E DEu\. hP..|
0003c810 00 00 88 9c 5a 00 a9 a9 0a 00 83 9c 51 00 44 9c |....Z.......Q.D.|
0003c820 47 00 48 9c 43 01 4e 9c ba 01 4d 9c e4 01 98 a9 |G.H.C.N...M.....|
0003c830 32 9d ff ff 00 00 a3 a9 14 00 fd a7 55 00 93 9c |2...........U...|
0003c840 00 00 ff ff 00 00 91 9c 00 00 ff ff 00 00 8f 9c |................|
0003c850 00 00 ff ff 00 00 fa a9 02 00 d3 ac 00 00 90 5c |...............\|
0003c860 00 20 68 50 c9 af 00 00 88 9c 5a 00 a9 a9 0a 00 |. hP......Z.....|
0003c870 83 9c 51 00 44 9c 47 00 48 9c 43 01 4e 9c ba 01 |..Q.D.G.H.C.N...|
0003c880 4d 9c e4 01 98 a9 32 9d ff ff 00 00 a3 a9 14 00 |M.....2.........|
0003c890 fd a7 55 00 93 9c 00 00 ff ff 00 00 91 9c 00 00 |..U.............|
0003c8a0 ff ff 00 00 8f 9c 00 00 ff ff 00 00 fa a9 02 00 |................|
Also restarting "nc -lu 9999 | hexdump -C" does not help. Same after rebooting the Raspberry. No UDP packages are received anymore, while NibeGW seems to still send according to the debugging messages:
Sending UDP packet to data out: 5C00206850C9AF0000889C5800A9A90A00839C5100449C4200489C0A014E9CB7014D9CE20198A9329DFFFF0000A3A91400FDA736FE939C0000FFFF0000919C0000FFFF00008F9C0000FFFF0000FAA90200D3AC000048
UDP packet sent succeed
Write token received from nibe
Read token received from nibe
Write token received from nibe
Read token received from nibe
Sending UDP packet to data out: 5C00206850C9AF0000889C5900A9A90A00839C5100449C4200489C0B014E9CB7014D9CE20198A9329DFFFF0000A3A91400FDA736FE939C0000FFFF0000919C0000FFFF00008F9C0000FFFF0000FAA90200D3AC000048
UDP packet sent succeed
Write token received from nibe
Read token received from nibe
Write token received from nibe
Is this a problem with the Ethernet shield (maybe some buffers are full or something else)? Because the problem still exists after rebooting the target Raspberry, I assume the problem is on the Arduino side.
Sorry for bothering you again and again with new problems... ;-)
Well, don't know what happend but this morning I again receive UDP messages from the NibeGW - without doing anything this night ;-)
I will have a look during the day what happend.
Thanks @paulianttila for all your help! The NibeGW is now running for two days without problems :-)
I have two more things (maybe bugs):
The debug output is missing the target_ip (including linefeed):
MASK=255.255.255.0
GATEWAY=192.168.003.1
ETH_INIT_DELAY=5
TARGET_IP=TARGET_PORT=9999
INCOMING_PORT_READCMDS=9999
INCOMING_PORT_WRITECMDS=10000
SEND_ACK=true
ACK_MODBUS40=true
ACK_SMS40=false
ACK_RMU40=false
VERBOSE_LEVEL=5
REMOTE_DEBUG_ENABLED=true
DYNAMIC_CONFIG_ENABLED=false
I defined it as "192.168.003.028". I think this comes somewhere from here, but my C is not good enough to find the error: https://github.com/openhab/openhab-addons/blob/ae677dcd9d07bc265cf3b4d3083be9c0863f76be/bundles/org.openhab.binding.nibeheatpump/contrib/NibeGW/Arduino/NibeGW/NibeGW.ino#L389
Second issue I have is, that activating "#define ENABLE_NIBE_DEBUG" in NibeGW.h results in an compiling error:
C:\Users\michael\Desktop\NibeGW\NibeGW.ino: In function 'void setupStaticConfigMode()':
C:\Users\michael\Desktop\NibeGW\NibeGW.ino:149:41: error: 'struct Config::<unnamed>' has no member named 'level'
nibegw.setVerboseLevel(config.debug.level);
^~~~~
exit status 1
Compilation error: 'struct Config::<unnamed>' has no member named 'level'
Did you manage to get the last two parts fixed?
I have an old Arduino Uno (not R3) with Ethernet W5100 Shield and a RS485 Adapter with Max1348 chip (GND, RXD, TXD, 5V). I use Arduino IDE 2.0.2 (but also tested legacy version 1.8.19).
So I commented out all special hardware in Config.h:
In NibeGW.h I activated HARDWARE_SERIAL_WITH_PINS:
When I compile the code, I get this error:
Just as a "trial and error", I included the HardwareSerial_485 Library in NibeGw.h:
After that, I get this error:
Can anyone help?