<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/ports/nrf/common-hal, branch encoding</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=encoding</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=encoding'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-07-15T14:26:47+00:00</updated>
<entry>
<title>nRF: Always use sd_nvic_critical_region calls</title>
<updated>2020-07-15T14:26:47+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-07-14T22:34:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dc74ae83da6f519a36d75388b5be9923a10bf063'/>
<id>urn:sha1:dc74ae83da6f519a36d75388b5be9923a10bf063</id>
<content type='text'>
The motivation for doing this is so that we can allow
common_hal_mcu_disable_interrupts in IRQ context, something that works
on other ports, but not on nRF with SD enabled.  This is because
when SD is enabled, calling sd_softdevice_is_enabled in the context
of an interrupt with priority 2 or 3 causes a HardFault.  We have chosen
to give the USB interrupt priority 2 on nRF, the highest priority that
is compatible with SD.

Since at least SoftDevice s130 v2.0.1, sd_nvic_critical_region_enter/exit
have been implemented as inline functions and are safe to call even if
softdevice is not enabled.  Reference kindly provided by danh:
 https://devzone.nordicsemi.com/f/nordic-q-a/29553/sd_nvic_critical_region_enter-exit-missing-in-s130-v2

Switching to these as the default/only way to enable/disable interrupts
simplifies things, and fixes several problems and potential problems:
 * Interrupts at priority 2 or 3 could not call common_hal_mcu_disable_interrupts
   because the call to sd_softdevice_is_enabled would HardFault
 * Hypothetically, the state of sd_softdevice_is_enabled
   could change from the disable to the enable call, meaning the calls
   would not match (__disable_irq() could be balanced with
   sd_nvic_critical_region_exit).

This also fixes a problem I believe would exist if disable() were called
twice when SD is enabled.  There is a single "is_nested_critical_region"
flag, and the second call would set it to 1.  Both of the enable()
calls that followed would call critical_region_exit(1), and interrupts
would not properly be reenabled.  In the new version of the code,
we use our own nesting_count value to track the intended state, so
now nested disable()s only call critical_region_enter() once, only
updating is_nested_critical_region once; and only the second enable()
call will call critical_region_exit, with the right value of i_n_c_r.

Finally, in port_sleep_until_interrupt, if !sd_enabled, we really do
need to __disable_irq, rather than using the common_hal_mcu routines;
the reason why is documented in a comment.
</content>
</entry>
<entry>
<title>Compiles!</title>
<updated>2020-06-24T19:47:59+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2020-06-23T19:58:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c5fa9730a87b47f569a2bc4a7599e67b198826e6'/>
<id>urn:sha1:c5fa9730a87b47f569a2bc4a7599e67b198826e6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add UART support</title>
<updated>2020-06-24T19:47:58+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2020-06-10T01:28:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a26102607e3fe5b6f888fcd246e20ac82a70af7b'/>
<id>urn:sha1:a26102607e3fe5b6f888fcd246e20ac82a70af7b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix up end of file and trailing whitespace.</title>
<updated>2020-06-03T09:56:35+00:00</updated>
<author>
<name>Diego Elio Pettenò</name>
<email>flameeyes@flameeyes.com</email>
</author>
<published>2020-05-30T09:44:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dd5d7c86d22807c021dd1711eb7dd3daebc5cfcf'/>
<id>urn:sha1:dd5d7c86d22807c021dd1711eb7dd3daebc5cfcf</id>
<content type='text'>
This can be enforced by pre-commit, but correct it separately to make it easier to review.
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'adafruit/master' into wdt-nrf</title>
<updated>2020-06-02T00:01:16+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2020-06-02T00:01:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=959f7297dae60b1f39e50727346b037670822f39'/>
<id>urn:sha1:959f7297dae60b1f39e50727346b037670822f39</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge pull request #2890 from jepler/nrf-audio-tick</title>
<updated>2020-06-01T22:51:22+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@adafruit.com</email>
</author>
<published>2020-06-01T22:51:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4146d6f872fb79bc2669bd97fc03c0bd067e9baf'/>
<id>urn:sha1:4146d6f872fb79bc2669bd97fc03c0bd067e9baf</id>
<content type='text'>
nrf: put supervisor enable/disable tick in place</content>
</entry>
<entry>
<title>watchdog: use common_hal_watchdog_* pattern</title>
<updated>2020-05-27T03:38:29+00:00</updated>
<author>
<name>Sean Cross</name>
<email>sean@xobs.io</email>
</author>
<published>2020-05-27T03:25:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=aac5a4f178f311eb2aaf7d58135e9df49f80f7c4'/>
<id>urn:sha1:aac5a4f178f311eb2aaf7d58135e9df49f80f7c4</id>
<content type='text'>
This pulls all common functionality into `shared-bindings` and keeps
platform-specific code inside `nrf`. Additionally, this performs most
validation in the `shared-bindings` site.

The only validation that occurs inside platform-specific `common-hal`
code is related to timeout limits that are platform-specific.

Additionally, all documentation is now inside the `shared-bindings`
directory.

Signed-off-by: Sean Cross &lt;sean@xobs.io&gt;
</content>
</entry>
<entry>
<title>nrf: microcontroller: use port reset path</title>
<updated>2020-05-27T03:28:49+00:00</updated>
<author>
<name>Sean Cross</name>
<email>sean@xobs.io</email>
</author>
<published>2020-05-22T11:34:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5edc29c6a592fc70f6d273dc89c3dd1be8afcb13'/>
<id>urn:sha1:5edc29c6a592fc70f6d273dc89c3dd1be8afcb13</id>
<content type='text'>
For `microcontroller.reset()`, don't manually call NVIC_SystemReset().
Instead, call the `port_reset()` in case the port wants to do any
cleanup.

Signed-off-by: Sean Cross &lt;sean@xobs.io&gt;
</content>
</entry>
<entry>
<title>watchdog: move timeout exception to shared-bindings</title>
<updated>2020-05-27T03:28:49+00:00</updated>
<author>
<name>Sean Cross</name>
<email>sean@xobs.io</email>
</author>
<published>2020-05-22T10:52:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c7efc94a336091a1e6d79e94a9e80b31e5d5fc3f'/>
<id>urn:sha1:c7efc94a336091a1e6d79e94a9e80b31e5d5fc3f</id>
<content type='text'>
Make this exception globally available to all platforms that have
enabled the watchdog timer.

Signed-off-by: Sean Cross &lt;sean@xobs.io&gt;
</content>
</entry>
<entry>
<title>nrf: common-hal: finish reworking exceptions</title>
<updated>2020-05-27T03:28:49+00:00</updated>
<author>
<name>Sean Cross</name>
<email>sean@xobs.io</email>
</author>
<published>2020-05-22T10:44:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=108409c6cdfb4adb9f18affe8714cfb6a8a86188'/>
<id>urn:sha1:108409c6cdfb4adb9f18affe8714cfb6a8a86188</id>
<content type='text'>
This finishes the rework of the exception handler, which is once
again stored inside the watchdog timer module.

This also implements a `watchdog_reset()` that is used to disable the
RAISE watchdog, if one is enabled.

Signed-off-by: Sean Cross &lt;sean@xobs.io&gt;
</content>
</entry>
</feed>
