Discussion:
USB-8451 SPI Read/Write MOSI
(too old to reply)
johu
2008-08-13 20:40:07 UTC
Permalink
I have a USB-8451 that I am using for SPI communications. The USB-8451 is the master device, and I have no problem sending and recieving data. The problem is that I cannot send what I want to with the USB-8451. When I execute a read command for 16 bit data, the USB-8451 sends 0x0300. I need to send certain commands over SPI in order to get the correct response; ie - send 0x1000, 0x2000, 0x3000, etc. I have not found a way to do this, and it is very critical that I am able to for this project to work correctly. Any suggestions?  
muks
2008-08-14 13:40:17 UTC
Permalink
Have you gone through <a href="http://digital.ni.com/public.nsf/allkb/7E9C89D8D59AEE95862571FB0074B61F" target="_blank">this</a> thread that explains 16 bit data transfer?
johu
2008-08-14 13:40:20 UTC
Permalink
It's not an issue of communicating over SPI, the data bit size, or getting data back. I am using the USB-8451 as the SPI master. I want it to write a 4 bit opcode (0x1-0xF) and complete the 16 bit transfer with zeroes (i.e. 0xB000). It seems that the EEPROM on the USB-8451 requires OpCodes (0x3 or 0x4). It sends over the MOSI line 0x0300 or 0x0400 (up to 0x0BFF). I don't want it to send that data over. I want to format the 16 bit data that it sends on its MOSI line as stated above. The opcodes signify a different operation and returned result from the Slave device, so it is critical that it works this way.&nbsp;&nbsp;
O_Proulx
2008-08-15 16:40:19 UTC
Permalink
Hello Johu,&nbsp;You only need the <a href="http://joule.ni.com/nidu/cds/view/p/id/861/lang/en" target="_blank">LV 8.5 runtime </a>to run the executable. &nbsp; &nbsp;I attached the 8.0 version of the VI.&nbsp; Let me know if you have any questions.&nbsp;


845x Test Panel.vi:
http://forums.ni.com/ni/attachments/ni/170/349656/1/845x Test Panel.vi
O_Proulx
2008-08-14 16:40:05 UTC
Permalink
Hello Johu,&nbsp;The SPI Read Write vi has a data write input which takes in an array of bytes.&nbsp; If you want to ONLY read 16 bit, you have to put an array of 2 bytes which are 0.&nbsp; Since SPI is a full duplex protocol, it will send 0x00 0x00 and receive 16 bits at the same time. &nbsp;&nbsp;Usually, you send a command before reading.&nbsp; So, you would send a total of three bytes, the first one being your command.&nbsp; The first byte returned would not contain any data, since your device is reading the command.&nbsp; The 2 last bytes would contain your data.&nbsp; So:&nbsp;Bytes Sent &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Bytes ReadCMD&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 0 (or should be 0)0&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Data10 &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Data2&nbsp;You can download these <a href="http://digital.ni.com/public.nsf/allkb/B3A5BC3FEE59479286257495005BAED1?OpenDocument" target="_blank">test panels</a> and try to using them to send your commands and read your data. &nbsp; &nbsp;Please let me know if any of this is not clear or if you need more help with this.&nbsp; Have a great day.&nbsp; &nbsp;&nbsp;
johu
2008-08-14 17:40:07 UTC
Permalink
Can you send me the VI for Labview v8.0?
Loading...