I've got an application that does a lot of nRF51822 GPIO wiggling and the timing needs to be controlled. In one spot I simply set a pin high then low like this:
nrf_gpio_cfg_output(5);
nrf_gpio_pin_set(5);
nrf_gpio_pin_clear(5);
I've ensured that the 16MHz clock is running like this:
// Start 16 MHz crystal oscillator.
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
// Wait for the external oscillator to start up.
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) { }; // Spin waiting for HFclock to start
OK, so the strange thing is that with the older SDK the pulse high time was about 1uSec. With the new SDK it is about 186nSec. That sounds like it is now taking three 16MHz clock cycles to run. And it seemed to take a lot longer before. Anyone have an explanation ? Did "nrf_gpio_pin_set/clear" get a lot faster ?
Thanks, -Russ