- In Simulink, you can use MATLAB Function blocks to write custom C code that interacts with the PS registers directly. In this way, you could set MIO pins configured as GPIO without needing to go through the PL.
- You would need to use memory-mapped I/O register addresses for the GPIO configuration. By embedding C code into Simulink via MATLAB Function blocks or S-Function blocks, you can control these registers to set the MIO pin state.
- Create your Simulink model for the Zynq platform using the Embedded Coder support package for Xilinx devices.
- Use blocks from the Zynq library to interface with the PS, but direct control of MIO pins might not be available directly from Simulink blocks.
- Use Embedded Coder to generate C code for the processing system. This code will be integrated into the ARM processor on the Zynq.
- Once the code is generated, you may need to manually modify it to include control over the MIO pins. This involves adding specific register writes to control the GPIO settings.
- You can do this by editing the generated C code to include the necessary GPIO configuration and control commands.
- After modifying the code, you can use Xilinx SDK (or Vitis) to compile and deploy the application to the Zynq board.
- In your C code, make sure to include the necessary Xilinx libraries and headers that facilitate GPIO control.
Is it possible to control Zynq PS MIO using Embedded Coder?
36 views (last 30 days)
Show older comments
As far as I can tell Simulink will only let you control signals that go through AXI to the PL. Can you control the MIO pins that are directly connected to the PS system using a Simulink model and the generated files from Embedded Coder.? For example, I want to set MIO0 configured a GPIO to HIGH. Will I need to use Xilinx Vitis to do this directly?
0 Comments
Answers (1)
Kothuri
on 6 Nov 2024 at 13:57
Hi Martin,
Simulink primarily interfaces with AXI-connected peripherals on the PL (Programmable Logic) side.
You can try the below approaches to control MIO pins directly from the PS (Processing System):
You can refer the below link for more info on “S-function” and “MATLAB function” blocks
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!