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

Cant change registers via pionters on nrf53

Hi, I want write code on rust, but build system of nrf sdk for nrf5340 too hard for creating bindings, so I decide to create own HAL on rust and embed it in C with BLE stack on C. I start write test code on C for blinking leds on nrf5340dk. When I write this code on C, it just dont work, but when I do the same steps on GDB, all work fine. I also noticed that when I write value at registers in code, all operations just ignore.

static void turn_on_all_leds()
{
    volatile uint32_t *gpio_base = (uint32_t *) 0x50842500UL;
    volatile uint32_t *gpio_out_clr = (uint32_t *) (gpio_base + 0x00CUL);
    volatile uint32_t *gpio_dir_set = (uint32_t *) (gpio_base + 0x018UL);

    *gpio_dir_set = 0xf0180000UL;
    *gpio_out_clr = 0x00180000UL;
}


I read Reference manual and think that SPU may prevent my work with registers, but I dont know, How I should turn off SPU correct or how I can setup sdk for it, or may be my problem related to something else. When I try get some information about setup SPU at GDB, it tell that it cant access memory. How I can work with all registers whenever I want?

Parents Reply Children
Related