Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- .... I don't know if you code does it, but before the SPI-3 (SPI-4 on DE0-nano is impossible) you must change a register value, because the default communication SPI is 4, as you don't have 4 pins, you must communicate through I2C, reconfigure the register, so the SPI-4 become SPI-3. --- Quote End --- No, this should not be necessary. If you look at the SPI-3 vs SPI-4 protocol, the Write would be the same so you should be able to configure 0x31 to 3-wire SPI via SPI and then do all your reads in 3-wire mode. The only trick is that there is another I2C device on the same bus on the DE0 Nano board, so you must structure your SPI communications so that you do not trigger an I2C Start or Stop frame. I have done this and can successfully read the DEVID register via SPI. I am not familiar with Verilog, so I don't know if all Verilog is like the sample or they are just particular bad coders, but I couldn't really follow the sample either, so I wrote my own version from scratch in VHDL. I have generic modules to read/write via SPI so it now should be a relatively short matter to configure all the registers I need to read all 3-axis and grab the data.