Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

TX flow control not working in JS

I need to interface an RS485 chip. Tried all the possible combinations of cts pin, rts pin, txFlowControl, rxFlowControl with pin 17 (not used anywhere else), but none of the aforementioned combinations for UART.setConfig gives signal to enable the RS485 chip (verified with an oscilloscope). I was unable to find a working example (without bitbanging a gpio!)

Comments

  • // -----------------------------------------
    // Attempt #1
    // -----------------------------------------
    let update_uart = function(UART_number, obj){
    UART.setConfig(UART_number, {
    baudRate: 9600,
    numDatabits: 8,
    parity: 0,
    numStopBits: 1,
    rxFlowControl: true,
    esp32: {
    gpio: {
    rx: 15,
    tx: 16,
    rts: 17
    }
    }
    });
    };

    update_uart(UART_number, settings.uart);

    Timer.set(10000 /* 1 sec /, true / repeat */, function() {
    print("UART2 TX fired");
    UART.flush(2);
    UART.write(2, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    }, null);

    // -----------------------------------------
    // Attempt #2
    // -----------------------------------------

    let update_uart = function(UART_number, obj){
    UART.setConfig(UART_number, {
    baudRate: 9600,
    numDatabits: 8,
    parity: 0,
    numStopBits: 1,
    rxFlowControl: true,
    esp32: {
    gpio: {
    rx: 15,
    tx: 16,
    cts: 17
    }
    }
    });
    };

    update_uart(UART_number, settings.uart);

    Timer.set(10000 /* 1 sec /, true / repeat */, function() {
    print("UART2 TX fired");
    UART.flush(2);
    UART.write(2, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    }, null);

    // ------------------------------------------------------------------------------------------------------------------------------

    // -----------------------------------------
    // Attempt #3
    // -----------------------------------------

    let update_uart = function(UART_number, obj){
    UART.setConfig(UART_number, {
    baudRate: 9600,
    numDatabits: 8,
    parity: 0,
    numStopBits: 1,
    txFlowControl: true,
    esp32: {
    gpio: {
    rx: 15,
    tx: 16,
    rts: 17
    }
    }
    });
    };

    update_uart(UART_number, settings.uart);

    Timer.set(10000 /* 1 sec /, true / repeat */, function() {
    print("UART2 TX fired");
    UART.flush(2);
    UART.write(2, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    }, null);

    // ------------------------------------------------------------------------------------------------------------------------------

    // -----------------------------------------
    // Attempt #4
    // -----------------------------------------

    let update_uart = function(UART_number, obj){
    UART.setConfig(UART_number, {
    baudRate: 9600,
    numDatabits: 8,
    parity: 0,
    numStopBits: 1,
    txFlowControl: true,
    esp32: {
    gpio: {
    rx: 15,
    tx: 16,
    cts: 17
    }
    }
    });
    };

    update_uart(UART_number, settings.uart);

    Timer.set(10000 /* 1 sec /, true / repeat */, function() {
    print("UART2 TX fired");
    UART.flush(2);
    UART.write(2, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    }, null);

    // ------------------------------------------------------------------------------------------------------------------------------

Sign In or Register to comment.