• AVR Freaks

Helpful ReplySimulink: Trying to run PIL example 'Temperature'

Author
Viktor1988
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2017/08/01 03:28:45
  • Location: 0
  • Status: offline
2017/08/03 04:38:55 (permalink)
0

Simulink: Trying to run PIL example 'Temperature'

Hello,
 
I’m trying to run the processor in the loop (PIL) using MPlab module for Simulink.
My first exercise was to run the example “ProcessorIntheLoop_PIL”, which is provided in the blockset. The processor I have is “DSPIC33FJ128MC506A”. The cable I’m using for communication is from FTDI USB to TTL.
The steps I did were to make a copy of the example and change processor and oscillator frequency in the SUB model (see pictures below).
 
After that I went to the top level and after following the instructions to set UART port I ran the simulation.
Unfortunately while the simulation ran I get the following error:
### Build procedure for model: 'Microstick_II_PlusDevBoard_33EP128MC202_Temperature_PIL_Sub' aborted due to an error.
Warning: The generated code is instrumented but instrumentation should probably be desactivated.
Cannot propose to program chip from Matlab: Either file Microstick_II_PlusDevBoard_33EP128MC202_Temperature_PIL_Sub.elf does not exist or MPLAB X API is not available on this system.
***** Error detected. Links above are provided for debug purpose only (.elf file might not be current).
 
The project used for the example is attached as "TemperaturePIL.zip". Modifications of the block to support the processor I'm using are shown in "PILsettings.jpg" and MasterConfigParameters.jpg". Full report of the simulation can be found in "Microstick_II_PlusDevBoard_33EP128MC202_Temperature_PIL_TOP_simulation_20170801_134258.txt"
 
Do you know what the error is and how to fix it.

Attached Image(s)

#1
Lubin
Moderator
  • Total Posts : 350
  • Reward points : 5
  • Joined: 2007/03/31 07:38:15
  • Location: Bayonne, France
  • Status: offline
Re: Simulink: Trying to run PIL example 'Temperature' 2017/08/04 01:52:48 (permalink) ☄ Helpfulby Viktor1988 2017/08/09 09:36:01
0
Hi Viktor,
 
From the report you attached, error stoping compilation is a file not found.
Possible root cause for this file not found:
 
Looking at generated makefile (Microstick_II_PlusDevBoard_33EP128MC202_Temperature_PIL_Sub.mk) 
34: MATLAB_ROOT = D:/Program Files/MATLAB/R2016b
35: ALT_MATLAB_ROOT = D:/Program Files/MATLAB/R2016b

 
while ALT_MATLAB_ROOT is supposed to be the 8dot3 shortened path like: D:/PROGRA~1/MATLAB/R2016b
 
We find-out that some windows setup disable the short path-name for some drive. (see post: http://www.microchip.com/forums/FindPost/997458)
 
 
  1. Please install the latest patch for the V3.39. It includes one fix making the standalone model compilation more robust to "long path name" problems. http://www.microchip.com/forums/FindPost/1007970
  2. for PIL compilation, problem is likely not to be solved with the patch.The only solution is either
    1. Installing matlab in a folder with no space, or alternatively
    2. Activating short path name for at least your D:/Program Files/ folder. (instruction given in the post: http://www.microchip.com/forums/FindPost/997458)
 
2.2) should be the solution.  
Do you have any clues why your system had 8dot3 names desactivated on your D: drive ?
 
Lubin
 
PS: one this problem is solved, you might get the following error message because the model were saved with Matlab R2012b and you're using R2016b. You need to go to model properties to set both values to 16.
The setting for the property 'size_t' is '32' for the parent model and '16' for the referenced model.
The setting for the property 'ptrdiff_t' is '32' for the parent model and '16' for the referenced model.

 
#2
Viktor1988
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2017/08/01 03:28:45
  • Location: 0
  • Status: offline
Re: Simulink: Trying to run PIL example 'Temperature' 2017/08/09 09:42:41 (permalink)
0
Hi Lubin
 
Thank you for your feedback.
 
After following the steps from your post I managed to run the example. My next task is to modify it so that I can send/receive data between the computer and the processor.
 
To do that I created a PILblink project. Unfortunately when I ran the simulation the following error occurred (full log file attached below named "TopLevel_simulation_20170809_132617.txt"):
 
Unfortunately I also do not have permissions to upload additional files in this thread so I put them elsewhere - http://dox.bg/files/dw?a=57f78b3d88
 
Pause 1s for Target to start before starting simulation...
Error:The timeout of 10 seconds for receiving data from the rtiostream interface has been exceeded. There might be multiple reasons for this failure.
You should:

(a) Check that the target hardware configuration is correct, for example, check that the byte ordering is correct.
(b) Confirm that the target is running.
(c) Consider the possibility of application run-time failures (e.g. divide by zero exceptions, incorrect custom code integration, etc.).

Note (c): To identify possible reasons for the run-time failure, consider using SIL, which supports signal handlers and debugging.

If you cannot find a solution, consider using the method setTimeoutRecvSecs of rtw.connectivity.RtIOStreamHostCommunicator to increase the timeout value.

The example is attached below "PILblink.zip".
 
Do you know the reason for this issue? I can verify that the simulation started successfully for the original example.
 
P.S: In order to achieve 2.2 from your comments I needed to log log in Safe Mode, otherwise an error "Access denied" was shown when I entered "fsutil file setshortname "D:\Program Files" PROGRA~1". The OS I'm using is windows 10
 
Regards.
#3
Lubin
Moderator
  • Total Posts : 350
  • Reward points : 5
  • Joined: 2007/03/31 07:38:15
  • Location: Bayonne, France
  • Status: offline
Re: Simulink: Trying to run PIL example 'Temperature' 2017/08/09 12:07:06 (permalink)
0
Hi Viktor,
 
UART setting is not ok.
- Use a Circular Buffer for Tx with a priority > 2
(5 is good choice as the blockset benefits from shadow registers when available on the chip with this priority only)
- Use Rx priority > 2 as well (5 is good choice again).
Try for both Rx & Tx a 256 bytes length buffer.
 
Don't you have on your board an external oscillator or crystal ? It so, use it instead of the internal RC oscillator which is likely prone to variations.
 
If it's not Ok, you might find on the forum many test you could perform to validate the board is working fine with the generated model, check the UART with a hyperterminal etc...
 
Lubin
#4
Jump to:
© 2019 APG vNext Commercial Version 4.5