thelsing / knx Goto Github PK
View Code? Open in Web Editor NEWknx stack (TP, IP and RF) for arduino and linux, Can be configured with ETS
License: GNU General Public License v3.0
knx stack (TP, IP and RF) for arduino and linux, Can be configured with ETS
License: GNU General Public License v3.0
Hi,
the internal sensor correction value (value * 0.1 K) is not present as communication Object in the KNXPROD File. I try KNXPROD from KNX-DEMO - IP. I Try to fix but did not work :-)
Br,
RObert
What SAMD21 dev board are you using for development?
KNX Data Secure is important for open media like RF or PL.
KNX Data Secure basically adds additional APCI type which signals secure data packets.
The secure data packets then contain the normal application layer packets (nested) with their well-known APCI types. The existing application layer can be reused.
See figure.
The Calimero project also added support for KNX data secure recently.
Latest KNX spec. (AN192?, not publicy available yet) also contains the specification of the so called "security proxy" which is supposed to be part of the KNX TP/RF coupler.
Is allows to translate between unsecure older existing devices and KNX-RF secure devices.
Example encryption steps: here
The proxy adds and removes the outer secure frame of the normal application layer payload.
Currently for group objects with dpt 5.001 following happens:
go.value(33) != go.value() (which returns 32)
Solution is to add a round() in line 421:
value = (uint8_t)round(unsigned8FromPayload(payload, 0) * 100.0 / 255.0);
I would assume the same problem for dpt 5.003 (see line 425), but I haven't tested it.
I am currently not able to create a pull request, but wanted to ensure, that this "oneliner" doesn't get lost.
Regards,
Waldemar
Would it be possible to add support for Bit interface (STKNX) transceiver and STM32G071 or any STM32 configured with CubeMX?
Hi!
I have just the the new tpuart data link layer in the samd branch.
Is the TPUART2 that is used in some Siemens BCUs compatible?
From here I guess that they seem to be very similar:
https://github.com/knxd/knxd/blob/master/src/backend/ncn5120.cpp
https://github.com/knxd/knxd/blob/master/src/backend/ncn5120.h
Hi
I just saw STM32 has been added. and since Ive implemented one for myself and encountered this issue Ive got to mention it here too. Ive used STM32duino Arduino core and I guess this code is based on that core too.
In these lines:
Lines 38 to 39 in 4677044
so it means for every byte we change we perform a complete sector erase-write. and beside the fact that is wastes time, considering we got only 10k write cycle on stm32 flash, its gonna stop working very soon i guess.
Im not sure how it can be fixed, since its a bad design on side of STM32duino.
Ive implemented my own flash write/read based on codes in stm32_eeprom for my device, but its not really portable and its duplication.
Hi
I've got a strange problem with my device. When ETS is looking for device address (when downloading address or in diagnostics's programming mode; if theres another KNX device on TP bus together with my device, theres no problem. But if theres only my device on TP Bus, ETS detects 2 device and fails (on downloading) saying theres more than one device in programming mode, and in Diagnostics also shows two device (*2) with same address.
This is log from Group Monitor for one request:
<CommunicationLog xmlns="http://knx.org/xml/telegrams/01">
<Telegram Timestamp="2020-08-26T13:33:10.6411059Z" Service="L_Data.con" FrameFormat="CommonEmi" RawData="2E00B0E000010000010100" />
<Telegram Timestamp="2020-08-26T13:33:10.6893658Z" Service="L_Data.ind" FrameFormat="CommonEmi" RawData="2900B0D011020000010140" />
<Telegram Timestamp="2020-08-26T13:33:10.7272676Z" Service="L_Data.ind" FrameFormat="CommonEmi" RawData="2900B0D011020000010140" />
<Telegram Timestamp="2020-08-26T13:33:10.7811246Z" Service="L_Data.ind" FrameFormat="CommonEmi" RawData="2900B0D011020000010140" />
</CommunicationLog>
As you see each request receives 3 response...
This is debug output of my device (per request):
dataBroadcastIndication
dataBroadcastRequest
dataBroadcastIndication
dataBroadcastRequest
dataBroadcastConfirm
dataBroadcastIndication
dataBroadcastRequest
dataBroadcastConfirm
dataBroadcastIndication
dataBroadcastRequest
expected L_DATA_CON not received
dataBroadcastConfirm
got U_CONFIGURE_IND: 0x11
got UNEXPECTED: 0x2
got L_ACKN_IND
got L_ACKN_IND
got UNEXPECTED: 0xE1
got U_CONFIGURE_IND: 0x1
got L_ACKN_IND
got UNEXPECTED: 0xDC
got U_STATE_IND: 0x17
got unexpected L_DATA_CON
any idea whats going on here??
Thanks
Hi,
Ive tried to implement a module with ~15 channel and lots of parameters.
now it seems i cant find parameter values. what i get from knx.paramByte() function has nothing to whats i set using ETS software.
Ive 13 Group Objects right now, last ones number is 121. and around 50 parameters. and since this library seems to use only 512 byte for storage, i guss its too much?
Does implementing too many Group Objects cause this problem? Is there anyway i can expand the storage?
Thanks
I have a working knx Stack. Using a STM21.
Everything is working fine, except:
Any hints what is wrong here?
During ETS configuration knx.configured() returns true even before restart of mc finished configuration procedure.
LOG_Adress&App_10ms.txt
LOG_Adress&App.txt
Hello,
my Setup:
IDE: Platform IO Core 5.0.1 Home 3.3.0
MCU: SAMD21 developement Board (Arduino Zero clone without debug circuit, wemo samd21)
Interface: MicroBCU (OnSemi 5120)
SW: ETS 5.7.2
KNX interface: knxd on BBB (ingBudde shield)
Additional Equipment:
Several Isolated Serial to USB-Sticks
Oscilloscope
J-link debugger
Version from GIT: TAG: 1.2.0 Application knx-Demo
Issue: Programming physical Address working normal, but during programming Application severel errors are shown in serial console.
got unexpected L_DATA_CON<\r><\n> got U_STATE_IND: 0x17<\r><\n> got U_STATE_IND: 0x17<\r><\n> got U_STATE_IND: 0x17<\r><\n> got U_STATE_IND: 0x17<\r><\n> got U_STATE_IND: 0x17<\r><\n> L_DATA_CON not received within expected time<\r><\n> ...
My current status of investigation:
HW:
Pinning fits.
Signals RX/TX checked. Levels Ok, rise time Very fast, timing perfect to 19,2kHz.
Voltage supply. No Votage drops on SAMD21 or NCN5120 side.
SW:
Tried several "Board" Options (adafruit_feather_m0 [here my debug serial is not working],sparkfun_samd21_dev_usb,zeroUSB)
Update to the latest "MASTER" leads to not getting PA programmed, on ESP32 Board-> cyclic resets. -> Back to 1.2.0
removed comments inside ReadUART
Logged this data
Additional I logged this data with newline every 10ms to get an idea what is sent within which time. Please find attached these files
Do you have an idea where to look?
Please help me.
Currently there are some methods for getting and setting data of a GroupObject. It would be better to create a subclass for each different datapoint with the correct conversion. Code for conversion can be found here https://github.com/knxd/knxd/blob/dpt-de/encode/src/client/c/dptconvert.c
I've noticed that PIO still shows version 1.0.0 as the current one. I think it's because library.properties file was not updated to reflect the 1.1.0 version.
Would you be so kind to update this file?
I have set up a Zero (SAMD21) with Siemens BCU for testing and using the latest version of the library. When running the KNX Demo sketch, the programming of PA works.
When programming the Application Program, the process does not finish. See monitor log attached. Where shall I debug to find the cause?
ETS Monitor log.txt
Note: some unrelated messages are deleted.
Hi,
First of all it seems to be really something incredible!!
I load my first custom sensor with the bme680 code on my esp8266 and add the knxprod to my ETS.
Now I would try to configure it by the ets but how can i do it?
Currently the additional information necessary for RF are injected into the cemiframe at the rf-DataLinkLayer. This should be refactored. CemiFrames should be created with a method of the Bau (not with new) In this way the bau an inject the information at the creation of the cemiframe.
hello, I used the example to compile, but the generated bin file is too large to download on stm32f103c8t6. How to turn off some unnecessary functions and make the generated file smaller? Here are the compilation parameters and results:
build_flags =
-DNCN5120
-DMASK_VERSION=0x07B0
-Wno-unknown-pragmas
RAM: [= ] 5.8% (used 3812 bytes from 65536 bytes)
Flash: [== ] 18.0% (used 94364 bytes from 524288 bytes)
Compiling knx-demo for ESP8266 platform breaks with latest ESP8266 platform core:
https://travis-ci.org/github/thelsing/knx/jobs/724208015#L984
I do not know how to fix this as I am not familiar with the ESP8266 and dev ecosystem.
@thelsing Could you please have a look?
Using a fixed old version does not seem to be an option as other libs require a recent ESP8266 platform core.
there's a repetition mechanism, make my device receiving 4 repeated packets for each knx command. is there any support to send an ack to the bus. I have dig into the source code and found that it supports to set wait_ack or not wait_ack. I'm using tpuart now.
Thanks.
While testing the coupler routing I got "invalid frame" messages in the console.
Inspecting this code:
Line 369 in 52d3866
If I remove the "+1" then everything works as expected. Why do we have the "+1" there?
There seems to be an issue with the readoninit flag during programming the device. See https://knx-user-forum.de/forum/%C3%B6ffentlicher-bereich/knx-eib-forum/diy-do-it-yourself/1216828-esp8266-knx-mit-ets?p=1431367#post1431367 (in german)
I run the default sample program, but when using ETS configuration parameters, three parameters can not be configured correctly and keep the same value. Where is the problem?
Timeout: 0
Zykl. senden: 12
Abgleich: 0
These two can be configured correctly:
Min/Max senden: 2
Aenderung senden: 1
Serial.print("Timeout: ");
Serial.println(knx.paramByte(0));
Serial.print("Zykl. senden: ");
Serial.println(knx.paramByte(1));
Serial.print("Min/Max senden: ");
Serial.println(knx.paramByte(2));
Serial.print("Aenderung senden: ");
Serial.println(knx.paramByte(3));
Serial.print("Abgleich: ");
Serial.println(knx.paramByte(4));
LOG:
SAVED 00 FA 00 00 00 00 00 00 00 03 11 06 00 01 04 00 01 60 00 01 00 00 00 00 00 00 01 00 00 00 34�readMemory
RESTORED 00 FA 00 00 00 00 00 00 00 03 11 06 00 01 04 00 01 60 00 01 00 00 00 00 00 00 01 00 00 00 34 00 08 01 00 00 00 48 00 04 01 00 00 00 4C 00 04 01 00 00 00
manufacturerId, version and hardwareType matches
saverestores 2
-10
.
-26
.
restored saveRestores
tableObjs 4
-26
.
-33
.
-40
.
-4
7
.
restored Tableobjects
Timeout: 0
Zykl. senden: 12
Min/Max senden: 2
Aenderung senden: 1
Abgleich: 0
ownaddr 1106
According to ./doc/knx_rf_notes.md I assume it should be possible to build a KNX-RF device using a SAMD21 board but I can't find any rule or example project for this.
Could you add some HOWTO notes for dummies like me? (preferably for linux host system)
Thx
Hi
I've got a problem with using dimming control (3.7) datapoint. its a 4bit value.
But in function 'valueToBusValueStepControl' here:
Lines 973 to 992 in ffa2eea
Line 978 in ffa2eea
btw 1: Same goes for 'busValueToStepControl' & 'busValueToBinaryControl' & 'valueToBusValueBinaryControl'
btw 2: whats index 1? i couldn't find anything in documents(chapter 3.7.2, section 3.3). Should I look somewhere else?
Hi!
While implementing the new cEMI server feature I have analyzed the read/write access of properties.
When using Net'n'node I found out that it does the following:
cEMI USB RX len: 7 data: data: FC 00 08 01 34 10 01
M_PropRead_req
ObjectType: 0x0008
ObjectInstance: 0x01
PropertyId: 0x34 (52) -> PID_COMM_MODE (PDT_ENUM8)
NumberOfElements: 16
StartIndex: 1
However, the property is only PDT_ENUM8, so a single byte.
The client (Net'n'Node) requested 16 elements (is this a bug?).
So a valid response would now contain NumberOfElements=1, StartIndex=1 and a single data byte with the comm mode.
(See KNX spec. 3/6/3 p.100: M_PropRead.con message, positive response)
I do not see this kind of implementation anywhere in an interface object implementation.
Am I overlooking something or did I find an issue here?
Current implementation always sends back the NumberOfElements received in the request, but not the actual available MaxNoOfElements.
Also whenever an external client (A_PropRead) wants to read the property value length, the code won't work as the current code would handle a startIndex=0 to read the length entry (first array entry) of the property value.
See KNX spec. 3/4/1 p.15 that a property value of a full interface object (what you have implemented) shall be always(!) an array. First entry is the length, followed by the data.
When more than one KNX-RF device is active, nodes where knx.progMode() is off are unexpectedly programmed as well when programming the physical address of a new node.
So it seems the state of knx.progMode() has no effect.
Shouldn't prgMode() checked in following methods of bau27B0.cpp:
void Bau27B0::domainAddressSerialNumberWriteIndication()
void Bau27B0::individualAddressSerialNumberWriteIndication()
(Btw: to handle progMode without a button I tried activating knx.ProgMode(true) in the setup() of *.ino and disable it again in the *.ino loop() after knx.configured() && at least 1 Min passed since reset)
I tried to build the knx-demo project with platform.io.
i changed the platform.ini to:
`[platformio]
; We have to keep libdeps dir out the project directory otherwise,
; library scanner seems to have issues so compilation fails
libdeps_dir = /tmp/libdeps
src_dir = .
;--- SAMD --------------------------------------------------
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
lib_deps =
knx
build_flags =
-DMEDIUM_TYPE=2
-Wno-unknown-pragmas
;-----------------------------------------------------------`
Build failed with the following error:
'
Building in release mode
Compiling .pio\build\nanoatmega328\src\knx-demo.ino.cpp.o
Archiving .pio\build\nanoatmega328\libd3b\libEEPROM.a
Compiling .pio\build\nanoatmega328\lib16b\SPI\SPI.cpp.o
Compiling .pio\build\nanoatmega328\lib295\knxraumcontroller\arduino_platform.cpp.o
Compiling .pio\build\nanoatmega328\lib295\knxraumcontroller\esp32_platform.cpp.o
Compiling .pio\build\nanoatmega328\lib295\knxraumcontroller\esp_platform.cpp.o
Compiling .pio\build\nanoatmega328\lib295\knxraumcontroller\knx\address_table_object.cpp.o
In file included from C:\repo\knxraumcontroller\src/knx_facade.h:3:0,
from C:\repo\knxraumcontroller\src/knx.h:86,
from C:/repo/knxraumcontroller/examples/knx-demo/knx-demo.ino:1:
C:\repo\knxraumcontroller\src/knx/bits.h:3:19: fatal error: cstddef: No such file or directory
compilation terminated.
Compiling .pio\build\nanoatmega328\lib295\knxraumcontroller\knx\aes.c.o
Compiling .pio\build\nanoatmega328\lib295\knxraumcontroller\knx\apdu.cpp.o
*** [.pio\build\nanoatmega328\src\knx-demo.ino.cpp.o] Error 1
In file included from C:\repo\knxraumcontroller\src\arduino_platform.cpp:2:0:
C:\repo\knxraumcontroller\src/knx/bits.h:3:19: fatal error: cstddef: No such file or directory
compilation terminated.
C:\repo\knxraumcontroller\src\knx\address_table_object.cpp:1:19: fatal error: cstring: No such file or directory
compilation terminated.
In file included from C:\repo\knxraumcontroller\src\knx\apdu.cpp:3:0:
C:\repo\knxraumcontroller\src\knx\bits.h:3:19: fatal error: cstddef: No such file or directory
compilation terminated.
*** [.pio\build\nanoatmega328\lib295\knxraumcontroller\knx\address_table_object.cpp.o] Error 1
*** [.pio\build\nanoatmega328\lib295\knxraumcontroller\arduino_platform.cpp.o] Error 1
*** [.pio\build\nanoatmega328\lib295\knxraumcontroller\knx\apdu.cpp.o] Error 1
========================================================================================= [FAILED] Took 4.71 seconds =========================================================================================
The terminal process "C:\Users\henrik.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.
'
Wrong variable is used here:
Line 284 in 96884f7
Instead of propertyCount
it should be propertiesSize
.
propertyCount
is the array index, but we have to add propertyCount * sizeof(Property*)
which is propertiesSize
.
Hi!
I think it would be better to move the platform specific stuff to separate folders.
What do you think?
However, I am happy that you have removed the submodule stuff. 👍
Function properties are required for data secure and also KNX-RF.
Hi!
I have found this in the code while implementing the addtional application layer services for KNX RF (S-Mode):
Line 15 in 3063bf8
Unfortunately, this does not work for those additional services,
Please have a look at KNX spec. 3.3.7 (Application Layer) p.9-10.
IMHO, it is not possible to decide from the APCI bits alone, if it is of 4 bit size or 10 bit size.
Instead the length field has to be taken into account for this distinction.
If it is equal to 0, no APCI is present (only the case for control packets [transport layer] and not data packets).
If it is equal to 1, APCI size is 4 bits.
If it is greater than or equal to 2, APCI is 10 bits.
See also:
https://support.knx.org/hc/en-us/articles/115003188529-Payload
individual is spelled "induvidual" at several places in the code. Is it a typo?
I found that ARDUINO_ARCH_SAMD
does not imply HAS_FUNCTIONAL
in group_object.h
even though SAMD supports this c++11 template. I believe support for SAMD should be added here unless there is a specific reason not to.
Why would one need this?
This is quite useful when using callbacks on group objects. When modelling a device as a class, the callback is typically a non-static member function that cannot be passed as a regular function pointer.
An elegant solution is to combined std::bind with std::function to register a member function of a specific class object.
Implications
The change is simple but including STL headers conflicts with the definition of max
and min
macros in the arduino framework for SAMD. This should be fixed in arduino/ArduinoCore-samd#399 but not released.
Per interim, a hacky
#undef max
#undef min
is required before including STL headers.
Opinions?
I want to unifiy the different datalink-layers. Each Flavor should only do the following:
The whole echo handling etc should be handled by common code shared between all data-link-layers.
Hi,
My question should be stupid, but I'm unable to make pairing in ETS. (even when changing knx.buttonPin() value)
I have an GY-SAMD21 (a clone from the sparkfun mini) connected to a siemens 5WG1117-2AB12 on the tx,rx line (even crossed the rx/tx line without any luck). I have an old config with that 5WG1117-2AB12 and a arduino micro pro that work well but is not configurable... anyway...
And when i see demo/example code everything have IP connectivity, nothing with TP, where can I change the pin for TX,RX, or view the default value, nothing in knx_facade.h?
So much critics, but your software createKnxProd and that knx stack look a perfect combo for an clean ETS integration, for DIY knx device 👍
Regards
Currently, application layer services like A_SystemNetworkParameterRead are only reachable via SystemBroadcast.
However, on closed media there is no additional SystemBroadcast, instead only normal Broadcast mode is used.
(note: a coupler between closed and open media has to properly handle this situation by changing the mode accordingly -> change the SBC flag)
See Application Layer PDF p.30.
Basically the content of this method must also be evaluated on closed media even if it is on broadcast only.
As already mentioned here it would be nice to support the CC1310 as new platform in the stack.
@mjm987
You stated here that you have started to work on this. As I have also started to work in this it would be nice to join efforts.
Still my current status is that I only have a modified simple EasyLink example to receive KNX-RF frames.
What do have already? Are you able to do TX yet?
As a kind of pre-work I have added platformio support for the CC1310: https://github.com/nanosonde/platform-ticc13x0
So I can compile the stack with Energia (a.k.a. Arduino) core.
This would enable IP/TP coupler support on Linux platform like Raspberry Pi if a KNX TP1 transceiver (e.g. TPUART2) is connected via UART.
Hi
I've got a project that was on this commit
52d3866
I pulled yesterday and updated my knx stack. since then my device is not responding to requests!
or if i have to be more specific, ETS cant find module (PhysAddrRead receives no answer).
But in debug serial I get this:
dataBroadcastIndication
dataBroadcastRequest
dataBroadcastConfirm
so it seems device is receiving and answering the request (? not sure).
btw. Im using STM32 and ncn5130.
and, if i rollback to the commit Ive mentioned above, everyting works fine. Ive tested this with a new fresh project and one of samples and it had the same problem too.
btw2. it seems new version's configs is not compatible with last one so I've got to erase config and cant test a configured device.
Just to be able to use the binary as an ip-tp router on rasberry pi without tpuart.
Currently the stack supports a CC1101 transceiver connected via SPI to the host MCU/CPU.
I would like to collect some ideas for other RF solutions.
Hint: If a transceiver or "wireless" MCU claims to support Wireless-M-Bus (wM-Bus) S-Mode then it can at least support KNX-RF ready. wM-Bus and KNX-RF1R share the same physical parameters and also use the same datalink layer format.
IP/TP1 coupler: 091A - coupler model 1.x
TP1/RF coupler: 2920 - coupler model 2.0
TP1/TP1 coupler: 0912 - coupler model 1.x
Device BAUs: bau07b0, bau27b0, bau57b0 <- bau_systemB_device <- bau_systemB <- bau
Coupler BAUs: bau091a, bau2920, bau0912 <- bau_systemB_coupler <- bau_systemB <-bau
Enable support for retransmitting received KNX-RF frames. This can be used to extend the range of KNX-RF.
See
knx/src/knx/rf_data_link_layer.cpp
Line 214 in cc1fc7d
1) History List
We have to store the KNX serial number and the last received LFN (frame number) of this device in a list:
Then discard a received frame if its KNX serial number and LFN pair is already in the list.
2) Repetition Counter
Implement pseudo code:
if rf_repetition_counter(rec_Frame) > 0 and
rf_repetition_counter(rec_Frame) > rf_repetition_counter_limit(Repeater)
rf_repetetion_counter(rec_Frame)—
else
discard(rec_Frame)
endif
rf_repetition_counter_limit should be read from PID_RF_REPEAT_COUNTER (PID = 74) in the Device Object (object_type = 0).
Additional remarks:
Open questions:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.