@virtualmkr That is useflul to know - thanks! - As it happens I think I had my first wdt 'kick' early this morning as the Gateway with the wdt on was showing as up for 3 hours instead of the 4 days I was expecting, so it restarted and all is still working
The mysensor-library s building some kind of own operating system It hijacks a lot of things If you want to use them, you need to know how. For example save&read from EEPROM.
Of course it is possible to handle everything.
FreeRTOS would set the system on a standard base.
Mysensor could "use" the functionality of FreeRTOS including different platforms and focus on the software for radio communication, security, etc..
But FreeRTOS is also not very easy to understand and there are some tricky things to consider. In the end is it also complicated to understand everything as soon you need to go in detail. i am pretty sure that you would have had this or other questions if mysensors would set up on FreeRTOS.
In the end a normal mysensor node just wants to send some collected data over the air and is not doing a lot of other things in parallel.
So I dont know if it would make it more easy or more complicated.
Maybe it is worse a thought if somebody starts to think about mysensor 3.0?
@karlheinz2000 sounds great that you found the bug. It's always difficult to tell if it is a HW or SW bug on MCUs. From your first description it seems like a SW one to me.
Thank you @sundberg84 !
Well the node's been working for a whole day without loosing any message, and it reports its battery so everything seems fine.
By the way, i have my first RFm69 node based on easyPCB now working (a sonar to measure fuel tank) connected to the gateway of @Gerator : works great
@virtualmkr I have your sketches a quick look. Seems like you have debug enabled on the gateway. Esp8266 has to deal with WiFi stack &mqtt handling despite running on pretty high speed. This may introduce a lot of delays.
And my wild guess would be that that is enough for m328p to chew up.
I'll set up my 'staging' gateway in a radio noisy environment and give your test a spin this weekend.
I finally got it working reading through google searches. I'd like to provide how I did it for anyone that may run into a similar issue in the future. While looking for this solution, I saw at least one person who had the exact same issue and their problem went unresolved.
Raspberry Pi 3 is connected to Arduino Mega through regular serial link. Raspberry pi uses uart pins that map to Serial0 in raspbian. On Arduino Mega I use Serial2 pins (16,17). There's a voltage divider circuit between the two that reduces 5v to 3.3 for the pi.
I compiled my gateway on pi with below:
./configure --my-transport=rs485 --my-rs485-serial-port=/dev/serial0 --my-rs485-baudrate=9600
On Arduino I have these define lines:
#define MY_DEBUG
#define MY_DEBUGDEVICE Serial
#define MY_RS485
#define MY_RS485_HWSERIAL Serial2
#define MY_NODE_ID 1
#define MY_RS485_BAUD_RATE 9600
#define MY_RS485_DE_PIN -1
I'm not an expert on this by any means, but out of everything I tried, this is what worked for me. There are still some remaining issues:
Possibly due to line noise or voltage being low on Arduino, I've had one crash that made Arduino print gibberish on serial and it stopped transmitting anything at all.
I use Home Assistant and it seems to give up on MySensors if it doesn't receive anything in a while. Requires restart of HA core. Not very reliable.
I still welcome any insight into this process and any alternatives/recommendations. I'd like to make this as reliable as possible, but my knowledge of these systems and electronics is limited.
Hello,
yes this is possible, here it is
https://www.mysensors.org/apidocs/group__RF24grp.html#gae6a732b8f49a8eb99ef65ae159c65e9c
and you may need to reinit transport layer at some point,
https://www.mysensors.org/apidocs/group__MyTransportgrp.html
https://www.mysensors.org/apidocs/index.html