Not applicable
Dec 28, 2015
12:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 28, 2015
12:52 AM
Hi All,
I am working with the XMC1300 kit and in Toggling an IO using "DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0);" I noticed that I only achieve a period of approx. 6.5us. This is the only instruction I have in the "while(1U){}" loop.
Why is it this slow? Is it because I am in debugging mode? How do I just build and execute without debugging to check?
Regards
Enigma
I am working with the XMC1300 kit and in Toggling an IO using "DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0);" I noticed that I only achieve a period of approx. 6.5us. This is the only instruction I have in the "while(1U){}" loop.
Why is it this slow? Is it because I am in debugging mode? How do I just build and execute without debugging to check?
Regards
Enigma
3 Replies
Dec 28, 2015
07:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 28, 2015
07:04 PM
Hello Enigma,
6.5 us for the pulse due to pin toggling is indeed rather slow. I would suggest the following:
1) Ensure that the chip is running at the maximum frequency of 32 MHz
2) Use direct register coding instead of through the LLD, for example to toggle pin P0.0:
With the above steps, you should be able to get down to a pulse in the nanosecond range.
If further reduction is still required, you can also:
3) Select optimization level 1 in the active project properties (from project tab)
Regards,
Min Wei
6.5 us for the pulse due to pin toggling is indeed rather slow. I would suggest the following:
1) Ensure that the chip is running at the maximum frequency of 32 MHz
XMC_SCU_CLOCK_SetMCLKFrequency(32000);
2) Use direct register coding instead of through the LLD, for example to toggle pin P0.0:
PORT0->OMR = 0x00010001;
With the above steps, you should be able to get down to a pulse in the nanosecond range.
If further reduction is still required, you can also:
3) Select optimization level 1 in the active project properties (from project tab)
Regards,
Min Wei
Not applicable
Dec 29, 2015
04:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 29, 2015
04:57 AM
Hi Min Wei,
Below is the code I believe you suggested. It does not toggle pin P0.0, can you please point out what I am doing wrong?
#include
#include
int main(void)
{
XMC_SCU_CLOCK_SetMCLKFrequency(32000);
while(1U)
{
PORT0->OMR = 0x00010001;
}
}
Regards
Enigma
Below is the code I believe you suggested. It does not toggle pin P0.0, can you please point out what I am doing wrong?
#include
#include
int main(void)
{
XMC_SCU_CLOCK_SetMCLKFrequency(32000);
while(1U)
{
PORT0->OMR = 0x00010001;
}
}
Regards
Enigma
Not applicable
Dec 29, 2015
05:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 29, 2015
05:32 AM
Hi again,
Solved the problem. I forgot to set the control register.
Regards
Enigma
Solved the problem. I forgot to set the control register.
Regards
Enigma