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 here, or visible below.
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() {}
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.
With the generic Arduino library calls, the ring oscillator is much slower:
The code for this is below. Most of the overhead is in the use of the "loop" function.
void setup() {
pinMode(PIN_WIRE_SDA, OUTPUT);
pinMode(PIN_WIRE_SCL, INPUT);
}
void loop() {
digitalWrite(PIN_WIRE_SDA, 1-digitalRead(PIN_WIRE_SCL));
}