This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF51822 generate pulse with GPIO

I am trying to use NRF51822 GPIO to generate a pulse with max width of 0.3us. According to other tickets in the forum and the product spec, NRF51822 should be able to generate a 50% duty PWM with 8MHz, which means a single pulse width with 0.125us. But the shortest pulse I could get is 0.36us. Please help to check what is wrong with my setup.

I am using the standard GPIO configuration code as

nrf_gpio_cfg_output(PIN_NUM);

And for testing the pulse generation, I just use a simple while loop and toggling the GPIO as:

uint32_t* addrPinSet = (uint32_t*) 0x50000508;
uint32_t* addrPinClr = (uint32_t*) 0x5000050C;
while(true){
	*addrPinSet = PIN_MASK;
	*addrPinClr = PIN_MASK;
}
Related