Forum Replies Created
-
AuthorPosts
-
Hi Mahoe,
A lot of customers are using MPC controllers for their applications. It should be able to verify your algorithm. To clarify your problem, can you help with the following questions?
1. When you mentioned that the controller cannot be written to, are you referring to an error while compiling a Simulink model with S-function or UKF module into C via Embedded Coder?
2. Could you provide a screenshot of the error message?
3. If it’s convenient, could you provide your Simulink model? I could validate it locally.If Embedded Coder cannot convert these two modules into C, you might consider importing the C library of the S-function or UKF module into Simulink. Alternatively, if the functions are not overly complex, you could manually implement these two functions in MATLAB.
我们有客户在控制器上部署过MPC算法,是可以进行验证的。以下几个问题想问您一下。
1. 您所指的无法写入控制器,是指Simulink模型加入S函数或UFK模块后,程序编译Embedded Coder转C的过程会报错么?
2. 可以发一下报错截图么?
3. 如果方便,可以提供一下您的Simulink模型么?我可以在本地进行验证。如果是这两个特定模块Embedded Coder无法转C,可以在Simulink在导入S函数或UKF模块的C库,或如函数实现不是特别复杂,可以手写matlab来实现这两个函数功能。
Thanks,
HuizheHey Hmarthens,
Sorry for the late response. I tried to reproduce this by replacing your midpoints.csv and flashed the sample project EmptyProject.slx to my Flexbench. I had SPI communication running for quite a bit. But I wasn’t able to reproduce this issue.
1. Can you try flashing this EmptyProject.slx attached below. See if you can reproduce this issue.
2. Can you run ps -ef | grep ‘python’ and post the response here? I wanna make sure there is no other python process that is currently running.Leo
- This reply was modified 8 months ago by Leo.
Attachments:
You must be logged in to view attached files.Hi Hmarthens,
No, I haven’t experienced such a bug. Can you help with the following questions to help further tackle this issue?
1. What steps have you taken that can reproduce this bug?
2. What’s your SPI baud rate config
3. When u say it reset on MCU. U mean the value changes back to the init value of SPIFromPi datastore or it’s been overwritten by the SPI commservice as we discussed previously?Hi Hmarthens,
No, I haven’t experienced such a bug. Can you help with the following questions to help further tackle this issue?
1. What steps have you taken that can reproduce this bug?
2. What’s your SPI baud rate config
3. When u say it reset on MCU. U mean the value changes back to the init value of SPIFromPi datastore or it’s been overwritten by the SPI commservice as we discussed previously?Hi Tanding,
I wrapped up a quick example. U can use the attached simulink mode to capture the frequency of 2 PWM inputs simultaneously.
Simple connect MCU Digital Output 14 and MCU Digital Output 15 to MCU Digital Input 1 and MCU Digital Input 2.
Let me know if u run into any other problems.
- This reply was modified 8 months, 4 weeks ago by Leo.
in reply to: Sending data to MCU from MPU via SPi #16518Hi Hmarthens,
I believe SPIComm.py/.service is the process that runs at startup that broadcasts the message to spi0, which keeps overriding your custom messages. U can either comment out the spidev.xfer2 part to mute the broadcasting or simply mv SPIComm.service out of /etc/systemd/system to stop the script from running at startup.
:)
in reply to: Sending data to MCU from MPU via SPi #16505Hey Hmarthens,
Glad you got basic SPI transmission working in such a short time.
spiFromPi shouldn’t have any “default value”. I suspect your Flexbench already has an SPI broadcasting script running at startup. You can check this tutorial for more information – https://www.audesseinc.com/resources/python/
In order to confirm this, you can
1. First type – <ls /etc/systemd/system>, to check is the Python script(myScript.py) and the .service file are located there
2. Then type – <top>, to see if you can find the corresponding Python process that is running.
3. If so, you can type <sudo systemctl disable myScript.py> to disable the script from running at startupLet me know if you run into any more issues.
in reply to: Sending data to MCU from MPU via SPi #16489Hey hmarthens,
Sorry for the late response. I wrapped up a quick Python script to send data to MCU from MPU via SPI. You need to install the Spidev module to run the script – https://pypi.org/project/spidev/. The script simply asks for user input and transmits it to the MCU side.
On the MCU side, the template Simulink model already has the SPI transfer setup. You should be able to get the data from the MPU side via the pre-defined user variable SPIFromPi and watch the received SPI data in FreeMaster.
I’ve attached the Python script and some screenshots for your reference.
- This reply was modified 1 year, 1 month ago by Leo.
Attachments:
You must be logged in to view attached files. -
AuthorPosts