HW with CPU TMS570LC4357
We have a extern HW timer that generates a pulse every 5 ms on the GPIO pin Bit0.
After initialsation of CPU we
- clear pending interrupt on GPIO pin Bit0 /* gioREG->FLG = 1U; */
- enable irq interrupts /* cpsie i */
Question 1.)
We saw that the interrupt sometimes is executed, direct after the pending interrupt is cleared and the irq is enabled, although no HW pulse is generated on GPIO Bit0 pin.
Did we forget to initialise a register?
Question 2.)
Is it sufficient to clear pending interrupt (gioREG->FLG = 1U;) in the interrupt service routine?
SW startup code
I.) start from reset
module function:
res_sys_intvecs.asm branch to res_start_bootstrap()
II.) start HW initialisation
module function:
res_startup.c res_start_bootstrap();
_res_core_init_core_registers();
_res_core_init_stack_pointers();
_res_core_init_ram();
res_clk_both_plls();
res_clk_setup_pll();
res_clk_periph_init();
res_lock_init_lock_step();
res_pin_init_pin_multiplexer();
res_rom_setup_flash();
res_clk_trim_lpo();
res_clk_map_clocks();
res_clk_init_eclk();
res_vim_init();
res_excll_init();
_res_mmu_init();
_res_core_enable_cache();
proc_main();
III.) start SW initialisation
module function:
proc_processes.c proc_main()
io_init(); /* Initialize of IO Driver component */
/* do other stuff */
/* Reset interruption flag. */
io_gio_clear_sync_irq(); /* gioREG->FLG = 1U; */
/* Enable IRQ - Clear I flag in CPS register */
_res_core_enable_irq_interrupt(); /* cpsie i */
while (1)
{
/* Idle function */;
}
IV.) Interrupt service routine
module function:
proc_interrupt_handler_sub.asm _proc_int_handle_interrupt_subroutine
proc_int_handle_interrupt_routine
V.) Sub call of interrupt service routine
module function:
proc_interrupt_handler.c proc_int_handle_interrupt_routine
/* Reset interruption flag. */
io_gio_clear_sync_irq(); /* gioREG->FLG = 1U; */
/* do other stuff */