Serial Communication - XMC4500 with Matlab/Simulink

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hey guys,

I was thinking about transfering my sensor measurements via a serial communication (e.g. UART) to my laptop or PC.
Now, I would like to know if it is possible to transfer the measurements directly to Matlab, to process it with Simulink.

I've searched for a Matlab Library for the Infineon products and I found the XMC Library for Mathworks:
http://www.infineon.com/cms/de/product/microcontroller/development-tools-software-and-kits/dave-vers...

Do you have some experience with this Library? Simple Examples?

The aim would be to read out the sensor data with the XMC and transfer it to Matlab, where I am implementing my PID controller.
Furthermore, I would like to send the control value to another uC in order to control the system.

So, summarized:
1) Is it possible with this library?
2) Do you have some experience with it?
3) Would you be so kind to support me a little?
4) Maybe someone had the same problem before?

Thank you very much for your effort!

Kind regards,
schmidi
0 Likes
6 Replies
User7282
Level 4
Level 4
Hello schmidi,

I can give you some answers regarding this topic.

So about examples: after installing the package, you can check some simple examples clicking "Examples Library", as shown in the image below:

2037.attach

About your questions:

Right now the library does not have implemented an UART block. So using this library alone it is not possible to transfer data from XMC to Simulink.

One way to overcome this may be:
- Do your project in Simulink, using the available library blocks;
- Implement the UART communication in MATLAB side using matlab default functions;
- Export the project to DAVE and implement the UART communication in the microcontroller side.

If you have any further questions you can post it here and I can try to answer them.
0 Likes
Not applicable
Have you settled on a basic protocol? Matlab may not know what to do with a series of 12-bit conversions. Perhaps you could create a CSV string array that is sent from your XMC4500 to MATLAB, etc...
0 Likes
Not applicable
Hello apereira,

thank you very much for your quick reply and support! I will try to set up a serial communication first, since I've never done this with Matlab it will take a little time.
About your third answer - can you maybe further express how the Simulink or Matlab project can be exported to DAVE?
So, I will have a look at it the next few days... after that I will definitely have some more specific questions 🙂
I would be very glad if you are able to give me a little support later on!

Kind regards,
schmidi
0 Likes
Not applicable
Hi smays,

thank you for your reply! At the moment I've not tried to settle up anything, because I have some other issues to solve at first...
I will keep that in mind... Thank you for your hint!

Kind regards,
schmidi
0 Likes
User7282
Level 4
Level 4
Hello schmidi,

At the end of each one of the examples in the examples library, you have a section called DAVE "DAVE4 Usage example".

Here is one part of section:


1 - Open DAVE4
2 - Select File -> New -> DAVE Project
3 - Select DAVE CE Project
4 - Give the project the wanted name and press Next
5 - Select the specific device (the same one as used in the Simulink project) and press Finish
6 - Delete the main.c file of the newly created project (we are going to use the main.c created by Simulink)
7 - Select the project with the left mouse button
8 - Press the right mouse button and select Import
9 - Select File System
10 - Go to the folder containing the /source and import all the files
11 - Repeat step 7 to 10 for the /include
12 - Press the Generate code button on DAVE (this will generated some additional .h needed for a DAVE CE project)
13 - Press the Build Active Project button
14 - Press the Debug Test button
15 - Double click on the GBD SEGGER J-Link Debugging then press debug
16 - The project is now downloaded into the board and ready to be executed by the XMC Microcontroller
0 Likes
Not applicable
Hey guys,

thank you for your help!
At the end I did the serial communication with Matlab without using Simulink...
I made a GUI where I am able to adjust the Controller parameters and my desired value, works great!

Kind regards,
schmidi
0 Likes