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

S130 2.0.0-7 Alpha not enabling internaly used peripherals

Hi

I've updated our platform to using the S130 2.0.0-7 Alpha (Update1). It turned out, that the initialization in out application failed, because erasing a flash page never triggered a NRF_EVT_FLASH_OPERATION_SUCCESS event.

I did a lot of tests and finally was able to find the problem source. In our code we disable all peripherals at startup. Later the used peripherals are enabled by the dedicated modules. It turned out, that disabling TIMER0 is a problem for the S130 2.0.0-7, because it doesn't enable the timer itself.

The following code snippet shows a test sequence. If the line where the TIMER0 gets disabled is active the end of the code is never reached. If not it works like a charm.

/************************************************************************************/
int main(void)
{

	uint32_t error_code;
	uint32_t event_id;
	bool success_b = false;
	
/*-- Code Statements ---------------------------------------------------------------*/
	
	// disable TIMER0 before enabling the softdevice
	NRF_TIMER0->POWER = 0;

  // init softdevice
  sd_softdevice_enable(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, softdevice_assertion_handler_f);
	
  // erase to flash
	error_code = sd_flash_page_erase(0x3A000 / 1024);
	if (error_code != NRF_SUCCESS)
	{
		return (false);
	}
	
  // wait for the NRF_EVT_FLASH_OPERATION_SUCCESS in busy loop
  while (!success_b)
  {
		if (sd_evt_get(&event_id) != NRF_ERROR_NOT_FOUND)
		{
			if (event_id == NRF_EVT_FLASH_OPERATION_SUCCESS)
			{
				// SUCCESS
				success_b = true;
				break;
			}
	  }
	}
	
	// code never reached when TIMER0 is powered down at startup
	while (1)
	{
	}
	
}/* main */
/************************************************************************************/

It's not a problem now as I know the issue. A fix in the upcoming softdevice S130 2.x would be great anyway.

Regards Adrian

Parents Reply Children
No Data
Related