Topics

nRF5 GPIO stops working after some time


Gavrikov Paul <Paul.Gavrikov@...>
 

Hi,

 

I have a very weird problem with my nRF52840-DK and Zephyr v1.13.0. Very simple code:

 

dev = device_get_binding(CONFIG_GPIO_P0_DEV_NAME);

 

            gpio_pin_configure(dev, 7, GPIO_PIN_ENABLE  | GPIO_DIR_OUT);

            gpio_pin_configure(dev, 3, GPIO_PIN_ENABLE  | GPIO_DIR_OUT);

 

            while(1) {

                        gpio_pin_write(dev, 3, false);

                        gpio_pin_write(dev, 7, false);

                        k_sleep(10);

                        gpio_pin_write(dev, 3, true);

                        gpio_pin_write(dev, 7, true);

                        k_sleep(10);

            }

 

So all I do is toggle Pin 3 and 7 every 10 msecs. Now if I let this code run it will work, but after some seconds Pin 7 will stop toggling, while Pin 3 keeps running. And after that point Pin 7 will never turn on again (not even if I press Reset). However if I disconnect and then reconnect power, it will start working for some seconds again.

It appears as if there as some Pins that work all the time and some Pins just stop working after some seconds. What is wrong?

 

 

Best,

Paul

 


Carles Cufi
 

+ Andrzej, Mieszko

 

From: <devel@...> on behalf of Gavrikov Paul <Paul.Gavrikov@...>
Date: Friday, 12 October 2018 at 20:28
To: "zephyr-devel@..." <zephyr-devel@...>
Cc: Lai Matthias <Matthias.Lai@...>
Subject: [Zephyr-devel] nRF5 GPIO stops working after some time

 

Hi,

 

I have a very weird problem with my nRF52840-DK and Zephyr v1.13.0. Very simple code:

 

dev = device_get_binding(CONFIG_GPIO_P0_DEV_NAME);

 

            gpio_pin_configure(dev, 7, GPIO_PIN_ENABLE  | GPIO_DIR_OUT);

            gpio_pin_configure(dev, 3, GPIO_PIN_ENABLE  | GPIO_DIR_OUT);

 

            while(1) {

                        gpio_pin_write(dev, 3, false);

                        gpio_pin_write(dev, 7, false);

                        k_sleep(10);

                        gpio_pin_write(dev, 3, true);

                        gpio_pin_write(dev, 7, true);

                        k_sleep(10);

            }

 

So all I do is toggle Pin 3 and 7 every 10 msecs. Now if I let this code run it will work, but after some seconds Pin 7 will stop toggling, while Pin 3 keeps running. And after that point Pin 7 will never turn on again (not even if I press Reset). However if I disconnect and then reconnect power, it will start working for some seconds again.

It appears as if there as some Pins that work all the time and some Pins just stop working after some seconds. What is wrong?

 

 

Best,

Paul

 


Mieruński, Mieszko <Mieszko.Mierunski@...>
 

Hello,

On nRF52840-DK pin 7 is used as CTS, it can be used freely after HWFC is disabled, for more information please look here

Please check bottom of the board, as there is information on which pins serve specific functions on DK.

 

Best Regards

Mieruński, Mieszko

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: Saturday, October 13, 2018 2:36 PM
To: Gavrikov Paul <Paul.Gavrikov@...>; zephyr-devel@...
Cc: Lai Matthias <Matthias.Lai@...>; Głąbek, Andrzej <Andrzej.Glabek@...>; Mieruński, Mieszko <Mieszko.Mierunski@...>
Subject: Re: [Zephyr-devel] nRF5 GPIO stops working after some time

 

+ Andrzej, Mieszko

 

From: <devel@...> on behalf of Gavrikov Paul <Paul.Gavrikov@...>
Date: Friday, 12 October 2018 at 20:28
To: "zephyr-devel@..." <zephyr-devel@...>
Cc: Lai Matthias <Matthias.Lai@...>
Subject: [Zephyr-devel] nRF5 GPIO stops working after some time

 

Hi,

 

I have a very weird problem with my nRF52840-DK and Zephyr v1.13.0. Very simple code:

 

dev = device_get_binding(CONFIG_GPIO_P0_DEV_NAME);

 

            gpio_pin_configure(dev, 7, GPIO_PIN_ENABLE  | GPIO_DIR_OUT);

            gpio_pin_configure(dev, 3, GPIO_PIN_ENABLE  | GPIO_DIR_OUT);

 

            while(1) {

                        gpio_pin_write(dev, 3, false);

                        gpio_pin_write(dev, 7, false);

                        k_sleep(10);

                        gpio_pin_write(dev, 3, true);

                        gpio_pin_write(dev, 7, true);

                        k_sleep(10);

            }

 

So all I do is toggle Pin 3 and 7 every 10 msecs. Now if I let this code run it will work, but after some seconds Pin 7 will stop toggling, while Pin 3 keeps running. And after that point Pin 7 will never turn on again (not even if I press Reset). However if I disconnect and then reconnect power, it will start working for some seconds again.

It appears as if there as some Pins that work all the time and some Pins just stop working after some seconds. What is wrong?

 

 

Best,

Paul