In case anyone is following.... On the above, worked on the new boards (at least the 2 out of 3 I have tried). It still does not work on my original board. Maybe it has a different firmware...
Will soon create new thread about making a version of the Phantom_Phoenix code base for the OpenCM board. I do have a working version of my AX12_Test program, that was converted to use the DynamixelSDK code. It currently defaults to working with servos on Serial3, but can switch to Serial1. I will probably make the version of the Phoenix code work with servos on either.
Probably more of a comment for other thread, but I soldered together one of the 904a boards with the normal AX servo headers and have it plugged into the 485 board... The servos don't work yet as no Servo power is brought back from 485 board to 904 board. Need to setup some form of jumper...
Next question/observation: The Arduino core files installed with the Arduino setup (from #1), do not install the actual core source files, they only install the header files... So I am assuming the build uses some form of pre-built archive in their builds. I found this out when some of my core hung (trying to initialize XBee).
Code:
while (Serial2.read() != -1) ;
Note: I believe this code works for the USB serial (change Serial2 to Serial)
When I looked in where Arduino was installed:
C:\Users\kurte\AppData\Local\Arduino15\packages\Op enCM904\hardware\OpenCM904\1.0.0\cores\arduino
There were only header files...
I looked up on github and I believe found the sources and releases at: https://github.com/ROBOTIS-GIT/OpenCM9.04
I believe their code is wrong:
The UARTClass.cpp code for read is:
Code:
int UARTClass::read( void )
{
rx_cnt++;
return drv_uart_read(_uart_num);
}
And the drv... code:
Code:
int drv_uart_read(uint8_t uart_num)
{
int ret = -1;
int index;
index = drv_uart_rx_buf_tail[uart_num];
ret = drv_uart_rx_buf[uart_num][index];
drv_uart_rx_buf_tail[uart_num] = (drv_uart_rx_buf_tail[uart_num] + 1) % DRV_UART_RX_BUF_LENGTH;
return ret;
}
No where does the code check for queue being empty...
I obviously can/will work around this by doing something like:
Code:
while (Serial2.available()) Serial2.read();
But thought I would post this, in case anyone else was interested where source files are, or runs into a hang like this.
Edit: Also found that this causes code like:
Code:
XBeeSerial.print(F("+++"));
XBeeSerial.flush();
XBeeSerial.setTimeout(20); // give a little extra time
if (XBeeSerial.readBytesUntil('\r', ab, 10) > 0) {
To fail as the read buffer type commands in stream.cpp called timedRead which
Code:
int Stream::timedRead()
{
int c;
_startMillis = millis();
do {
c = read();
if (c >= 0) return c;
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}
When the queue is empty will always return something. Whatever happened to be leftover in the queue from the previous usage of that queue (or 0 if first time through)
Bookmarks