RAK11720 digital pin high at startup

Hello there,

I got a problem with the RAK11720 which sets pin 38 and pin 44 high at startup for 1 second. Pin 37 gets only a really small pulse. At startup the outputs may not get activated.
This only occurs when i connect the power supply and not after resetting the device. On the output there are 24V DC motors connected.

These pins are used for pwm and driving a mosfet. Iam not using a pull down resistor which may cause this problem??

I tried to set the pin low at setup but didn’t effect anything.

pinMode(37,OUTPUT);
pinMode(44,OUTPUT);
pinMode(38,OUTPUT);
digitalWrite(44,LOW);
digitalWrite(38,LOW);
digitalWrite(37,LOW);

Do you have ideas how to solve this problem?

From the board pin definitions:
Pin 37 is a “pure” GPIO
Pin 44 is a GPIO for LED 1 (when used as WisBlock Core), but not initialized
Pin 38 is a “pure” GPIO

None of them should show any “High” pulse until you do the setup with pinMode.
I propose to try with pull-downs.

Is there an option to set the default value of an output to 0? When the module starts the output pin 36 needs to be initialized to 0 but this can only be done in the setup(). This means when i turn on the module, in the first seconds the pin is turned on (HIGH) and then in the setup its turned off. I have connected a pull down resistor so its not floated. I need to change the default value in the api to 0 to be sure the pin is not set to high for the first second, is this possible?

Kind regards

@beegee @carlrowan , Can you you help me please? :slight_smile:

As I understand, typically, GPIOs are initialized in a high impedance state, e.g. as inputs. This is true, I believe, for most majority of MCUs. So a simple pulldown resistor may be enough for you.

If after installing a physical pull down resistor on that pin, you’re still experiencing the same use, the only reason I can see for that behavior, is that the bootloader stage use these pins for something (like read an external memory, initialize a radio transceiver, etc.), but based on @beegee answer, there is no reason to a bootloader do that, and even if that was the case, you should see that behavior on every reset command (POR, Reset Pin, soft reset, etc.), which you mention it does not happen.

You may consider that the issue is not the firmware itself, perhaps it related with a hardware design.

Setting a default value for GPIO pin from POR is not a common feature offered by MCUs vendors, and as far as I know, ama3b1kk-kbr does not have that feature. If you still convinced that it is required to be solved by firmware, then you should implement your firmware in a really bare-metal environment (No Arduino, No RUI, No RTOS) so you can initialize your GPIO as fast as MCU starts executing instructions.

1 Like