# Sequence to reboot keyboard

**URL:** <https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838>\
**Category:** Help and Getting Started\
**Created:** [July 25, 2018, 9:48pm UTC](https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838 "2018-07-25T21:48:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamadagni](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jamadagni/32/2030_2.png) [@jamadagni](https://community.keyboard.io/u/jamadagni)\
**Post date:** [July 25, 2018, 9:48pm UTC](https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838/1 "2018-07-25T21:48:30Z")

</div>

Hello. I’m wondering if there exists or can be made a key sequence (like Ctrl+Alt+Del for computer in olden days) to reboot the keyboard without physically plugging out and in the cable (causing wear and tear) or rebooting the computer (too much)?

Use cases I can think of: recent problem with one shot conflicting with key repeat.

---

<div class="post-metadata">

**Author:** ![JohnAtl](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/johnatl/32/2125_2.png) [@JohnAtl](https://community.keyboard.io/u/JohnAtl)\
**Post date:** [July 26, 2018, 2:20am UTC](https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838/2 "2018-07-26T02:20:02Z")

</div>

You can create a reset function, then call it in your code.  
I haven’t called a custom function based on a keystroke, so I can’t help you there. There is probably code in the basic firmware that would help you.

```
void(* resetFunc) (void) = 0;//declare reset function at address 0
...
resetFunc(); //call reset 

```

[ref](https://www.instructables.com/id/two-ways-to-reset-arduino-in-software/)

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [July 26, 2018, 5:52am UTC](https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838/3 "2018-07-26T05:52:44Z")

</div>

> [@jamadagni](#):
>
> I’m wondering if there exists or can be made a key sequence (like Ctrl+Alt+Del for computer in olden days) to reboot the keyboard without physically plugging out and in the cable

There is no ready-made `Kaleidoscope.resetKeyboard()` or anything like that, mostly because this is such a corner case, something you normally wouldn’t need. Nevertheless, it is fairly easy to reboot the keyboard: there’s a built-in watchdog, that will reset the keyboard if it gets stuck. It is disabled by default, but if we enable it, and enter an infinite loop, that just so happens to trigger it, and gets the device rebooted.

For this, you only need two lines (ok, three with the `#include`):

```c++
#include <avr/wdt.h>

wdt_enable(WDTO_120MS);
while (1) {}

```

You can put this in a macro, or a magic combo, or something like that, and voila.

---

<div class="post-metadata">

**Author:** ![polsonst](https://avatars.discourse-cdn.com/v4/letter/p/a587f6/32.png) [@polsonst](https://community.keyboard.io/u/polsonst)\
**Post date:** [February 3, 2019, 3:11pm UTC](https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838/4 "2019-02-03T15:11:59Z")

</div>

I was not able to get the watchdog timer method to work. I think I found the answer [here](http://forum.arduino.cc/index.php?topic=299893.0). That worked for me, and I think it is exactly what you want to do. Here’s the code:

void softReset(){  
Serial1.println(“resetting”);  
USBCON&= ~(1\<\<USBE);  
delay(5);  
asm volatile(" jmp 0");  
}

I assume you won’t need the Serial1.println() statement so you can edit that out. My understanding is that for this low-level code: The USBCON flags the usb as “not connected” and the jump 0 resets in a “usb just reconnected” state.

---

<div class="post-metadata">

**Author:** ![Moilleadoir](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/moilleadoir/32/4122_2.png) [@Moilleadoir](https://community.keyboard.io/u/Moilleadoir)\
**Post date:** [September 4, 2024, 5:25am UTC](https://community.keyboard.io/t/sequence-to-reboot-keyboard/1838/5 "2024-09-04T05:25:41Z")

</div>

Is this still possible?
