NRF52

Ring oscillator with nrf52.

This ring oscillator runs on the NRF52832 SOC using the Fanstel BC832 module. The NRF52 has an ARM Cortex M4F running at 64 MHz with built in 2.4GHz radio. An arduino sketch for the oscillator is available here, or visible below.


#define portout NRF_GPIO->OUT
#define portin NRF_GPIO->IN
#define pin_in 11
#define mask_in 1 << pin_in
#define pin_out 12
#define mask_out 1 << pin_out

void setup() {
  pinMode(pin_out, OUTPUT);
  NRF_GPIO->PIN_CNF[pin_in] = 0; //set input, no pullup/down, standard drive, no sense
  while(1){
     portin & mask_in ? NRF_GPIO->OUTCLR = mask_out : NRF_GPIO->OUTSET = mask_out; //218ns period
  }
}

void loop() {}

PCB with Fanstel BC832 module.

With the generic Arduino library calls, the ring oscillator is much slower:

Ring oscillator with nrf52 using Arduino library calls.

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)); 
}

Back