• Content Count

  • Joined

  • Last visited

About Jonboy

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Is there an API or Software interface to the Waveforms 2015 software? I would like to use Waveforms 2015 as the interface to an Analog Discovery 2 for making various measurements but pass that data to another piece of software such as LabView, TestStand, or Python, etc. as part of a larger automated test sequence. Basically I would like to incorporate Waveforms 2015 into a larger test environment that may contain additional test equipment. I am aware of the SDK that allows for LabView and Python to control the Analog Discovery 2 directly. However, this prevents Waveforms 2015 from being used at the same time and requires me to re-develop all of the measurement setup and algorithms already developed in Waveforms 2015. I am also aware of and I am using the Script tool inside of Waveforms 2015 for test sequences, but this still only gives me access to the features within a single Waveforms 2015. Is it possible to programmatically open a saved workspace, open a saved script, run the script or a particular tool such as the Scope or Impedance Analyzer, and read the measured values or save them to a file for storage? For example, let's say I would like to have a saved workspace/script to run a curve trace measurement using the waveform generator and scope. Then I would like to open a different saved workspace/script to perform a series resistance measurement using the Impedance Analyzer that in turn uses the waveform generator and scope pins. Finally I would like to perform a functional test by using a different saved workspace/script to generate a waveform and capture it on a scope and make some basic measurements on the signal. Can all of this be accomplished in a single automated process using Waveforms 2015 as the interface to the Analog Discovery 2? Or would I need use the SDK to re-develop all of the tool algorithms such as the scope and impedance analyzer measurements by interfacing directly to the Analog Discovery 2 directly, but result in a large amount of extra development work to basically duplicate the Waveforms 2015 features? Thanks
  2. Hi @attila Thank you for your support and explanations. Concatenating the sub-adress and data fields works and I am now able to read and write specific register at will. I had been approaching this from the thought that the Script tool was controlling the features of the Protocol tool. Other parameters such as the Frequency, Read Bytes, etc. were updated through the script code when executed. Since I have to set the sub-address field in the Protocol window when manually reading/writing bytes, I assumed that the sub-address must be treated as it's own parameter in the Script tool. However, the sub-address never seemed to get updated and was causing me confusion. Thanks again for for the detailed explanations on function calls.
  3. Hi @attila Thank you for bug fix in the beta version and the additional information. This helps a lot and I am able to read data through my script which is a big improvement. I only have one additional point of confusion on how to write data to a subaddress. There does not appear to be a parameter in the write function for the subaddress like there was in the read function. How do I write data to a particular subaddress through the script tool? For example let's say I want to write a little script to work with a temp sensor (PN: TMP102) that has a device address set to 0x48 and four 2-byte registers with subaddresses 0-4. From the protocol tool I can type in 0x48 into the "address" field, and the specific register number into the subaddress field (0-4), set the Bytes to read to "2", and click the Read button to return the two bytes of data from that particular register. I can also write to this specific subaddress in the same way. To read/write a different register, I simply change the subaddress field to match the register I want to read or write. (As a side note, the write bytes field is set to 1 byte and disabled in the beta version but the read bytes field is configurable which I don't understand or know if this is a bug or by design). However, in the script tool, I don't have any control over the subadress field and therefore can't seem to write to a specific register. As a specific example of something I would like to do, how could I read the contents of register (subaddress) 2, write a new value to register 2, and then read that register back to confirm the write was successful? I would like to do something like the following: // Read 2 bytes of data from device address 0x48, subaddress 2) Protocol.I2C.Read(0x48, 2, [2]); // Protocol.I2C.Read(address, optional count of bytes, [optioinal array of subaddress]) > Lets say it returns [0x4B, 0x00] // I need help with the following write function but lets assume the following works // Write 2 bytes of data [0x55, 0x00] to device address 0x48, subaddress 2 Protocol.I2C.Write(0x48, [0x55, 0x00], [2]); // Protocol.I2C.Write(address, optional [array of data bytes to write], optional [array of subaddress]) // Read 2 bytes of data from device address 0x48, subaddress 2) to verify the write was successful and the register contains the value of the data we just wrote Protocol.I2C.Read(0x48, 2, [2]); //Read 2 bytes of data from device address 0x48, subaddress 2) >> It should return [0x55, 0x00] How do I alter the write function call in this example to target subaddress 2? Thank You!
  4. I have been having difficulty getting a simple script setup in the Script Tool to read and write a sequence of registers to a device through I2C on my Analog Discovery 2. Most of the I2C configuration commands that correlate to the manual controls on the Protocol I2C window such as SCL, SDA pins assignments, Frequency, Address, ReadBytes, and WriteBytes are working properly. However, the SubAddress does not seem to be functioning properly and does not update from the script like the other parameters. Perhaps there is a different function call or parameter to set instead of what I am trying to do. The last line of the following code is how I would expect the SubAddress to be changed. This code executes without error, but doesn't update the parameter. For example, If I set the Device Address value to 0x00 and the Sub Address (my device's register address to read) value to 0x01, then execute this script, I see the Address field of the Protocol tool change to 0x48, but the SubAddress field stays set to 0x01 when I expected it would be change to 0x02. Protocol.I2C.Mode.value = 1; //Set the I2C Protocol tool into Master Mode Protocol.I2C.SCL.value = 0; //Set the SCL pin to be DIO 0 Protocol.I2C.SDA.value = 1; //Set the SDA pin to be DIO 1 Protocol.I2C.SCL.Frequency.value = 100000; //Set the SCL clock frequency to 100 kHz Protocol.I2C.Clockstretching.enable = 1; //Enable Clock Stretching Protocol.I2C.ReadBytes.value = 1; //Set the Read Bytes number to 1 for reading one byte of data Protocol.I2C.WriteBytes.value = 1; //Set the Write Bytes number to 1 for writing one byte of data Protocol.I2C.Address.value = 0x48; //Set the I2C Protocol Device Address //The following line of code executes but does not actually change the SubAddress parameter Protocol.I2C.SubAddress.value = 0x02; //Set the SubAddress (Device register address) Unfortunately there is no scripting information provided in the Help Reference Document for the Protocol tool, or any example code files for basic I2C (or SPI scripts) that simply read and write registers. But if I look at the I2C Custom scripting as an example, I would assume the commands for the Script Tool would be similar. There are 3 read functions available: // 1.)Read(address) --> returns true when acknowledged otherwise false Protocol.I2C.Read(0x48) //Returns true for me // 2.) Read(address, count of bytes) --> returns the read bytes array Protocol.I2C.Read(0x48, 1) //Returns the value of the register corresponding the the GUI's SubAddress that was manually entered on the Protocol page, but not the script assignment // 3.) Read(address, [sub address byte1, byte 2,...], count of bytes) --> writes the subaddress bytes, repeated starts to read data bytes returns the read data bytes array Protocol.I2C.Read(0x48, 0x01, 1) //I would expect I could read one byte from register 0x01 of device 0x48. however, this function doesn't work properly. Is this the proper way to read a single 8-bit register? Since the SubAddress can't be set through the script, I hoped this would allow me to read the register value without having to manually changing the SubAddress in the GUI. Could you please check to see if the SubAddress commands are working properly between the Script and Protocol tools and/or explain the proper way to script the Protocol I2C tool for writing and reading 8-bit registers if I am not approaching this properly. Thank You!
  5. Hi Attila, Thank you for the information, it answered my question and I actually prefer to use the Script Tool instead of the custom scripts feature from within the protocol tool. I had thought I tried the Protocol.SPI.value command and I am not sure why I didn't figure this out on my own with my Analog Discovery 2 module. What I think was somewhat confusing me was that I had switched over to my Digital Discovery module because it has a higher sample rate and allowed me to achieve faster SPI clock data rates. In your example, the Protocol.Select.value = 10; corresponds to DIO 10 pin which makes sense and the "10" is a direct correlation. However, on the Digital Discovery pin indexes don't directly correlate and I had to use different numbers in the assignment to select the various SPI pins and this was confusing to me. Have I overlooked the documentation that identifies the pin indexing on the Analog and Digital discovery modules? For the Digital Discovery I found the following: Protocol.SPI.Select.value = 1; //Assigns pin DIO 24 Protocol SPI.Clock.value = 2; //Assigns pin DIO 25 Protocol.SPI.DQ0.value = 3; //Assigns pin DIO 26 Protocol.SPI.DQ1.value = 4; //Assigns pin DIO 27 To switch to a different set of wires for my second SPI port: Protocol.SPI.Select.value = 5; //Assigns pin DIO 28 Protocol.SPI.Clock.value = 6; //Assigns pin DIO 29 Protocol.SPI.DQ0.value = 7; //Assigns pin DIO 30 Protocol.SPI.DQ1.value = 8; //Assigns pin DIO 31 I do now have an additional question on the Select line timing that I didn't fully comprehend until today. I noticed that there is a significant amount of time that elapses between the Select line toggling and the start of the Clock and data, as well as even more time elapsing following the last data bit and the Select line toggling again. I now understand that the select signal is activated from software, therefore it does not have exact timing with the bit serialization. My total SPI data transaction takes about 500uS, but there is about ~3.5mS that elapses between the Select line toggling, and then another ~5.5mS of time following the data before the Select line toggles again to end the transaction. This gives me about one complete transaction every 9-10mS. This is a lot of overhead when I'm trying to send data across a bus through my transceivers that results in a lot of idle time on my system bus since a packet of data is only transmitted every time it receives the transmit command I'm sending over SPI. Is there any work around I could do to decrease this time between Select line toggling and the Clock/Data? It would be ideal if the tool would automatically transition the Select line automatically when a Read/Write command was executed. But since it doesn't work this way, would creating a custom script to do SPI allow faster overall speeds, or would the overhead be even slower? Thanks!
  6. I am fairly new user of Waveforms 2015 and I have both an Analog Discovery 2 and a Digital Discovery that I am trying to use for some for some tests with custom scripts. I am having difficulty finding the documentation or some example code that instructs me how to assign the pins I want to use for the Select, Clock, DQ0 (write), and DQ1 (read) functions. I have two different devices I need to communicate with through SPI but there is only one "select" line. I have two transceiver/MCU nodes connected together in a system and I need to communicate with the SPI port of one node to have it send a data packet to the second node, and then I need to switch my SPI bus pins to the second board and read verify it received the data I just sent from the first node. I am able to script up a sequence of Read/Write transactions using the pin assignments set in the Waveforms GUI for my first device, but I now need to re-assign the pins in the script so that I can configure my second device without having to manually change the pin assignments in the Waveforms GUI. For example, if I use my Digital Discovery, the SPI pin assignments I would like to use are: Node 1: Select = DIO 24, Clock = DIO 25, DQ0 = DIO 26, and DQ1 = DIO 27. Node 2: Select = DIO 28, Clock = DIO 29, DQ0 = DIO 30, and DQ1 = DIO 31. Could I get some example code to show how to assign the DIO pins for the various SPI signals Select, Clock, DQ0, DQ1 in both the Protocol/SPI/Custom script and the general Script tool in Waveforms 2015? I'm sorry if this is a newbie question or documented somewhere already, but this has been elusive to me. Thanks!