System Generator configuration for Xilinx Co Simulation - simulink

I'm working on a cosimulation in simulink using either 2012a or 2011b, and System Generator 13.1. When building the library block for the hardware to be loaded onto the zynq fpga, I configure the system generator to be a 'Hardware Co-Sim,' everything through this step works. However, in the simulink/pc end of the simulation, I haven't found any good resources for how to configure. Am I correct in assuming it also should be set as a hardware co-sim and not some other setup (HDL netlist) or anything like that?
Currently, the system seems to be loading the block just fine, but the jtag library is missing, not sure if this is a sysgen issue, or software versioning issue. My understanding is that sysgen is still in beta for 2012a.
Thanks in advance.

Yes, it should be set as a hardware co-simulation (Your board->connection type).
Configuring of board occurs when You start simulation. (Or You can program it manually using Impact and next check "skip configuration" in block properties).

Related

stm32: How to configurate SWV on software part without autogenerated code, HAL or LL

I am currently working on a library that abstracts the use of a stm board (specifically the NUCLEO-H723ZG) and we are on the profiling phase. I did get to make the profiling with the SWV after a big headache with the SB26 bridge that comes with the aforementioned board, using the auto generated code from stm32cubeIDE.
Now i need to do the same but abstracting the auto generated code from the stm32cubeIDE into a method that does all the configuration for you, but i cannot pin point what is really missing. I already have copied the SystemClock config, the PeriphCommonClock config, both SCB_Enable Cache and the MPU_Config (and yes both are using the same copy of the ioc configuration). Any ideas of what i could be missing?
I tried to profile an autogenerated main.c and after some configuration it worked perfectly.
Then i tried to do the same with a main.cpp and copying the methods form the autogenerated main one by one (just to see whose were needed) and after copying them all it didn t work. The code executes and the live expressions work. The configurations are the same on the .ioc and the debugging.
I m now looking for the minimum necessary for an SWV configuration method, preferably non dependant from HAL.

Export CUBE IDE's SFR tab registers to text file to compare driver implementation using HAL and directly by register

I'm doing memory optimization and replacing the HAL implementation with commands that directly change bits in registers. To validate these changes, I'm changing the functions, debugging and putting the breakpoint after the function is executed, then taking snapshots of the peripheral registers through the SFR (Special Function Registers) feature of the CUBE IDE.
These snapshots are made with printscreen, my intention would be to snapshot with a log file, export all registers in a text file to use a difference program analyse. I do this for both the code using HAL and my version, then I can validate if it is stable, assuming that if the registers are equally configured, everything will work as expected.
See some sample:
implementation direct in register
implementation using HAL lib
I discovered a software (winIDEA Community Edition) that has this functionality to export to text file, it needs a little maintenance, last release was made in 06/2020. Using the examples themselves I had some problems, including one of them the software breaks and closes.
winIDEA Community Edition exporting SFR option
Does anyone have an alternative? Eclipse plugin or even a third-party tool that debugs with stlink and captures register values.

EnergyPlus FMU in Simulink

I am trying to integrate a building modeled in EnergyPlus inside Simulink.
Wanting to start simple I began from the example files provided by the developers of the .fmu software LINK and successfully generated a .fmu file of a building.
I then designed a simple simulink software to test the integration but I experience immediate crashes every time I try to run the program, I don't receive any error message to use as clue for debugging.
Has anyone already tried this kind of integration?
I am working on a Windows10 machine, with Matlab r2016b, EnergyPlus 8.6 and EnergyPlusToFmu 2.0.2.
I would recommend to run the FMU Compliance Checker (from https://www.fmi-standard.org/downloads) on the FMU.
If no errors are found, you should contact the Mathworks support, otherwise the developers of EnergyPlus2FMU.

Simulink how to reproduce code generation bugs

I am interested in reproducing a Simulink bug reported in their official site. The bug is marked as a code generation bug. From my limited understanding, Simulink generates code when run in accelerator or rapid accelerator modes. Alternatively, I can generated code using Code > C/C++ Code > Build Model menu option but I do not now how to "run" this code in my Desktop computer.
To reproduce this bug (and possibly all other bugs categorized as code generation bugs), will it be sufficient to run simulation in these modes (accelerator or rapid accelerator mode) where Simulink generates code? Once the code is generated (in a directory called "slprj"), will these code suffer from the bugs reported?
Or, should there be any other approaches for generating code to reproduce this bug? I have never used the code generation feature of Simulink and only know that I can generate code for a model using "Code" menu (Code > C/C++ Code > Build Model). For this particular bug, I was able to use the above menu options and generated code (not in "slprj" directory, in a different directory which has _ert_rtw prefix). Should I inspect code in this directory? Also, I would like to know how to run this code to reproduce the bug.
Thank you for any advices!
This bug seems to be a missing initialization in the generated code which you can verify by investigating the generated code. Try to reproduce in the model attached to this bug report. However, in order to check the correctness between the model simulation result and the generated code, I would recommend using SIL based testing which is described here:
https://in.mathworks.com/help/ecoder/examples/software-and-processor-in-the-loop-sil-and-pil-simulation.html

Arduino stepper motor control with Simulink

Hi Im quite new in Arduino and electronics so bear with me.
I have a project to control a step motor using Matlab and Simulink. For now I just want to get the thing up and running. I have hooked up the schematic tested it with a simple code for a step motor and it works (this has been done without Matlab). My problem is how can i get the motor to run using Simulink and Matlab?
When i try to Run the Simulink model i get this
My step motor driver board is ULN2003APG and my motor is
.
I have downloaded the Arduino Hardware Support Package for Matlab and have already uploaded the server program to Arduino to enable communication between Matlab and Arduino.
I have no idea what might be causing the error that i get. Any help would be greatly appreciated!
If there are any existing guides or any examples covering such topics u can redirect me to them.
(If there is a need to write a new driver for the board please send me some tutorial where I can read about that.)
Thanks in advance.
EDIT!
Here are step by step the things that I do to try and get my Simulink model to run:
1: Complete the steps in this tutorial.
2: Download MATLAB Support Package for Arduino.
3: Connect the arduino uno to PC, open the Arduino IDE and upload adioes.pde from step 2.
4: Open Matlab change working path (if not it gives an error)
5: Open existing example from downloaded MATLAB Support Package for Arduino ...\ArduinoIO\examples\stepper_sim.mdl
6: Change COMPORT and click Tools/Run on Target Hardware/Prepare to run and after that Tools/Run on Target Hardware/Run
After that I get my error.
Here is a nother image of the simulink model:
From your file name it looks like you have downloaded this from a file exchange submission "MATLAB Support Package for Arduino (aka ArduinoIO Package)". Based on one of the comments in that submission this package does not support code generation. It can be run only using Simulink "normal" mode. For other targets which require code generation you need tlc files and you will see this error.
I believe the error window already tells you what is the problem. You need to move the file msfun_arduino_io_setup.tlc to you project's working directory. We can only have this much sight in your project with what you have given to us. If there is, you need to give more information, for instance SS of your Simulink Model.
Besides all, I suggest you to download Arduino Support Package and other add-ins, extensions and files from Matlab itself if you can.
I've finaly managed to get the stepper motor running using Simulink. Unfortunately I had to change the driver board to do that. It seems there isn't a driver from Matlab for this board or it's just not compatible (not sure).
I've bought an adafruit motor shield v2 and things worked perfectly. It no longer give's that error about a missing .tlc file.
Cheers !