From: ecalvo@2se.es Date: Mon, 25 Nov 2019 11:09:03 +0100 Subject: [OpenRISC] tick timer doubt In-Reply-To: References: <00a201d5a13a$89b42f80$9d1c8e80$@2se.es> <00b501d5a369$2b89ea90$829dbfb0$@2se.es> Message-ID: <00e601d5a378$5e11b740$1a3525c0$@2se.es> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openrisc@lists.librecores.org Okk, but, independently of the ticks variable updating, ttmr register… should it have the value that has been configured with or1k_timer_init? De: Stafford Horne Enviado el: lunes, 25 de noviembre de 2019 10:22 Para: ecalvo at 2se.es CC: Openrisc Asunto: Re: [OpenRISC] tick timer doubt Good point, I think it's missing a line to update the ticks variable. I terms of ttmr I am not sure if there is anything won't there. I'll try to run it and fix it when I get a chance. On Mon, Nov 25, 2019, 5:20 PM < ecalvo at 2se.es> wrote: Hello, Yeah, I think that I have understood what you have sent me in the screenshot. The example that I am referring is this one: Example for using the default mode: int main() { uint32_t ticks = 0; uint32_t timerstate; or1k_timer_init(100); or1k_timer_enable(); while (1) { while (ticks == or1k_timer_get_ticks()) { } timerstate = or1k_timer_disable(); // do something atomar or1k_timer_restore(timerstate); if (ticks == 100) { printf("A second elapsed\n"); or1k_timer_reset_ticks(); ticks = 0; } } } It is in the file and also here: https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#gaf760867d2f9d04f0c101c4c4975b0616 Elisa De: Stafford Horne > Enviado el: domingo, 24 de noviembre de 2019 1:05 Para: ecalvo at 2se.es CC: Openrisc > Asunto: Re: [OpenRISC] tick timer doubt Hello, Which example are you referring to? Have you been able to read the architecture specification and understand section 15 on tick timer facility? There ttmr is explained, the value 10000000 I think indicates a pending timer interrupt. See the attached screenshot. -stafford On Fri, Nov 22, 2019, 10:41 PM < ecalvo at 2se.es> wrote: Hi!! I have some doubts about the tick timer. Could someone help me? I explain them below * I don’t understand really well the example of or1k timer control that is in that file: For example, how is ticks variable updated? * If it was updated, I understand that if frequency is 100Hz, a new tick takes place each 0.01 seg and with 100 ticks, a second has elapsed. However, If I compile and run this code and, and I open with gtkwave the generated vcd, I don’t understand why the value of TTMR register is 1000000. Is The value of TTMR register fixed by software using or1k_timer_set_period function? Is it measured in Hz? Thanks in advance _______________________________________________ OpenRISC mailing list OpenRISC at lists.librecores.org https://lists.librecores.org/listinfo/openrisc -------------- next part -------------- An HTML attachment was scrubbed... URL: