Dec 09, 2020
08:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 09, 2020
08:37 AM
Dear alll,
sorry for the (possibly) silly question but I am quite new to the XMC4800 MCU. I have acquired a XMC4800 EtherCAT relax kit, I am now simply implementing a field oriented control (FOC) for a PMSM .
I realised that the calculation time is quite high for the basic trigonometric functions. I am using the standard math.h library and the single precision float functions sinf, cosf hoping to have faster calculations.
It seems weird to me that such a MCU could be that slow, do you have any suggestions? compilers?..
Many thanks,
Luca24
sorry for the (possibly) silly question but I am quite new to the XMC4800 MCU. I have acquired a XMC4800 EtherCAT relax kit, I am now simply implementing a field oriented control (FOC) for a PMSM .
I realised that the calculation time is quite high for the basic trigonometric functions. I am using the standard math.h library and the single precision float functions sinf, cosf hoping to have faster calculations.
It seems weird to me that such a MCU could be that slow, do you have any suggestions? compilers?..
Many thanks,
Luca24
3 Replies
Dec 21, 2020
11:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 21, 2020
11:34 PM
Hi Luca24,
Could you please let us know how much slow the results are when you are using trigonometric calculation?
Best Regards,
Vasanth
Could you please let us know how much slow the results are when you are using trigonometric calculation?
Best Regards,
Vasanth
Dec 27, 2020
07:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 27, 2020
07:19 AM
Dear Vasanth,
i get a calculation time of around 2 us using the sinf math.h function while a calculation time of around 800 ns when using my own LUT for the sin trigonometric function.
In order to evaluate the calculation time I toggle a digital IO pin and monitor it on the scope, therefore the time measured contains as well the time required to toggle high and low the IO pin.
When I try to implement a field oriented control for a PM machine at 50 KHz I am having great issues to fit all the controller (clark, rotation, PI...) in the 20 us time period.
Best Regards,
Luca24
i get a calculation time of around 2 us using the sinf math.h function while a calculation time of around 800 ns when using my own LUT for the sin trigonometric function.
In order to evaluate the calculation time I toggle a digital IO pin and monitor it on the scope, therefore the time measured contains as well the time required to toggle high and low the IO pin.
When I try to implement a field oriented control for a PM machine at 50 KHz I am having great issues to fit all the controller (clark, rotation, PI...) in the 20 us time period.
Best Regards,
Luca24
Jan 10, 2021
11:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 10, 2021
11:11 PM
Hi Luca,
The 2us value seems to reasonable seeing the generate code. What is the time period you are observing in the controller loop as of now ? I guess you can get a marginal improvement using the optimization in the tool chain.
Right click on project ->Properties ->C/C++ Build -> Settings -> ARM GCC compiler optimization. Change the optimization from none and see the performance. Make sure that the parts in you code are not optimized out and functionality is not lost.
Best Regards,
Vasanth
The 2us value seems to reasonable seeing the generate code. What is the time period you are observing in the controller loop as of now ? I guess you can get a marginal improvement using the optimization in the tool chain.
Right click on project ->Properties ->C/C++ Build -> Settings -> ARM GCC compiler optimization. Change the optimization from none and see the performance. Make sure that the parts in you code are not optimized out and functionality is not lost.
Best Regards,
Vasanth