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
  • The POWER register of NRF_TIMER0 is not documented and should not be written to by the application. I believe it's appearance in the header file is a mistake.

    I guess you can use the SHUTDOWN task if you don't intend to use the timer yourself.

  • You are right, the POWER register is not in the reference manual. So I'll remove the code to access the power register. The SHUTDOWN task is documented for the revision 3 chips, but in the reference manual 2.1 for the revision 2 chips it isn't. Can the SHUTDOWN-task be used on all chip revisions? What does the SHUTDOWN task exactly do? The power (read from the undocumented register) is still set to 1 after the SHUTDOWN task.

    In my opinion the softdevice should anyway ensure that the peripherals it uses are powered when the softdevice gets activated (as it did in earlier versions). Especially since the POWER register is in the header file since very long time.

Reply
  • You are right, the POWER register is not in the reference manual. So I'll remove the code to access the power register. The SHUTDOWN task is documented for the revision 3 chips, but in the reference manual 2.1 for the revision 2 chips it isn't. Can the SHUTDOWN-task be used on all chip revisions? What does the SHUTDOWN task exactly do? The power (read from the undocumented register) is still set to 1 after the SHUTDOWN task.

    In my opinion the softdevice should anyway ensure that the peripherals it uses are powered when the softdevice gets activated (as it did in earlier versions). Especially since the POWER register is in the header file since very long time.

Children
No Data
Related