From: self on 13 Aug 2010 14:09 Hello, I am trying to measure the execution time of some code using a CoreTimer block connected to a Cortex-M1 processor design in an Actel Fusion part. My problem is that TMR_current_value() always returns 0. I am trying to run in TMR_ONE_SHOT_MODE but I have also tried continuous mode but no change. I have also double checked that the CoreTimer block is attached to the APB bus and that the base address in hardware corresponds to CORETMR_BASE_ADDR in my C source. Can anyone suggest a reason that TMR_current_value() always returns 0? Below I attache my C code. int main( void ) { int i; uint32_t tmr_read_val, tmr_pre_val, tmr_diff; const uint32_t tmr_load_val = 0x12345678; uint32_t gpio_out = GPOUT_INIT_STATE; GPIO_init( &g_gpio, COREGPIO_BASE_ADDR, GPOUT_INIT_STATE ); TMR_init(&g_timer, CORETMR_BASE_ADDR, TMR_ONE_SHOT_MODE,PRESCALER_DIV_2,tmr_load_val); TMR_start(&g_timer); i=0; while(1){ i++; if ( (i % 0x1FFF) == 0 ){ tmr_pre_val = tmr_read_val; tmr_read_val = TMR_current_value(&g_timer); tmr_diff = tmr_pre_val - tmr_read_val; GPIO_set_outputs( &g_gpio, gpio_out++ ); TMR_reload(&g_timer,tmr_load_val); } } }
|
Pages: 1 Prev: How to use VIO and core inserter at the same time. |