Annoying bug

From BitWizard WIKI
Revision as of 17:24, 9 January 2013 by Rew (talk | contribs)

Jump to: navigation, search

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 can be done in one SPI transaction of only one byte extra.

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.

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#