03-02-2007 02:26 AM
03-05-2007 08:34 AM
03-05-2007 11:12 AM
Thank you, Steven.
The Atmel EEPROM read/write VI is included in the LV 8.0 under Find Example\Hardware Input/Output. It may have come with the 8451 USB to SPI/I2C module. I am not sure since I bought LV 8.0 and the 8451 at the same time and installed everything at the same time.
I did exactly what you suggested. I used the probe to look at different signal lines to trace the operation of the VI. I think I have some idea but I am a new LV user so I can use some help in confirming my understanding. Specifically, it appears that the Number of address to read forms an array that's attached behind the 3 header bytes: 0x03 as the Read command, and the next 2 bytes is the address. It apears that the "counter" is not incremented but the size of the array tells the SPI Read VI to read until the array is filled.
My Slave device behaves differently. For each Read the address (1 byte) needs to be sent with MSB = 0 as the Read command. Then the next byte is a dummy byte just to clock the data out of the Slave. So in my case I need to increment the address counter for each address Read.
Any help is appreaciated.
Regards,
Francis
03-07-2007 11:24 AM
Hi Francis,
From the sounds of things, you're looking at the Amtel AT25080A Read example VI found under the SPI Advanced folder in the Example Finder. Is that correct? If so, your description of the example's execution sounds correct. The first byte indicates what sort of operation you'd like to perform, the next two indicate the starting address for this operation you would like to access and the remaining bytes are the number of bytes you would like to read beginning at that starting address (in this sense the address is auto-incremented based on the number of bytes you choose to read).
In your case, it sounds like you want to do a very similar operation, only you will have one bit to determine the operation, 7 more bits to specify the address and the following bits to read the value at that address. If you want to read the byte at that address and the next two beyond that, you can simply create an array of three bytes and build an array with this and your operation/address byte. If you want to read bytes at disjointed addresses you will need to do multiple 845x SPI write read blocks and input the new address at that time (either in a sequential format or within a loop).
In general, if you are looking for more information concerning the operation of different blocks, it is helpful to have Context Help on (Help>>Context Help) and when you hover your mouse over wires or blocks the Context Help window will give you additional information. Additionally, the NI-845x Software User Manual found under Start>>Programs>>National Instruments>>NI-845x could be helpful. Hope this helps!
03-08-2007 07:11 PM
Anna,
Thank you for your reply. You are correct regarding the origin of the SPI Read example. And indeed I use the Probe function to look at the signals along the wires. However, even with that tool I am not able to determine:
1) How does the address counter get incremented? Or does it even get incremented? It appears to me that once you pick the starting address and build the array based on the number of (consecutive) bytes to read (plus the first three byte; 0x03 Read instruction and two bytes for the starting address) somehow the SPI Read VI just reads until the array is filled. Again, this does not seem to invlove incrementing the starting address counter.
2) The number of bytes to read build an array of that size. And that number is written to the slave as the last byte. How is this information used by the SPI Read VI? In other words when the VI is executed how does the VI use this number? Which of the block use that number?
You are only partially correct regarding my application. And this is the part I really can use some help. Let me reiterate; my slave device requires, on EVERY ADDRESS READ, the MSB = 0 for Read instruction + 7-bit address; the next byte is "dummy" to clock the data out. This is why I keep asking how the address counter gets incremented. I need to make one Read, increment the address counter, then send the Read instruction + the 7-bit address + the dummy byte again. Repeat this process for EVERY ADDRESS and this is only applicable to consecutive address Read. I have not even gotten to the disjointed Read yet but you are right about that. I'll defintely need multiple Read.
Again, I appreciate your help.
Regards,
Francis
03-09-2007 03:26 PM
Hi Francis,
From how you have described the operation of your slave device, I would recommend putting your SPI Read/Write into a loop and incrementing the start address by one byte with every iteration (this can be done with a shift register and an addition function in your loop). This should put your write array in the proper format. Let me know if this strategy works with your particular device. Thanks!
03-09-2007 03:45 PM
Thank you, Anna.
If you examine the Atmel example, let say you put in 2 locations to read; and you probe the start address value through the execution you'll find that the start address never gets incremented. So how does the Read VI know it is supposed to read two locations?
Thanks.
Regards,
Francis
03-09-2007 04:02 PM
Hi Francis,
In terms of the driver level calls made, I would need to look further into the issue and I would need to speak with R&D to determine what information is proprietary and so on. Otherwise, I think it is best described by the comments included in the example which explain how for the particular EEPROM written to in this example, "The format for is:
a) The first byte is 0x3, which is the READ instruction
b) The second and third bytes are the address to write to. This is a 16-bit number sent
in big endian format (MSB first)
c) The next x bytes sent to the device are the bytes that must be sent to the device
to cause the bytes to be shifted out of the device. For reads, the device can
respond with all 1024 bytes worth of the data in a single read cycle."
In this instance, only the start address is required for a read of subsequent bytes. As part (c) indicates, for each byte you ask to be read into LabVIEW, the bytes get shifted over to that address you first specify. Your device will necessarily require a different format, as you have described. So, the SPI Read/Write block is not really incrementing the address.. you will need to do that for your code.
Let me know if this addresses your question better. Thanks!
03-13-2007 12:09 AM
03-16-2007
09:59 AM
- last edited on
06-03-2025
04:09 PM
by
Content Cleaner
Hi Francis,
Did you see there is a new driver available which brings a more general EEprom Example and a C API.
DirkW