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

what's the function of the code *(uint32_t *)0x40008C0C = 1

hi, what's the function of the code *(uint32_t *)0x40008C0C = 1 in GPIOTE example of SDK 9.0,

and i know the address of 0x40008000 is TIMER0, and i check the another timer example of

SDK9.0, it donot need this code. if you want to set the field of timer struct,why not use the

dot form of struct?

/**

  • @brief Function for application main entry. */ int main(void) { ret_code_t err_code;

    err_code = nrf_drv_ppi_init(); APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_gpiote_init(); APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_timer_init(&timer, NULL, timer_dummy_handler); APP_ERROR_CHECK(err_code); *(uint32_t *)0x40008C0C = 1;

    // Setup PPI channel with event from TIMER compare and task GPIOTE pin toggle. led_blinking_setup();

    // Enable timer nrf_drv_timer_enable(&timer);

    while (true) { // Do Nothing - GPIO can be toggled without software intervention. } }

Parents
  • The code line you refer to will do a direct register write to the peripheral, and the main (perhaps only) reason for this for is to implement a workaround for a product anomaly. The code line in question is a workaround for PAN-73. Weather the code is needed or not depends on your chip being affected by the product anomaly or not.

    Normally there you would use the definitions in 'nrf.h' to access registers. But often the workaround involves internal registers that are not intended for customer use. That is why the current form is used. I found a comment about this in my copy of the nRF51 SDK 9.0, but we might have different releases.

  • thanks, my version is nRF51_SDK_9.0.0_2e23562. I remove the code above from the GPIOTE example. it works fine.. so i doubt its fuction.

Reply Children
No Data
Related