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; }