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

Using Optimisation in nrf51 Keil

Hi, I have the following piece of code.

nrf_gpio_cfg_output(PIN_EN_BSTR);

for(int i=0;i<300;i++)

{

	nrf_gpio_pin_clear(PIN_EN_BSTR);

	__NOP();

	__NOP();

	__NOP();

	__NOP();

	__NOP();

	__NOP();

	__NOP();

	__NOP();

	__NOP();

	__NOP();	

	nrf_gpio_pin_set(PIN_EN_BSTR);

	nrf_delay_us(100);

}

nrf_gpio_pin_clear(PIN_EN_BSTR);

With Optimisation level O0, the off time is 2usec and with O3, the off time is 1.4usec. Will __NOPs have different cycle time for different optimisation levels? I thought they should be the same? Thanks.

Parents Reply Children
No Data
Related