MATLAB: Does MATLAB crash when I copy from the “DMA from FPGA block” from Speedgoat HDL coder example “IO3xx_coprocessor_hdlc” to another model

realsimulinktime

I copy the "DMA from FPGA block" from Speedgoat HDL coder example in IO3xx_coprocessor_hdlc/DMA_Engine/IRQ_CPU_Calc_Enabled
to another model and trying to open it. This results in the crash below every time.
Stack Trace (from fault):
[ 0] 0x00007ff934351a32 C:\Program Files\MATLAB\R2017b\toolbox\rtw\targets\xpc\target\build\xpcblocks\thirdpartydrivers\sg_hdlcoder\sg_fpga_HDLCoder_io333_dmawrite_sf_1.mexw64+00006706
[ 1] 0x00007ff9343514f5 C:\Program Files\MATLAB\R2017b\toolbox\rtw\targets\xpc\target\build\xpcblocks\thirdpartydrivers\sg_hdlcoder\sg_fpga_HDLCoder_io333_dmawrite_sf_1.mexw64+00005365
[ 2] 0x00007ff934352b4b C:\Program Files\MATLAB\R2017b\toolbox\rtw\targets\xpc\target\build\xpcblocks\thirdpartydrivers\sg_hdlcoder\sg_fpga_HDLCoder_io333_dmawrite_sf_1.mexw64+00011083 mexFunction+00003723
[ 3] 0x00000000fc60234a bin\win64\libmex.dll+00140106 mexRunMexFile+00000314
[ 4] 0x00000000fc600d22 bin\win64\libmex.dll+00134434 mexFeature_mexver+00002146
[ 5] 0x00000000fc5ffab7 bin\win64\libmex.dll+00129719 mexUnlock+00028455
[ 6] 0x000000001b45ca93 bin\win64\pgo\m_dispatcher.dll+00117395 Mfh_file::dispatch_fh_impl+00000835
[ 7] 0x000000001b45c73e bin\win64\pgo\m_dispatcher.dll+00116542 Mfh_file::dispatch_fh+00000062
[ 8] 0x000000001b4a8f83 bin\win64\pgo\m_dispatcher.dll+00429955 mdAcquireMatlabFunction+00000279
[ 9] 0x000000001b4a93d4 bin\win64\pgo\m_dispatcher.dll+00431060 mdDoMatlabFcnCall+00000116

Best Answer

This is a bug within the Speedgoat code. The Speedgoat team is aware of it.
You may consider the following workaround. In the DMA block of the IO3xx_coprocessor_hdlc.slx example model, a variable frame_size is defined for the DMA transfer size mask parameter. Make sure that either the new model specifies such a variable (in model workspace or data dictionary) or alternatively change the mask parameter to e.g. 1024 before copying it into the new model.