RAK4200 Problem with GPIO

Dear Friends,

Please help me I have a rak4200 modules with V3.2.0.14 and spend a lot of time trying to use gpio as input but I can’t I always Receive RUI_STATUS_PARAMETER_INVALID, code is

    const uint32_t BUT=8; 
    RUI_GPIO_ST but;
    but.pin_num = BUT;
    but.dir = RUI_GPIO_PIN_DIR_INPUT;
    but.pull = RUI_GPIO_PIN_PULLUP;
    RUI_RETURN_STATUS rr = rui_gpio_init(&but);
    RUI_LOG_PRINTF("rr = %d\r\n",rr);
    RUI_RETURN_STATUS ri = rui_gpio_interrupt(true, but, RUI_GPIO_EDGE_FALL, 
    RUI_LOG_PRINTF("ri = %d\r\n",ri);

and in my serial always receive

    [00:10:26:046] Bienvenido␍␊
    [00:10:26:046] rr = 10␍␊
    [00:10:26:046] ri = 10␍␊
    [00:10:26:046] autosend_interval: 600s␍␊
    [00:10:26:046] Initialization OK,Current work_mode:LoRaWAN, join_mode:OTAA, Class: A␍␊
    [00:10:26:046] ␍␊
    [00:10:26:110] OTAA Join Start...␍␊
    [00:10:31:195] [LoRa]:Join Success␍␊
    [00:10:31:195] OK␍␊

The number 10 in rr and ri is becase I put in rui.h

I use Products_practice_based_on_RUI_v2.0-master

Please help me and sorry for this simple question
Best Regards

I’ve had some challenges porting from RAK811 to RAK4200, so the procedure I’ve adopted is to refer to the previous release of RUI on GitHub:

to try to find the nearest piece of code for RAK811 which has the most examples.

But then I do not become surprised when I move it to RAK4200 and I have to make changes.

So, if you do have a RAK811, move the code over to that to check it works OK before writing directly for the 4200.

PS, if you could format you post (edit it the pencil) and use the " formatter for block quote so we can see the code and the log separately, it makes it easier to read which makes it easier to post responses.

@nmcc thanks for your advice about the formatter and thanks for your advice about the code but I have a little big problem

The code that I am using I used it with the previous compiler in the previous firmware on RAK4200 and it works very well and now I can’t get it to work in this new version, that’s why my confusion

Yup, same for me :frowning_face:

PS, can you format the log output as well …

Thanks again for your advice about the post,
I hope there is a solution

I can’t talk for RAK4200, but for RAK811, the internal pull-up (or pull-down) for gpio input pin are not working wit RUI, and that was corroborate by RAK wireless, so there’s no other solution for me to use external pull-up resistors for button input switches.

I detected that, when got spurious external interrupt firing without pressing any push button.

@alnunez Thanks for your reply but my problem is the gpio doesn init always the status response is RUI_STATUS_PARAMETER_INVALID so the pin doesn’t work inclusive with external resistor

Did you tried with another pin? just to test if initialization returns OK with any other pin. I’m not 100% sure but seems to me from the RAK4200 datasheet, that all disponible i/o pins have already a “predefined” serial i/o behavior (uart,i2c,spi,swio). I already did (and sort of works) an application using push buttons and external interrupts for RAK811 with RUI, but as stated by @nmcc seems like porting RUI code from RAK811 to RAK4200 isn’t a friendly task.

Yes I tried with other pins, the problem is I have a RAK4200 with ol firmware and work perfect but with the last update of the firmware my new RAK4200 doesn work always return RUI_STATUS_PARAMETER_INVALID

Made small test with PIN 3 and initializes ok (returns=0), however, tried with PIN 8 and my module is bricked!!. trying to find what happened

@alnunez thank you very much you are right all pins for programing fail but some other work foe example pin 3, 9 an 10

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.