Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

RTOS/OMAP-L138: How to synchronize Timer callback function?

$
0
0

Part Number:OMAP-L138

Tool/software:TI-RTOS

Hi,

I want to get continuous data on ARM-side, so I created one timer and one Task in DSP,  and put data into a globe variable in Timer callback function, then use MessageQ to send data to ARM-side. but, the program died when run it. 

When I removed the semaphore, the program was ok; when I added mutex to Timer callback function, the whole program died.

I'd like to know does Timer callback function support synchronization or lock. If not, how can I keep data continues on ARM-side.

Software Version:TI-RTOS-4.1, Processor-SDK-RT4.1

Hardware: OMAP-L138

//Dsp.cfg
	
	var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
	var timerParams = new Timer.Params();
	timerParams.startMode = Timer.StartMode_AUTO;
	timerParams.runMode = Timer.RunMode_CONTINUOUS;
	timerParams.periodType = Timer.PeriodType_MICROSECS;
	timerParams.period = 20000;

	Timer.timerSettings[2].ownerCoreId = 0;

	Timer.intFreqs[2] = { hi:0, lo:150000000 };
	Timer.create(2, '&FunTimer', timerParams);

        //Timer callback
	Void FunTimer(UArg arg){

		Semaphore_pend(mutex, BIOS_WAIT_FOREVER);
		timerValue ++;
		Semaphore_post(nmutex);
	}

	//Task callback
	Void MessageQTask(UArg argc,UArg argv)
	{
		MessageQ_create();

		Semaphore_pend(nmutex);
                //code there...
                //send timerValue to ARM-side
		Semaphore_post(mutex);
	}

	Int main(Int argc, Char* argv[])
	{
		mutex = Semaphore_create(1, NULL, &eb);
		nmutex = Semaphore_create(0, NULL, &eb);
	}

thank you,

luxiye


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>