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

SOFT DEVICE : INVALID MEMORY ACCESS - START CLOCK AND SOFT DEVICE not working together.

Hi! 

I am working on NRF 52840 Controller and Soft Device Version 6.0.0. Coding using Keil IDE in C.

Also developing using Free RTOS.

According to the requirement I need to use  a Timer Module as a Counter (through PPI) to cause an interrupt. I am using Timer - 1 ( as Soft Device is using Timer - 0 ).

When I start the High Frequency Clock => " NRF_CLOCK->TASKS_HFCLKSTART "   ,  I am getting INVALID MEMORY ACCESS ERROR.

Soft Device is enabled. 

The PPI Channel used is Channel - 0 

Please Let me know if I am looking at the right place for this error and also if I am missing any configurations.

ThanksGrinning

 This is the Error Print from the Firmware.;

Parents
  • Hi,

    The softdevice will block or restrict access to some Hardware peripherals when it is enabled, including the CLOCK peripheral. Trying to access the peripheral registers directly will result in invalid address access.

    The restricted peripherals can be accessed through the softdevice API, specifically you can use sd_clock_hfclk_request and sd_clock_hfclk_release to start and stop the HF clock.

    Best regards,
    Jørgen

  • What do you mean by the following?

    TEJASWINI J said:
    "nrf_drv_timer_extended_compare" is causing my code to hang.

     Is the application stuck in some loop? Have you tried debugging to check for error codes?

  • Hi Jorgen! 

    No its not in a Loop... I am trying to initialize a PPI.

    First I init the Timer and perform a NRF Extended Compare.

    Then I am enabling the Timer. My code is hung at this point. 

    I tried to debug , but this can take place only when i Issue a BLE Command. I am not finding a uniform behavior to share with you.

    Could please help in telling me where to look at.

    Slight smile Tejaswini Slight smile

  • Please post your code showing how you configure/enable timer. You can also upload your entire project for us to help you debug the issue.

  • nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
            err_code = nrf_drv_timer_init( &m_timer2, &timer_cfg, sample_counter_event_handler );
            APP_ERROR_CHECK( err_code );

            nrf_drv_timer_clear( &m_timer2 );
            nrf_drv_timer_extended_compare( &m_timer2, NRF_TIMER_CC_CHANNEL0, XXX, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true );
         //XXX is the data count we want to ready from the Channel  Register.
            // Configuring the PPI used for automating the data streaming
            err_code = nrf_drv_ppi_channel_alloc( &m_ppi_channel );
            APP_ERROR_CHECK( err_code );

            // Set up PPI Chn0 for triggering of SPIM start when DR pin event occurs (set up for falling edge event)
            err_code = nrf_drv_ppi_channel_assign( m_ppi_channel,
                                                   nrf_drv_gpiote_in_event_addr_get( AFE_DR_PIN ),
                                                   nrf_spim_task_address_get( nrfbusHandle->busIdentifier.u.spim.p_reg, NRF_SPIM_TASK_START ) );
            APP_ERROR_CHECK( err_code );
            
            // Fork PPI to also trigger count on timer2 to keep track of number of samples.
            err_code = nrf_drv_ppi_channel_fork_assign( m_ppi_channel,
                                                        nrf_drv_timer_task_address_get( &m_timer2, NRF_TIMER_TASK_COUNT ) );
            APP_ERROR_CHECK( err_code );

    nrf_drv_timer_clear( &m_timer2 );
        nrf_drv_timer_enable( &m_timer2 );
        err_code = nrf_drv_ppi_channel_enable( m_ppi_channel );
        APP_ERROR_CHECK(err_code);

    This is the code. The last second line is causing a Problem.

    My code is not executed Further.

    I tried disabling the Soft device also, but the code was still hung.

Reply
  • nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
            err_code = nrf_drv_timer_init( &m_timer2, &timer_cfg, sample_counter_event_handler );
            APP_ERROR_CHECK( err_code );

            nrf_drv_timer_clear( &m_timer2 );
            nrf_drv_timer_extended_compare( &m_timer2, NRF_TIMER_CC_CHANNEL0, XXX, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true );
         //XXX is the data count we want to ready from the Channel  Register.
            // Configuring the PPI used for automating the data streaming
            err_code = nrf_drv_ppi_channel_alloc( &m_ppi_channel );
            APP_ERROR_CHECK( err_code );

            // Set up PPI Chn0 for triggering of SPIM start when DR pin event occurs (set up for falling edge event)
            err_code = nrf_drv_ppi_channel_assign( m_ppi_channel,
                                                   nrf_drv_gpiote_in_event_addr_get( AFE_DR_PIN ),
                                                   nrf_spim_task_address_get( nrfbusHandle->busIdentifier.u.spim.p_reg, NRF_SPIM_TASK_START ) );
            APP_ERROR_CHECK( err_code );
            
            // Fork PPI to also trigger count on timer2 to keep track of number of samples.
            err_code = nrf_drv_ppi_channel_fork_assign( m_ppi_channel,
                                                        nrf_drv_timer_task_address_get( &m_timer2, NRF_TIMER_TASK_COUNT ) );
            APP_ERROR_CHECK( err_code );

    nrf_drv_timer_clear( &m_timer2 );
        nrf_drv_timer_enable( &m_timer2 );
        err_code = nrf_drv_ppi_channel_enable( m_ppi_channel );
        APP_ERROR_CHECK(err_code);

    This is the code. The last second line is causing a Problem.

    My code is not executed Further.

    I tried disabling the Soft device also, but the code was still hung.

Children
No Data
Related