Why am I getting "Internal error: The initialization of the server code is incorrect" while trying to connect Arduino Mega2560 with MATLAB?
    35 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    MathWorks Support Team
    
 el 28 de Abr. de 2020
  
    
    
    
    
    Respondida: MathWorks Support Team
    
 el 28 de Abr. de 2020
            Why am I getting "Internal error: The initialization of the server code is incorrect" while trying to connect Arduino Mega2560 with MATLAB using "arduino" command on Windows 10?
Respuesta aceptada
  MathWorks Support Team
    
 el 28 de Abr. de 2020
        This issue might occur if the hardware is not getting reset correctly because of the smaller delay time.
The issue can be resolved by changing the "delayValue" to 10 in "getResetDelayHook()" in "arduino.m". The file can be found by executing the following code snippet in the MATLAB Command Window:
which -all arduino
The code for the method getResetDelayHook() in "arduino.m" looks like the following:
function delayValue = getResetDelayHook(obj)
  % workaround for Arduino Mega on Linux taking longer time to reset, explained in g1638539
  if(obj.ConnectionType==matlabshared.hwsdk.internal.ConnectionTypeEnum.Serial)
    if ispc || ismac
      delayValue = 2;
    else
      delayValue = 10;
    end
  else
    %The reset on the DTR line is via Serial only
    delayValue = 0;
  end
end
Change the value of delayValue inside the if statement (if ispc ismac) to 10. This will give the board more time to get reset and after that connection can be established.
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
