Annoying bug
Earlier versions of the I2C versions of RPI_UI and DIO had an annoying bug in the firmware.
- Dio 1.3 has fixed firmware.
- RPI_UI 1.3 has fixed firmware.
The bug in dio manifests it self as follows: When you write the value 0x1234 to the nsamp register (0x81) with the value 0x1234 TWICE, the value 0x3412 is read back.
his means that as a workaround for this board, you should byteswap the value you want and then write it twice. This could be done in one I2C transaction of only one byte extra (send address, register address, highbyte, lowbyte, highbyte). Or: Send a dummy byte between the register address and the lowbyte.
In rpi_ui the lower 8 bits will always remain 0x00. So after writing 0x1234 twice, you'll see 0x3400 in the register. This means that you have the choice of using 0x40, the default (i.e. do not touch the register at all) or use a multiple of 0x100. (the lowbyte will always be ignored anyway, so the shortest way is to just send the highbyte. Or you can treat it the same as i2c_dio above: send three bytes).
Luckily this is only an issue for the nsamp register. Version 1.3 and further have this problem fixed.
Example with an I2C rpi_ui with the bug:
raspberrypi:/home/pi# bw_tool -I -a 94 -W 81:1234 raspberrypi:/home/pi# bw_tool -I -a 94 -W 81:1234 raspberrypi:/home/pi# bw_tool -I -a 94 -R 81:s 3400
Example with an I2C dio with the bug:
raspberrypi:/home/pi# bw_tool -I -a 84 -R 81:s 0040 raspberrypi:/home/pi# bw_tool -I -a 84 -W 81:1234 raspberrypi:/home/pi# bw_tool -I -a 84 -W 81:1234 raspberrypi:/home/pi# bw_tool -I -a 84 -R 81:s 3412 raspberrypi:/home/pi#