Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

UART problem

Hi, I have problem with the configuration of UART,
If I use this :

var u = UART(1);
u.configure({
  baud_rate: 9600,
  rx_buf_size: 1024,
  tx_buf_size: 1024,
});

give me this :

Exec error: "Invalid UART number"
    at cfunc_0x40237828
    at u.js:5
    at cfunc_0x40235d04
    at repl:1

What's the problem?
thanks

Comments

  • Hi, what I see is that this part of file:

    static enum v7_err get_js_state(struct v7 *v7, int *uart_no,
                                    struct mg_uart_js_state **ujs,
                                    bool require_us) {
      v7_val_t uart_no_v = v7_get(v7, v7_get_this(v7), "_u", ~0);
      if (v7_is_number(uart_no_v)) {
        *uart_no = v7_get_double(v7, uart_no_v);
        if (*uart_no >= 0 && *uart_no < MG_MAX_NUM_UARTS) {
          *ujs = &s_uart_js_state[*uart_no];
          if (require_us && (*ujs)->us == NULL) {
            return v7_throwf(v7, "Error", "Not configured");
          }
          return V7_OK;
        }
      }
      return v7_throwf(v7, "Error", "Invalid UART number");
    }

    in 'mg_uart_js.c' return me the error 'Invalid UART number' .

    if I write on the prompt:

    [29700/2316] $ UART(1);

    the answer is :

    {"_un":1}

    if I use the .zip file downloaded from https://github.com/cesanta/mongoose-iot/releases/download/1.0-rc1/mongoose-iot-esp8266-1.0-rc1.zip and I give:

    [35228/1292] $ UART(1);

    answer me :

    {"_u":1}

    and I not receive error.
    Could you help me or explain what could be?

    Thank you

  • SergeySergey Dublin, Ireland
    edited December 2016

    Thanks for reporting,
    we are aware of it. We are refactoring the core of the JS engine, that that is going to be fixed as part of the refactoring.

  • Hi Sergey, thanks for your Sunday's reply! I have some question: where I will find the fixit? Because I'm using a older vs of firmware( the same of the link of my post, but builded from source). It's possible to build older version of software ? thanks in advance Andrea
  • SergeySergey Dublin, Ireland

    Hi Andrea,
    all sources are published, so you can do whatever you like.
    We, however, do not support older branches / versions.

  • Hi, therefore in that version of fw (1.0-rc1) there's a problem with uart setup or v7 engine? You think it's possible to solve ? by myself, I mean..
    thanks

Sign In or Register to comment.