This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS20216: PIL setup for TMS570

Part Number: TMS570LS20216
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am trying to run a PIL simulation in Matlab Simulink ( Matlab 2017a) with an TMS570 MCU development kit .However, after following all the instructions for PIL setup settings required for TMS570 , I get an error message (Timeout problem ) in Matlab Command window as  described below and I have tried  commenting out the SCIInit() function in the rtIOStream close function - but I have the same error. 

Please your support

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

"### Creating standalone executable "ex1_fir_mdl.out" ..."
C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl -z -m"TI_HerculesPilSerial.map" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/lib" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --rom_model --stack=0 --be32 "C:/TI_Hercules_PIL_Target_for_RM48/code/src/MY_HERCULES\halcogen\source\sys_link.cmd" --output_file=ex1_fir_mdl.out xil_interface_lib.obj xil_data_stream.obj xil_services.obj xil_interface.obj xilcomms_rtiostream.obj xil_rtiostream.obj rtiostream_utils.obj coder_assumptions_app.obj coder_assumptions_data_stream.obj coder_assumptions_hwimpl.obj ex1_fir_mdl_ca.obj coder_assumptions_rtiostream.obj pil_main.obj adc.obj can.obj esm.obj gio.obj het.obj notification.obj rti.obj sci.obj spi.obj sys_phantom.obj sys_startup.obj system.obj sys_core.obj sys_intvecs.obj sys_memory.obj sys_mpu.obj sys_pmu.obj TI_RM48HDKSerialRtiostream-Rtiostream.obj xil_instrumentation.obj codeinstr_data_stream.obj codeinstr_rtiostream.obj C:/Users/Al/Desktop/TI_Hercules_PIL_Target_for_RM48/code/examples/slprj/ert/ex1_fir_mdl/pil/../instrumented/ex1_fir_mdl_rtwlib.lib "C:/ti/ccsv5/tools/compiler/arm_5.1.1/lib\rtsv7R4_T_be_v3D16_eabi.lib"
<Linking>
"### Created: ex1_fir_mdl.out"
"### Successfully generated all binary outputs."
gmake: Leaving directory `C:/Users/Al/Desktop/TI_Hercules_PIL_Target_for_RM48/code/examples/slprj/ert/ex1_fir_mdl/pil'

C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\examples\slprj\ert\ex1_fir_mdl\pil>exit /B 0
### Starting application: 'slprj\ert\ex1_fir_mdl\pil\ex1_fir_mdl.out'
Begin communication with RM48
Launching loadti to download C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\examples\slprj\ert\ex1_fir_mdl\pil\ex1_fir_mdl.out
Launcher command string: C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\utils\loader\loadti
Launcher command arguments: C:\ti\ccsv5\ccs_base\DebugServer C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\utils\loader -r -a -c "C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\src\MY_HERCULES\TMS570LS20216SPGE.ccxml" -x "C:\Temp\tp9fc38eaf_cc2c_47b1_9f15_1a2292033aae_loadti_log.xml" "C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\examples\slprj\ert\ex1_fir_mdl\pil\ex1_fir_mdl.out"
***** DSS Generic Loader *****

START: 12:40:59 GMT+0200 (MESZ)

Configuring Debug Server for specified target...
Done
TARGET: Texas Instruments XDS100v2 USB Emulator
Connecting to target...
CortexR4: GEL Output: Memory Map Setup for Flash @ Address 0x0
Resetting target...
testEnv.outFiles: C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\examples\slprj\ert\ex1_fir_mdl\pil\ex1_fir_mdl.out
Loading C:\Users\Al\Desktop\TI_Hercules_PIL_Target_for_RM48\code\examples\slprj\ert\ex1_fir_mdl\pil\ex1_fir_mdl.out
Done
Target running...
END: 12:41:15 GMT+0200 (MESZ)
Pausing 3 Seconds
Error using ex1_fir_filter (line 199)
Error due to multiple causes.
Caused by:
Error using ex1_fir_filter (line 199)
The timeout of 60 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. Error using
ex1_fir_filter (line 199)
Output argument "lSections" (and maybe others) not assigned during call to "coder.profile.ExecutionTime/get.Sections".


Thanks in advance.
Best Regards,

Hussein

  • Hello User,

    I have forwarded your question to one of our Matlab experts. They should respond soon.
  • Hello Chuck Davenport,

    I haven't received any response yet, please your support.

    Best Regards

    Hussein

  • Hello Hussein,

    My apologies for the delay. I will ping out Matlab expert again.

    In the mean time, have you had a look at any of the other threads on a similar topic?

    e2e.ti.com/.../355390
    e2e.ti.com/.../428846
    e2e.ti.com/.../587385
    e2e.ti.com/.../471051
    e2e.ti.com/.../528738

    There are also many other posts on similar topics which you can find by using the search bar and searching for PIL in the Hercules E2E.
  • Hello Chuck Davenport,
    Thank you for your reply, I have already seen all the posts on PIL setup.
    Unfortunately, I was unable to get the issue resolved.
    Best Regards
    Hussein
  • Hi Hussein,

    The PIL example was tested in Matlab and Simulink. Have you tried to compile and load the project to MCU flash using matlab/Simulink instead of CCS5.x?

    Regards,
    QJ
  • Hi Wang,
    Yes,the project was loaded and complied to MCU flash using MATLAB/Simulink and the error massage was displayed as above (my first post).


    Regards
    Hussein

  • Hi Ti Support team,
    I'm working seriously in executing the PIL package to success in TMS 570, please I need quick support to fix this problem.
    Regards
    Hussein
  • Hi Hussein,

    I need to find a matlab/simulink/coder license for me to generate the c/c++ code from the simulink model and related *.m files, and to do the test.

    Sorry for delay.

    Regards,
    QJ
  • Hi Wang,
    Have you found the matlab license?
    Best regards
    Hussein
  • Hi Ti Support team,
    This was one month ago, and till now, the problem is still not solved.
    Regards
    Hussein
  • Hi Ti Support team,
    i'm waiting for your feedback.
    Regards
    Hussein

  • Hello Hussein,

    Our license for Embedded coder and Simulink coder has been expired, and we haven't got them renewed. I am sorry. Your problem occurs at one simulink function: simOut = sim(model,ParameterStruct). The model of FIR Filter was tested by many users and Mr. Seely, so it should work well. Are you able to run a Simulink example on your PC?

    Regards,
    QJ
  • Hi Wang,

    The Simulink example is working  on PC but when I am trying to run a PIL simulation in Matlab Simulink  with an TMS570 MCU development kit, I get an error message (Timeout problem ),  I think the problem in  rtIOStreamRecv  which  is defined in TI_RM48HDKSerialRtiostream-Rtiostream.c, when I run the code  (CCS project) it goes to an infinite loop.  

    Can you have a look and check  the attachment (CCS project)?

    Regards

    Hussein2781.MySCI.zip

  • Hi Ti Support team,

    Can you have a look and check  the attachment (CCS project) in previous post?

    Regards
    Hussein

  • Hussein,

    There is a test program for the Rtiostream functions that are needed to support PIL.

    This is the file that is in TI_HERUCLES_RM48/src/TI_HERCULES_RM48PilSerial/TI_RM48HDKSerialRtiostreamTest.c

    So to use this, forget abut MATLAB for the moment.

    Just build a simple demo program for your board using the RTIO stream functions in TI_RM48HDKSerialRtiostream folder and use the TI_RM48HDKSerialRtiostreamTest.c as the top level program .. Of course you need to regenerate the HalCoGen folder for your 20216 and you need to maybe change the serial port # in the TI_RM48HDKSerialRtiostream files.

    Build this standalone, then run on the board and see if it implements a loop-back (ex open a terminal like putty on the virtual com port for the board and whatever you type in the terminal should echo back).

    Once that is working those same changes just stay in place for PIL. The PIL build will use the halcogen subdirectory and the TI_RM58HDKSerialRtiostream subdir but it won't include TI_RM48HDKSerialRtiostreamTest.c ... instead the Mathworks XIL layer for harnessing the DUT model will talk to Simulink over the Rtiostream layer.
  • Hi Anthony,

    i have did all the steps you mentioned (please see attached file 5556.MySCI.zip ) but when I run the code it goes to an infinite loop.

    Regards

    Hussein

  • The test program should be an infinite loop.

    Did you try attaching a terminal program like Putty to the COM port on your board that you want to use for Rtiostream and see if 'echo' is working?

    If it works - you should be ready to go to PIL at least for this part of the code. (Your loadti and emulation config may still need updating and there may be other issues... but the serial port part of the work will be done...)

    If it doesn't work as an 'echo' then you need to just treat it like debugging a simple 'echo' program on a UART.
  • The problem is when I run the test program  in debug mode and hold the soft after a while I realise that I am locked in the TI_RM48HDKSerialRtiostream-Rtiostream.c file and software blocked in the ''if (hbCount++ > HEARTBEATDLY)''  line of the TI_RM48HDKSerialRtiostream-Rtiostream.c file.  as shown in the figure below:

    Regards

    Hussein

  • Ok so the HEARTBEAT isn't the issue although you should probably define HEARTBEAT to 0 unless you want to fix the pins that map to the LED to blink.

    So you seem to be trying to use SCI1 - make sure that is the correct serial port for the board you are using.

    And make sure you open a terminal at the correct setting of 115200 baud ... (has to match the HalCoGen setup).


    You will *expect* to be sitting in the loop

            while ((sci->FLR & (uint32)SCI_RX_INT) == 0)
            {
                /* Wait */
    #if HEARTBEAT
                if (hbCount++ > HEARTBEATDLY)
                {
                    hbCount = 0;
                    gioToggleBit(hetPORT,0x1F);
                    gioToggleBit(hetPORT,0x01);
                };
    #endif
            };

    most of the time while you interrupt the processor because this is just polling the SCI.

    You should be able to set a breakpoint on the line after this one though:

    sciStat = sciRxError(sci);

    And hit that breakpoint after you press a key in the terminal.


    If not then something is wrong and you can start debugging like you normally would -- check that the SCI1/LIN1 control registers are configured correctly,
    check the SCI RX pin on the device when you press a key in the terminal program to make sure the character is getting to the device,  check the status bits to see if the character was received, etc..


    If you instead hit the breakpoint but the problem is that you don't see the character you type echoed back to you then you're looking for what is blocking the SCI transmit.
    Same sort of thing but look at the transmit side, try poking characters into the transmit buffer manually and seeing if you see the character come out the pin, if so then check the PC side of the connection ...

    COMMENT:  I would suggest fixing the pins so the LED blinks while waiting in receive.. but you might want to do this later after you get the SCI going ..  It's useful when you have simulink up to see the the program downloaded correctly and is ready to talk to simulink (as evidenced by blinky HEARTBEAT LED on your particular board.



  • Guys this is just a 'SCI Loopback' test now - nothing to do with Matlab except he's using the wrapper file that we put around transmit and receive to match the matlab API. Hopefully you can help him debug the SCI problem - i am not sure which board though...
  • The SCI test program is working properly,  but in  a PIL simulation in Matlab Simulink  I have this error message,

     I think the problem in rtIOStream close function.

    Please let me know your suggestions.

    Regards

    Hussein

  • Hussein,

    There was a problem in rtioStream close() - I put a call in the original pkg. to call sciInit() to reset the sci but this didn't work (HalCoGen side, you can only call sciInit() once) and

    the version of simulink I built on didn't call close().. they changed this and then the simulation would run but *after* the simulation ran you would get this error due to the call to sciInit() in close.

    But I thought you had sciInit() commented out in close... Anyway did your simulation run but just this error came up as the simulation completed?   Or did your simulation not run?

  • Anthony,
    i have set breakpoint to pause the execution of a matlab file (Launcher.m) and then step by step execution the MATLAB code after that, I have been running simulations without any problem!!!
    Just one more question: is possible to use this PIL tool with MATLAB Coder™ or just with MATLAB Simulink?

    Regards
    Hussein
  • Hi Hussein,

    Super!

    Sorry I've not tried w. Matlab coder - I think it should work but the whole flow from Matlab Coder -> Embedded Coder -> Target is a little different than from Simulink Coder and I didn't try it out so can't confirm but I think it uses the same underlying objects for PIL.