Closed fdsgdshn closed 1 year ago
This example of using the timers has worked for me https://github.com/BrunoLevy/learn-fpga/discussions/105
This example of using the timers has worked for me BrunoLevy/learn-fpga#105
@JamesTimothyMeech Thank you, it works! Do you have an example related to the usage of timer0_interrupt in LiteX? I have searched extensively, but unfortunately, I couldn't find any. I have created a code block in the following way, but it's not working as expected. Thank you for your help and support!
void init_interrupts(void) { unsigned int mask = irq_getmask(); mask |= (1<< TIMER0_INTERRUPT); irq_setmask(mask);
unsigned int irqs = irq_pending() & irq_getmask();
if (irqs & (1 << TIMER0_INTERRUPT))
timer0_isr();
}
int main(void) { // Initialize interrupts init_interrupts(); ...
}
Unfortunately I haven't used timer interrupts but there could be some clues here: https://github.com/enjoy-digital/litex/blob/c58f46bb7981b935f44d1e01fc92623492ee1a15/litex/soc/interconnect/csr_eventmanager.py#L22
You can also look in the LiteX generated soc.h and csr.h files to see what LiteX generated functionality you have access to. Apologies I can't be more helpful but I am still learning about this myself.
"Hello, I'm trying to implement a timer application on the Litex board. For this purpose, I'm using the Litex VexRiscv processor. It is defined in the following way in the platform file of Litex: https://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/timer.py
"To use the Timer in Periodic mode, the user needs to:
Disable the Timer Set the 'load' register to 0 Set the 'reload' register to the expected period Enable the Timer " Despite applying these steps, the timer is not working. Can you help me? Thank you very much. Here is my code:
// in Main function // Configure the LED control register *LED_CTRL_ADDR = 0; // Turn off the LED initially
Despite implementing this, the timer is not functioning. How to use timers in Litex? Can you assist me?
Thanks