Sign in

username:

password:



Not a member?

Search Comp.Arch.FPGA



Search tips

fpga by Keywords

Altera | ASIC | CPLD | Cyclone | DCM | DDR | DSP | Ethernet | ISE | JTAG | Linux | LVDS | Microblaze | ML310 | Modelsim | NIOS | OPB | PCI | Quartus | RocketIO | SDRAM | Spartan | Spartan3 | SRAM | Stratix | Verilog | VHDL | Virtex | Virtex-4 | Virtex-II | Xilinx | XST


Ads

See Also

DSPEmbedded SystemsElectronics

Comp.Arch.FPGA | CoreTimer programming in Actel SoftConsole

There are 1 messages in this thread.

You are currently looking at messages 0 to 1.

CoreTimer programming in Actel SoftConsole - self - 2010-08-13 14:09:00

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);
		}
	}
}