Sunday 29 June 2014

XMC 2Go: Hack the Clock


The problem begin to be serious...

A bad surprise that comes out from last work on XMC 2Go, it was a face off with a clock setting of DAVE compiler.

"Warning: CPU is running at low speed (6238 kHz)."

It was strange, as much as I didn't give much weight to this message, but at the end it show all its importance.

I just report my post on Infineon forum:
Hi,

I wrote some line of code to drive a LED WS2812B.
I took inspiration from the approach of cpldcpu that has wrote something like this for another ARM microcontroller, but I have serious problems with timing of my board (XMC 2Go).
I evaluated the basic times for high and low datas, plus for NOP instruction; and I found this timing:

- High data about 2.7 - 3.47 us (with an error of 0.77 us)
- Low data about 1.93 - 5.47 us (with an error of 3.54 us, but you have to bear in mind the "while statement")
- NOP time about 11.8 - 11.2 us
- Max frequency generated with direct initialization (without NOP) port about 569 kHz

(all evaluated with a DSO Quad in "none mode"!)

Obviously with this times it's impossible to control a period of 1.25 us!

The basic code that I used for it was:
int main(void)
{
//	status_t status;

	DAVE_Init();
	
	while(1)
	{
		//__NOP();
		PORT0->OMR = 0x00000001UL;
		//__NOP();
		PORT0->OMR = 0x00010000UL;
		//__NOP();
		PORT0->OMR = 0x00000001UL;
		//__NOP();
		PORT0->OMR = 0x00010000UL;

	}
	return 0;
}





Obviously with and without "nop comments".
I think that the problem could be in this message:
"Warning: CPU is running at low speed (6238 kHz)."
That it has been discussed into a precedent post.
 
That's all for now. I just want to let you know that the clock speed with NOP it's about 470 kHz.
All that remains is to thoroughly investigate the problem, if you know some solutions, please feel free to post it in the comments.



 

No comments:

Post a Comment

Hi at all, leave me a feedback for this post. Thx