diff --git a/nrf52/index.html b/nrf52/index.html new file mode 100644 index 0000000000000000000000000000000000000000..77fe7767e23247fe15ed3e3122e8b515d8dc4409 --- /dev/null +++ b/nrf52/index.html @@ -0,0 +1,72 @@ +<html> +<head> +<style> +pre code { + background-color: #eee; + border: 1px solid #999; + display: block; + padding: 20px; +} +</style> + + +</head> +<body> + +<h1>NRF52</h1> + +<figure> +<img src='nrf52.png'> +<figcaption>Ring oscillator with nrf52.</figcaption> +</figure> + +<p>This ring oscillator runs on the NRF52 BLE SOC using the Adafruit feather development board. The NRF52 has an ARM Cortex M4F running at 64 MHz with built in BLE radio. An arduino sketch for the oscillator is available <a href='ring.ino'>here</a>, or visible below.</p> + +<pre> +<code> +const int pin_in = g_ADigitalPinMap[25]; +const int mask_in = 1 << pin_in; +const int pin_out = g_ADigitalPinMap[26]; +const int mask_out = 1 << pin_out; + +void setup() { + pinMode(pin_out, OUTPUT); + pinMode(pin_in, INPUT); + while(1){ + NRF_GPIO->IN & mask_in ? NRF_GPIO->OUTCLR = mask_out : NRF_GPIO->OUTSET = mask_out; + } +} + +void loop() {} +</code> +</pre> + +<p>Note: This test was run on a the Adafruit Feather Dev board, which uses the Raytac MDBT42Q module, incorporating the NRF52. The module retails for $7, the development board retails $24. Other (untested) modules are available for a lower price from Fanstel.</p> + +<p>With the generic Arduino library calls, the ring oscillator is much slower:</p> + +<figure> +<img src='nrf52-arduino.png'> +<figcaption>Ring oscillator with nrf52 using Arduino library calls.</figcaption> +</figure> + +<p>The code for this is below:</p> + +<pre> +<code> +void setup() { + pinMode(PIN_WIRE_SDA, OUTPUT); + pinMode(PIN_WIRE_SCL, INPUT); +} + +void loop() { + digitalWrite(PIN_WIRE_SDA, 1-digitalRead(PIN_WIRE_SCL)); +} +</code> +</pre> + +<p><a href='../index.html'>Back</a></p> + +</body> + +</html> \ No newline at end of file diff --git a/nrf52/nrf52-arduino.png b/nrf52/nrf52-arduino.png new file mode 100755 index 0000000000000000000000000000000000000000..aff63bb9a2221eb242894c3ade53d201dd9b08af Binary files /dev/null and b/nrf52/nrf52-arduino.png differ diff --git a/nrf52/nrf52.png b/nrf52/nrf52.png new file mode 100755 index 0000000000000000000000000000000000000000..cbc9b44316cafbac032decf50bce4c302b225296 Binary files /dev/null and b/nrf52/nrf52.png differ diff --git a/nrf52/ring.ino b/nrf52/ring.ino new file mode 100644 index 0000000000000000000000000000000000000000..bdb995e2e8c9c68cc0aa3522a954af969c4d1805 --- /dev/null +++ b/nrf52/ring.ino @@ -0,0 +1,14 @@ +const int pin_in = g_ADigitalPinMap[25]; +const int mask_in = 1 << pin_in; +const int pin_out = g_ADigitalPinMap[26]; +const int mask_out = 1 << pin_out; + +void setup() { + pinMode(pin_out, OUTPUT); + pinMode(pin_in, INPUT); + while(1){ + NRF_GPIO->IN & mask_in ? NRF_GPIO->OUTCLR = mask_out : NRF_GPIO->OUTSET = mask_out; + } +} + +void loop() {} \ No newline at end of file diff --git a/ring.json b/ring.json index f8a07d2eecfb084d99c5f1e1b38cec5867f3459e..7ff1c8b88465afb0b08ad0eb8c31285190577144 100644 --- a/ring.json +++ b/ring.json @@ -150,6 +150,16 @@ "ic_price":0.00, "ic_sales_link":"", "ring_period":11000000 - } + }, + { + "name":"NRF52", + "serial_number":"", + "subdirectory_path":"nrf52", + "dev_board_price":7.00, + "dev_board_sales_link":"", + "ic_price":3.00, + "ic_sales_link":"", + "ring_period":377 + } ] } \ No newline at end of file