Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Possible errors in system_nrf52810.c resulting reset pin not working on pca10040e (SDK 17.0.2)

Hi everyone, 

I wanted to make reset pin funtional on nRF52 DK while using pca10040e folder so that I could develop on nRF52810 later, but the reset button did not work as I expected. 

I figured out that in order to set reset pin properly, preprocessor macro CONFIG_GPIO_AS_PINRESET should be defined, thus registers PSELRESET in UICR will be configured automatically. 

The configuration process took place in system_nrf52810.c file line 166~182 when using pca10040e, which seems all right.

However the next few lines did not make sense to me. (system_nrf52810.c L184~197)

    /* When developing on an nrf52832, make sure NFC pins are mapped as GPIO. */
    #if defined (DEVELOP_IN_NRF52832)
        if (((*((uint32_t *)0x10001200) & (1 << 0)) != 0) || ((*((uint32_t *)0x10001204) & (1 << 0)) != 0)){
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            *((uint32_t *)0x10001200) = 0;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            *((uint32_t *)0x10001204) = 0;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NVIC_SystemReset();
        }
    #endif

It seems to mess up the NFC pins configuration with reset pins'. It checks the values (0x15, meaning pin 21, configured earlier) in the register form 0x10001200 which belongs to PSELRESET and writes 0x0 to the same register. The effect is that the reset pin is set to pin 0 thus will not be functional. 

I checked several examples and all of them have the same problem. I suppose the project will copy the system_nrf52810.c file from sdk_folder\modules\nrfx\mdk and make their own. In this case, the problem would affect all projects that uses nRF52832 to emulate nRF52810, i.e. using project folder pca10040e

I also checked the UICR memory content with nrfjprog. It read 0x00000015 00000015 starting at address 0x10001200 if I commented the problematic lines, but read 0x0..00 if the macros take effect. 

Setup information: SDK 17.0.2, using Keil 5. 

Please help me confirm that this is a SDK problem. 

Thanks and wish everyone a nice holiday.

Chao

Parents Reply Children
No Data
Related