Support CAN transceiver benefits
I'm planning to build my first MySensors projects and I want to use CAN transceivers instead of RS485 drivers. They seem interesting to me as they offer some advantages (e.g. the lack of a DE pin, avoidance of DE stuck). Supporting another advantage would require some modification in the library and I wanted to share my thoughts and hear your opinions about that.
CAN controllers compare each bit they send with the response they receive on the bus. If transmission and reception don't match they immediately stop sending and assume that another node is also trying to send at the same time. Of course, it is not possible to achieve this functionality on bit level using a UART interface, but in my opinion it should be possible to achieve it on byte level, at least.
If the library compares every byte it just sent with the byte it received at the same time it should be possible to get some level of collision detection and therefore to reduce the number of collisions. One requirement would be to send a unique byte first, but afaik MySensors already does that by sending the last ID and the sender ID at the beginning. If sent and received IDs match the bus was free and transmission can continue. If the IDs don't match the bus is busy and sending must be stopped and delayed. The lower the ID the higher the priority.
It would be great if MySensors could implement that functionality using some symbols to enable and disable it. What do you think?
Welcome to the forum @pikim
https://github.com/mysensors/MySensors/pull/1488 was submitted earlier this year but has unfortunately not gotten any feedback.
Thanks for the link, but that is not what I meant. He's using a CAN controller - I only want to use a CAN transceiver. I think I'll just try to modify the library accordingly and perform some experiments. Is there some RX ISR that is being called when receiving a byte? I've never used any Arduino stuff, but always wrote my programs in plain C from scratch. So I have no idea where to search for it.
rejoe2 last edited by
Might be wrong, but that kind of check seems to be what's called SOH. Most likely jumping in the code in https://github.com/mysensors/MySensors/blob/development/hal/transport/RS485/MyTransportRS485.cpp#L129 may be a good starting point.
OK, thanks. I'll have a look at it.