04-14-2019 12:42 PM
I write a simple program to red a MPU 6050 using and Arduino Mega 2560 and the LINX library, I also include in the same the blocks to control two servo motors, but when I execute it it runs well for a while but after some time it fails and throws the error:
Error 5001 occurred at :
Read.vi >>
I2C Read.vi >>
I2C Read.vi >>
Send Command.vi
Possible reason(s):
A timeout occurred while waiting for the Arduino Mega 2560 to respond
And I couldn't find a solution for this, I already changed the pins and still fails
Here is the VI
VI
Front panelI also tried to change the baud rate but still getting the same message, the only way I didn't get the message was deleting the open servo block, but without it I couldn't write the signals to them.
If a execute it in separated programs, I don't get the error only when I place all the blocks together.
04-14-2019 09:58 PM
Error 5001 is typically a "User-generated Error" -- when I am writing a VI and discover an error condition (like "This Device's Attribute, which is supposed to be writeable, is Read-Only"), I've used Code 5001 to signal it. This suggests that the Error comes from one of the "foreign" VIs in your example, whose details we can't see. If you can open them, you can see which one throws this error, find out what causes it, and figure out how to avoid these conditions.
If you need more help, attach the other VIs.
Bob Schor
04-15-2019 05:05 PM
Hi jafetrd!
Maybe your issue is related with your arduino configuration. I leave you the following information:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019SDeSAM
I hope it works for you!
04-16-2019 09:51 PM
I verify the pins and they are correct I'm using 6 and 7 in the Mega
04-16-2019 11:04 PM - edited 04-16-2019 11:11 PM
I also read it was about timing, and I use a wait function to sample slower but after some time i get the same error here I attach the VI, and also change the Baud rate for something faster I tried 9600, 14400,19200, still got the error and change the configuration in the port as shown in the image
04-17-2019 08:39 AM
@jafetrd wrote:
I also read it was about timing, and I use a wait function to sample slower but after some time i get the same error here I attach the VI, and also change the Baud rate for something faster I tried 9600, 14400,19200, still got the error and change the configuration in the port as shown in the image
The VI you attached shows a Baud rate of 115200 ...
When you get the 5001 Error, does it say what VI or function throws the Error? Can you attach that VI so we can inspect it and see precisely what is causing the error?
Bob Schor
04-17-2019 08:53 AM
No it doesn't say which block caused the error, it only prints the error I previously mentioned, and here is the VI
04-17-2019 09:50 AM
I also made this simpler VI only reading the MPU sensor without writing any signal to the servo motors, and I didn't get any error, so I'm believe the error is inside the servo blocks but I can't find it, and I really need to write to the servos, here I attach the simplified VI
04-17-2019 02:06 PM
OK, not only did I open your VI, but I broke down and downloaded/installed the LINX library. And might have found your answer.
The very first function in your code, you wired 14400 into the Baud Rate Override input. Diving into the Diligent code, I found the following: "When specified, allows the user to override the default baud rate used for serial communication. By default LINX establishes communication using a baud rate of 9600 and then negotiates for the remote LINX device's maxiumum supported baud rate and re-establishes communication at that maximum rate. If a Baud Rate Override input is provided it will be maximum baud rate used. This is useful when using UART abstractions that are not able to change baud rates on the fly (Xbee for example)."
If I choose to believe this comment, you are locking your Arduino interface into using a pretty slow Baud Rate, and, more important, not letting it determine for itself an optimal Baud Rate.
Try deleting this constant and see if that helps. Let us know ...
Bob Schor
04-17-2019 02:43 PM
I delete the baud rate constant but still getting the same error