good morning devs,

i wanted to dev some crypto stuff last nigth and therefore my first focus on rng
stuff. to make it short,
i dont get any random numbers out ... the rng test from tests dir simply returns
zeros. I want make sure
its not a problem between mouse and keyboard :) sooo can anyone tell me if this
is a bug:

ps. sorry for spaming this code here - I am still a little bit unexp with riot -
and did not want to open git issue req yet.

pps. for me it seems that the ->POWER call does not work. and POWER is the only
RNG offset I can not "calculate" or
verify (do not find it all) in the "nrf51 seriees ref manual". hhHelp

ppps. _poweron/_poweroff calls of course deliver same result.

thanks and have a great day

Jan


--- test.c
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>

#include "nrf51.h"
#include "vtimer.h"
#include "periph/random.h"

int main(void)
{
    // wait a bit
    vtimer_usleep(1000 * 1000);

    printf("[DEBUG: NRF_RNG.POWER:\t\t0x%08lx]\n", NRF_RNG->POWER);
    printf("[DEBUG: NRF_RNG.TASKS_START:\t0x%08lx]\n", NRF_RNG->TASKS_START);
    puts("Initializing Random Number Generator driver.\n");
    printf("random_init()\n");
    random_init();
    vtimer_usleep(1000 * 1000);
    printf("[DEBUG: NRF_RNG.POWER:\t\t0x%08lx]\n", NRF_RNG->POWER);
    printf("[DEBUG: NRF_RNG.TASKS_START:\t0x%08lx]\n", NRF_RNG->TASKS_START);

    printf("\nMemory map:\n");

    printf("NRF_RNG_BASE:\t\t\t0x%lx\n", NRF_RNG_BASE);
    printf(" ->TASKS_START\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type,
TASKS_START));
    printf(" ->TASKS_STOP\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type,
TASKS_STOP));
    printf(" ->EVENTS_VALRDY\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type,
EVENTS_VALRDY));
    printf(" ->SHORTS\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type, SHORTS));
    printf(" ->INTENSET\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type,
INTENSET));
    printf(" ->INTENCLR\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type,
INTENCLR));
    printf(" ->CONFIG\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type, CONFIG));
    printf(" ->VALUE\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type, VALUE));
    printf(" ->POWER\t\t\t0x%08lx\n", (long) offsetof(NRF_RNG_Type, POWER));

    printf("\n[DEBUG: NRF_RNG.POWER:\t\t0x%08lx]\n", NRF_RNG->POWER);
    printf("NRF_RNG->POWER=1\n");
    NRF_RNG->POWER = 1;
    vtimer_usleep(1000 * 1000);
    printf("[DEBUG: NRF_RNG.POWER:\t\t0x%08lx]\n", NRF_RNG->POWER);


    printf("\n[DEBUG: NRF_RNG.TASKS_START:\t0x%08lx]\n", NRF_RNG->TASKS_START);
    printf("NRF_RNG->TASKS_START=1\n");
    NRF_RNG->TASKS_START = 1;
    vtimer_usleep(1000 * 1000);
    printf("[DEBUG: NRF_RNG.TASKS_START:\t0x%08lx]\n", NRF_RNG->TASKS_START);

    return 0;
}
---

--- test.output
2015-01-17 09:46:36,151 - INFO # [DEBUG: NRF_RNG.POWER:         0x00000000]
2015-01-17 09:46:36,154 - INFO # [DEBUG: NRF_RNG.TASKS_START:   0x00000000]
2015-01-17 09:46:36,155 - INFO # Initializing Random Number Generator driver.
2015-01-17 09:46:36,155 - INFO # 
2015-01-17 09:46:36,156 - INFO # random_init()
2015-01-17 09:46:37,006 - INFO # [DEBUG: NRF_RNG.POWER:         0x00000000]
2015-01-17 09:46:37,010 - INFO # [DEBUG: NRF_RNG.TASKS_START:   0x00000000]
2015-01-17 09:46:37,010 - INFO # 
2015-01-17 09:46:37,011 - INFO # Memory map:
2015-01-17 09:46:37,014 - INFO # NRF_RNG_BASE:                  0x4000d000
2015-01-17 09:46:37,017 - INFO #  ->TASKS_START                 0x00000000
2015-01-17 09:46:37,019 - INFO #  ->TASKS_STOP                  0x00000004
2015-01-17 09:46:37,022 - INFO #  ->EVENTS_VALRDY               0x00000100
2015-01-17 09:46:37,024 - INFO #  ->SHORTS                      0x00000200
2015-01-17 09:46:37,026 - INFO #  ->INTENSET                    0x00000304
2015-01-17 09:46:37,028 - INFO #  ->INTENCLR                    0x00000308
2015-01-17 09:46:37,030 - INFO #  ->CONFIG                      0x00000504
2015-01-17 09:46:37,032 - INFO #  ->VALUE                       0x00000508
2015-01-17 09:46:37,034 - INFO #  ->POWER                       0x00000ffc
2015-01-17 09:46:37,035 - INFO # 
2015-01-17 09:46:37,038 - INFO # [DEBUG: NRF_RNG.POWER:         0x00000000]
2015-01-17 09:46:37,040 - INFO # NRF_RNG->POWER=1
2015-01-17 09:46:38,043 - INFO # [DEBUG: NRF_RNG.POWER:         0x00000000]
2015-01-17 09:46:38,044 - INFO # 
2015-01-17 09:46:38,047 - INFO # [DEBUG: NRF_RNG.TASKS_START:   0x00000000]
2015-01-17 09:46:38,049 - INFO # NRF_RNG->TASKS_START=1
2015-01-17 09:46:39,053 - INFO # [DEBUG: NRF_RNG.TASKS_START:   0x00000000]
/exit
---
_______________________________________________
devel mailing list
[email protected]
http://lists.riot-os.org/mailman/listinfo/devel

Reply via email to