Page 1 of 1

Accessing Epiphany registers from the host

PostPosted: Mon Jun 15, 2015 7:34 pm
by sebraa
Hi,

since debugging the Epiphany (in our environment) is somewhat of a pain, I have started writing a small, external monitor tool. The main idea behind it is simple: Read the eCore registers, parse some information (state, program counter) and display it continuously, without affecting the Epiphany and without much overhead. However, I see too many crashes and start to wonder if this approach can be made reliable at all.

The monitor does e_init() and e_open() for initialization, but no e_system_reset(), since I don't want to kill the running program. Since I run the older SDK 5.13, the Epiphany clocks should be enabled at all times; but I have not found any documented way to detect this - is there any? After initialization, the monitor only calls e_read() for different registers (E_REG_CONFIG, ...) for each core, sleeps a while and repeats.

Starting my monitor while another program is running works fine. When starting the other program again (which calls e_init(), e_system_reset() and e_open(); as well as e_close() and e_finalize() at the end), the Parallella hangs completely. Also, starting the monitor after a cold boot immediately hangs the board.

Is there a way to keep a program continuously polling the Epiphany, without the board locking up?

Best Regards,
sebraa

Re: Accessing Epiphany registers from the host

PostPosted: Thu Jul 16, 2015 6:06 pm
by aolofsson
yes, but you can't read R0-R63 while a core is running a program and you can't issue a reset.
You have to make sure there is a reset before you call this program or it will hang. otherwise, hard to know what the problem is without seeing the exact code.
Andreas

Re: Accessing Epiphany registers from the host

PostPosted: Thu Jul 23, 2015 4:50 pm
by sebraa
Hi,

I have attached the source code for my e-top program. To compile and run, just use "make run"; the parameters (update rate etc) can be adjusted in the Makefile as well.
In my opinion, a program like this might fit the SDK, so if you think it is worth adding, I would like to help getting it in there. All the register stuff happens in epiphany.c (see update_state() for reading/parsing the registers, and ep_action() to change the timer configuration).

There are only two main shortcomings as of now:
- starting this program after a cold boot, or having it run when starting a new Epiphany application hangs the Parallella;
- when enabling the timers, they get automatically turned off again

E-top only reads the following registers: COREID, CONFIG, STATUS, DEBUGSTATUS, CTIMER0, CTIMER1 and PC. It also writes to CONFIG, CTIMER0 and CTIMER1 if told to do so (not on its own). It never touches R0 to R63 (why can't they be read? just curious...)

Best Regards,
sebraa