SAM4L flash writing vs. SysTick

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

dragodmn
Posts: 5
Joined: Mon Apr 14, 2014 11:22 am

SAM4L flash writing vs. SysTick

Mon Nov 17, 2014 2:51 pm

Hello,

I'm developing an application on SAM4LS4B that should be able to store some data into the flash. I don't have EEPROM. For this I'm using a flashcalw_memcpy() function from ASF. I got everything runing and it works fine, all the things that I write in are there and I have no complains on that.
But, when I write to the flash I loose time ticks (1ms interrupts). This is a problem. So I have tried this with my board and connecting a scope to a pins on wich I create pulses when 1ms interrupt hapens (PIN_PC09) and when I want to write in the flash (PIN_PC10).

Code: Select all

....

/** System tick frequency in Hz. */
#define SYS_TICK_FREQ        1000

void SysTick_Handler(void)
{
	g_ul_tick_count++;
	ioport_set_pin_level(PIN_PC09,1);
	ioport_set_pin_level(PIN_PC09,0);
}

/**
 *  \brief Get the tick count value.
 *
 */


static uint32_t get_tick_count(void)
{
	return g_ul_tick_count;
}


/**
 *  Configure system tick to generate an interrupt every 1ms.
 */
static void configure_systick(void)
{
	uint32_t ul_flag;

	ul_flag = SysTick_Config(sysclk_get_cpu_hz() / SYS_TICK_FREQ);
	if (ul_flag) {
		puts("-F- Systick configuration error\r");
		while (1) {
	
		}
		
	}
	
	
}


....

int main(void)
{
	ioport_set_pin_dir(PIN_PC10,IOPORT_DIR_OUTPUT);
	ioport_set_pin_dir(PIN_PC10,IOPORT_DIR_OUTPUT);

	sysclk_init();
	board_init();
	configure_systick();


	.....
	
	ioport_set_pin_level(PIN_PC10,1);
	ioport_set_pin_level(PIN_PC10,0);
	flashcalw_memcpy(.....);

	while (true) {
		

		......
		
	}
}
So as a resault I get clean 1ms pulses, but when it comes to writing it looks like SysTick is then blocked. I miss like 12 ticks. After that ticks continue normally.

This is a big problem for me. Is there a posibility to write flash and have ticks at the same time?

Thanks

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 3 guests