RS 485 very slow baud rates (100baud over half-duplex powerline) timing issues



  • I am trying to see if I can use the KQ-330 Powerline serial modems for Mysensors.
    The modems have a 9600 8N1 TTL UART and the Powerline data rate is very much slower at 100 Baud.

    I am using mysensors RS485 and Arduino Uno's for both node and serial gateway to Home Assistant.

    So far I have managed to get the node and gateway talking however I think that because the powerline data rate is super slow compared with the 112500 Baud Home Assistant-to-Serial Gateway, and the 9600 Baud serial gateway-to-KQ330.
    I am seeing issues with collisions and TRX turn around timing during presentation and registration.

    As the link is so slow, I may actually just opt to use a master/slave approach with passive nodes in the end, for example a typical node-gateway heartbeat message takes about 4 seconds!

    I am looking at the possibility of using Aloha on the bus however as I really don't want to throw out presentation as it really helps with setting up on Home Assistant.

    So I am digging around the various transport timers and wondering how I can optimise it better for the super slow 100 baud link speed.

    My first question here is regarding the collision control in mytransportrs485.cpp; line 256

    while (_serialProcess()) {
    		unsigned char del;
    		del = rand() % 20;
    		for (i = 0; i < del; i++) {
    			delay(1);
    			_serialProcess();
    		}
    		timeout--;
    		if (timeout == 0) {
    			// Failed to transmit!!!
    			return false;
    		}
    	}
    

    Im I correct to say that the 1ms delay is based on 9600 baud and I might increase it to around 100ms for 100 baud?



  • @cloolalang

    Other parameters not yet tested;

    1. sleep or wait between sketch information and presentation messages and/or in other functions
    2. MY_RS485_MAX_MESSAGE_LENGTH (40)
    3. #define MY_RS485_SOH_COUNT (3)
    4. MY_TRANSPORT_WAIT_READY_MS 0
    5. MY_TRANSPORT_STATE_TIMEOUT_MS 2*1000ul
    6. In mysensors core:
    // Wait configuration reply.
    	(void)wait(2000, C_INTERNAL, I_CONFIG);
    

Log in to reply
 

Suggested Topics

3
Online

11.2k
Users

11.1k
Topics

112.5k
Posts