I am having some trouble getting the C libraries to communicate with the LEGO NXT motors and sensors.
I followed the BrickPi setup instructions on line faithfully. I downloaded and installed the latest image on my flashdrive.
init_uart_clock verified according to the set up instructions.
I am using a 9V battery pack in addition to the microUSB power.
All updates applied using sudo apt-get update and sudo apt-get upgrade. All updates successful with BrickPi_c/Scripts/brickpi_c_debug.sh. All updates successful with "DI Software Update"
I verified the ports of the sensors and motors against the code before running it.
What is working?
BrickPi_C/Sensor_Examples/LED_test.c - Works
All python sensor and motor examples are working.
All the other C sensor and motor tests and simplebot_simple.c fail with:
Additional testing showed that the underlying error is BrickPiRx: -2. I read the information in the BrickPi.h file, but did not see any suggestions for how to correct the problem. Can someone please point me in the right direction to correct the problem?
A known cause for “BrickPiRx error: -2” is the RPi splitting the UART message. Sometimes the RPi will send e.g. 3 bytes, wait a
- while, and then send 4 more, when it should have just sent 7 at once. During the pause between the packs of bytes, the BrickPi
- microcontrollers will think the transmission is complete, realize the message doesn’t make sense, throw it away, and not return
- a message to the RPi. The RPi will then fail to receive a message in the specified amount of time, timeout, and then retry the
Thank you for your help!