# Remote ATTN pin control

**URL:** <https://discuss.blues.com/t/remote-attn-pin-control/1663>\
**Category:** Notecarrier F\
**Created:** [September 13, 2023, 7:16am UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663 "2023-09-13T07:16:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChronovaEngineering](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/chronovaengineering/32/745_2.png) [@ChronovaEngineering](https://discuss.blues.com/u/ChronovaEngineering)\
**Post date:** [September 13, 2023, 7:16am UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/1 "2023-09-13T07:16:57Z")

</div>

My device uses the Notecarrier F with a Swan. The Feather\_PWR switch is in the “Switched” position, so the Swan can be put to sleep using the ATTN pin. The Swan should be reading from some sensors, then sending a sleep request to the Notecard. Most of the time, this works but occasionally, the script can get stuck, e.g. if a sensor reading fails.

Is there any way to either reset or power cycle the Swan remotely, via the Notehub?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [September 13, 2023, 1:31pm UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/2 "2023-09-13T13:31:31Z")

</div>

Hi @ChronovaEngineering and welcome to the Blues community!

Would you mind posting a snippet of your code where it can get “stuck”? There may be a better solution we can come up with instead of resetting the Swan. That being said, you can try using the `NVIC_SystemReset();` method to perform a software reset.

Rob

---

<div class="post-metadata">

**Author:** ![ChronovaEngineering](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/chronovaengineering/32/745_2.png) [@ChronovaEngineering](https://discuss.blues.com/u/ChronovaEngineering)\
**Post date:** [September 13, 2023, 2:16pm UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/3 "2023-09-13T14:16:11Z")

</div>

Hi Rob,

For context, the device was sending sensor data to the Notehub for several days without issue but is now only showing “periodic inbound sync due” events. (See attached pic)

 ![Notes not uploading](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/889742255d06c8bd036053b7ea1c2b3c942177ac.png)

During prototyping, I found that if the sensors were disconnected, the script on the Swan would never reach the sleep request part in loop(), which is why I suspect a similar issue has happened in the field. Unfortunately, the device is in a rather remote location, so I was really hoping to try remotely rebooting it before trekking out to retrieve it.

As for exactly where the code freezes, I suspect it’s either where the sensors get initialised or whilst reading the sensors later in setup(). I can’t post most of the code publicly for commercial reasons but would be happy to send it privately if needed.

Cheers,  
Hazel

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [September 14, 2023, 2:25pm UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/4 "2023-09-14T14:25:43Z")

</div>

Hi @ChronovaEngineering,

A colleague just reminded me of another option you have to remotely restart the host. If you look in the [Reserved Environment Variables](https://dev.blues.io/guides-and-tutorials/notecard-guides/understanding-environment-variables/#reserved-environment-variables) list, you’ll see:

`_restart_host` and `_restart_host_use_attn`

If Feather PWR is `SWITCHED` and the DFU dip switch is `OFF` on the Notecarrier F, set the `_restart_host_use_attn` to `1` and `_restart_host` to any new value to restart the host.

Hope that helps!  
Rob

---

<div class="post-metadata">

**Author:** ![ChronovaEngineering](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/chronovaengineering/32/745_2.png) [@ChronovaEngineering](https://discuss.blues.com/u/ChronovaEngineering)\
**Post date:** [September 15, 2023, 7:54am UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/5 "2023-09-15T07:54:18Z")

</div>

Thanks Rob,

That’s exactly the feature I was looking for! I’ll give that a go.

Best wishes,  
Hazel

---

<div class="post-metadata">

**Author:** ![ChronovaEngineering](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/chronovaengineering/32/745_2.png) [@ChronovaEngineering](https://discuss.blues.com/u/ChronovaEngineering)\
**Post date:** [September 15, 2023, 6:32pm UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/6 "2023-09-15T18:32:30Z")

</div>

Hi Rob,

I’ve tried using the \_restart\_host environment variables and got the Notecard to attempt a host restart but I receive a “can’t restart host: dfu type not specified” response.

I tried adding some different \_dfu\_enabled values (usb:0;high:0;normal:0;low:0;dead:0 and usb:1;high:1;normal:1;low:1;dead:0) alternately but received the same response. You mentioned the DFU dip switch would need to be “Off” on the Notecarrier. I didn’t change the switch position before deploying the device, so this is probably still in the default “On” position - I’m guessing that’s where the issue lies.

Is there any workaround you would suggest or is a manual reset the only option? No worries if so, I’ll know to watch out for it in the future!

Thanks,  
Hazel

 ![dfu 0](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/0aebf9098ddfd562b6a1a66427d30c102228dada.png)

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [September 18, 2023, 1:34pm UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/7 "2023-09-18T13:34:29Z")

</div>

Hi @ChronovaEngineering,

With the DFU dip switch enabled, you are set up to use the more flexible/efficient method of firmware updating: [Notecard Outboard Firmware Update](https://dev.blues.io/guides-and-tutorials/notecard-guides/notecard-outboard-firmware-update/#notecard-outboard-firmware-update). However, this does require some API calls to be in your original firmware (see that link for details).

Rob

---

<div class="post-metadata">

**Author:** ![ChronovaEngineering](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/chronovaengineering/32/745_2.png) [@ChronovaEngineering](https://discuss.blues.com/u/ChronovaEngineering)\
**Post date:** [September 18, 2023, 3:06pm UTC](https://discuss.blues.com/t/remote-attn-pin-control/1663/8 "2023-09-18T15:06:28Z")

</div>

Ah, got it, thanks again for your help!

In the end, the device battery actually ran out overnight, then recharged enough to reconnect in the morning, which did the trick rebooting everything anyway.

Your advice is greatly appreciated - I’ll know what safety features to add to future devices now. 🙂

Best wishes,  
Hazel
