always get zero for Status and Valid for encoder
-
- Posts: 12
- Joined: Mon Aug 31, 2015 8:00 am
always get zero for Status and Valid for encoder
I always get zero for Status and Valid when I call for an encoder value on channel one using two-way serial with arduino. Channel two works fine with the same encoder hooked to it. I can see channel one increment and decrement the value for encoder one channel but Status and Valid are always zero which doesn't allow me to filter out bad values.
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: always get zero for Status and Valid for encoder
Please provide your code.
Also what do you mean by valid(I assume bit 8, 0x80, of the status byte). If so that bit is always set on xmega based Roboclaws. On older(much much much older) Roboclaws we had separate quadrature decoders so we had to know if the decoder was working correctly or not. It is now always set to 1 for backwards compatibility.
Also what do you mean by valid(I assume bit 8, 0x80, of the status byte). If so that bit is always set on xmega based Roboclaws. On older(much much much older) Roboclaws we had separate quadrature decoders so we had to know if the decoder was working correctly or not. It is now always set to 1 for backwards compatibility.
-
- Posts: 12
- Joined: Mon Aug 31, 2015 8:00 am
Re: always get zero for Status and Valid for encoder
I am using a version5 board with the latest firmware.acidtech wrote:Please provide your code.
Also what do you mean by valid(I assume bit 8, 0x80, of the status byte). If so that bit is always set on xmega based Roboclaws. On older(much much much older) Roboclaws we had separate quadrature decoders so we had to know if the decoder was working correctly or not. It is now always set to 1 for backwards compatibility.
I am running your example code: PacketSerialEncoderSpeed.ino
I am using a Mega with UART pins.
for valid and status I am talking about your valid flag and status flag in your code:
Code: Select all
uint32_t enc1= roboclaw.ReadEncM1(address, &status1, &valid1);
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: always get zero for Status and Valid for encoder
We just updated everything(Sunday 10/11/2015), IonMotion, Roboclaw firmware and Arduino libraries so you should update your files. I recommend you grab the new arduino files, update your firmware using IonMotion and check this example again to see if you still have any trouble. We use Arduino 1.0.5 to test all the examples and newer arduino IDEs should also work.
The main change is we have changed to a CRC16 checksum. The arduino libraries have been updated to better handle communicaitons errors. The valid1 returning 0 indicates a communications error, not any kind of hardware error(eg either the return data timed out or the checksum came back incorrect).
The main change is we have changed to a CRC16 checksum. The arduino libraries have been updated to better handle communicaitons errors. The valid1 returning 0 indicates a communications error, not any kind of hardware error(eg either the return data timed out or the checksum came back incorrect).
-
- Posts: 12
- Joined: Mon Aug 31, 2015 8:00 am
Re: always get zero for Status and Valid for encoder
Working much better so far. I haven't completely regression tested but so far it is looking very good. Thanks!