"Response from instrument was empty" error

3 visualizaciones (últimos 30 días)
Denizcan Koc
Denizcan Koc el 7 de Jul. de 2022
Respondida: Abhishek Chakram el 26 de Dic. de 2023
Hello there,
I am using "Query Instrument" and "Serial Send" commands in the same simulink. Query Instrument is for taking the data of depth sensor which is connected to arduino. Serial Send is to send the signal to another arduino which provides input for DC motors. Whenever I run the simulation, I get "Response from instrument was empty" error after a while. If I comment out the query instrument and give step input, it works well. If I keep query instrument and just turn off the power generator for dc motors, simulation is also working well. However, when both comments are in the simulation and power generator is running, I get the error. I have tried to adjust time steps, it is changing the time to get the error but it cannot eliminate the error fully, I have also tried using different power generators. I will be glad if you have a chance to help me with that error.

Respuestas (1)

Abhishek Chakram
Abhishek Chakram el 26 de Dic. de 2023
Hi Denizcan Koc,
It appears to me that you are getting an empty response when both the "Query Instrument" and "Serial Send" commands are active in the Simulink model. The simultaneous operation of querying a depth sensor and sending commands to control DC motors via separate Arduinos is causing a conflict, resulting in an empty response error in Simulink. Here are few steps to troubleshoot and resolve the issue:
  1. Check Serial Configuration: Ensure that both the "Query Instrument" and "Serial Send" blocks are correctly configured with the appropriate COM port settings, baud rates, data bits, etc. Mismatched settings can cause communication problems.
  2. Dedicated Serial Ports: If both blocks are using the same serial port, consider using separate serial ports for each Arduino if possible. This would prevent the commands from clashing over the same communication channel.
  3. Synchronization: Implement a synchronization mechanism to ensure that "Query Instrument" and "Serial Send" are not trying to access the serial port at the exact same time. You can use a state machine or a semaphore-like system to control access to the serial port.
  4. Error Handling: Add error handling in the Arduino code to manage incomplete or corrupted data transmissions. This can help to prevent the simulation from failing when there are communication errors.
  5. Simulink Execution Order: In Simulink, you can control the order in which blocks are executed. Make sure the execution order is set in a way that allows the serial communication to be handled correctly.
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by