Search the Community

Showing results for tags 'i2c'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Test and Measurement
    • Measurement Computing (MCC)
    • Add-on Boards
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions
    • Archived

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 16 results

  1. // This posted here so that Google and Bing search the script to help other users of Digilent Analog Discovery AD2 // and Digilent wave forms find programming examples which are very difficult to find. // This driver is work in progress . SPI & I2C functionality not working yet . // for use with Digilent Analog Discovery AD2 script engine. // // Attila : Please leave this post up on the forum as I spent a very long time curating the script to find all the // small example pieces of code . // // ------------------------------------------------------------------------------------------------------------------- //************************************************************ // // Notes on the basic script syntax can be found here // // You can use the links in the Help, other educational pages or google... // // https://doc.qt.io/qt-5/ecmascript.html // // https://www.w3schools.com/jsref/jsref_obj_array.asp // // Note for this script to work the following Waveforms window panels have to be open // - Supplies - the internal AD2 PSU can be used // - Main script -- location where this script is cut and pasted // - Protocol ** - required to have acces to the AD2 internal SPI or UART or I2C bus engines // // edit using Notepad++ with the langauge Javascript selected. // // //************************************************************ //************************************************************ //Function blocks //************************************************************ function bitExtracted( number, k, p) { // Function to extract k bits from p position // and returns the extracted value as integer // eg first 11 bits of a 16 bit number // bitExtracted(int 0xfff,10,0) return (((1 << k) - 1) & (number >> (p - 1))); } function spi_initialise() { if(!('Protocol' in this)) throw "Please open the Protocol tool window"; //************************************************************ // Script using Protocol SPI. // SPI BUS Set up //************************************************************ // // SPI Bus physical wired set up // // Select AD_2_DIO3 // SPI: /CS // Clock AD_2_DIO4 // SPI: Clock // DQ0 AD_2_DIO5 // SPI: MOSI // DQ1 AD_2_DIO6 // SPI: MOS0 // // !! Remember to change the set up in function spi_pin_io_setup() if the SPI Pins are re assigned on the AD2 DIO GPIO pins !! Protocol.Mode.text = "SPI"; // make sure SPI tab is selected Protocol.SPI.Select.Active.value=0; Protocol.SPI.Clock.Polarity.value=0 ; // set up spi clock initial Polarity Protocol.SPI.Clock.Phase.value=0 ; // set up spi clock initial Phase Protocol.SPI.Clock.Frequency.value=1e6 ; // set spi clock freqncy at 1MHz page 19 of the data sheet min spi clock 1MHz if(Protocol.SPI.Clock.Frequency.value > 1e6) Protocol.SPI.Clock.Frequency.value = 1e6; Protocol.SPI.Select.value = 3; //Assigns pin Analog Disovery 2 GPIO Pin DIO 3 Protocol.SPI.Clock.value = 4; //Assigns pin Analog Disovery 2 GPIO Pin DIO 4 Protocol.SPI.DQ0.value = 5; //Assigns pin Analog Disovery 2 GPIO Pin DIO 5 // // SPI: MOSI Protocol.SPI.DQ1.value = 6; //Assigns pin Analog Disovery 2 GPIO Pin DIO 6 // SPI: MOS0 Protocol.config() // apply configuration changes now print(" SPI initialised " + "\n\r" ); print(" SPI Select is connect to AD2 DIO Port : " + Protocol.SPI.Select.value + "\n\r" ) ; print(" SPI Clock connect to AD2 DIO Port : " + Protocol.SPI.Clock.value + "\n\r" ) ; print(" SPU MOSI port connect to AD2 DIO Port : " + Protocol.SPI.DQ0.value + "\n\r" ) ; print(" SPU MOSO port connect to AD2 DIO Port : " + Protocol.SPI.DQ1.value + "\n\r" ) ; print("\n\r"+" SPI initialisation complete " + "\n\r" ) ; //************************************************************ // notes // ===== // // 1. On the AD and AD2 the digital IO pins use LVCMOS 3V3 standard. These are supplied at 3.3V and have 200 Ohm PTC and clamping diodes to GND and to 3.3V for protection. // It will drive the digital wires at 3.3V and connecting 5V signals directly, without series resistor, it will sink about 10mA through the PTC and 3v3 diode. // As for noise, make sure to have ground connection between the two devices. // // 2. The WF/Protocol/UART uses the Stop length option only for transmission, this is not relevant for reception. // // 3. The UART TX filed lets you type in characters, hexadecimal values are not supported here. // Special chars you can copy/paste from other place or send from file. //************************************************************ } function i2c_initialise() { if(!('Protocol' in this)) throw "Please open the Protocol tool window"; //************************************************************ // Script using Protocol I2C. // i2C BUS Set up //************************************************************ // // I2C Bus physical wired set up // // I2C SDA AD_2_DIO0 // I2C SCL AD_2_DIO1 // /Reset AD_2_DIO3 // // // // // Note Only DIO pins 0 through to 9 can be used for Protocol functions { SPI , I2C or UART} // // var I2C_reset_AD2_DIO_port = 3 ; // Set to AD2 DIO Port which controls I2C /Reset io line Protocol.Mode.text = "I2C"; // make sure SPI tab is selected Protocol.I2C.Mode.value = 1; //Set the I2C Protocol tool into Master Mode Protocol.I2C.SCL.value = 1; //Set the SCL pin to be DIO 0 Protocol.I2C.SDA.value = 0; //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.value = 1; //Enable Clock Stretching´.. This line is not functioning Protocol.I2C.ClockStretching.enable; // This is the replacement lines Protocol.config() // apply configuration changes now // flip the GPIO active low reset line set low then set high set_static_io_pin(I2C_reset_AD2_DIO_port,0); wait(0.1); // wait 100 milli second before next instruction. set_static_io_pin(I2C_reset_AD2_DIO_port,1); wait(0.1); // wait 100 milli second before next instruction. // ref https://forum.digilentinc.com/topic/4942-i2c-subaddress-not-working-properly-in-the-script-tool/ // Ref https://forum.digilentinc.com/topic/21906-how-to-measure-scope-and-protocol/ // ref https://forum.digilentinc.com/topic/18944-reading-i2c-via-script-displays-wrong-data/ print(" I2C initialised " + "\n\r" ); print(" I2C SCL connect to AD2 DIO Port " + Protocol.I2C.SCL.value + "\n\r" ) ; print(" I2C SDA connect to AD2 DIO Port " + Protocol.I2C.SDA.value + "\n\r" ) ; print(" I2C /RESET port connect to AD2 DIO Port " + I2C_reset_AD2_DIO_port + "\n\r" ) ; print("\n\r"+" I2C initialisation complete " + "\n\r" ) ; //************************************************************ // notes // ===== // // 1. On the AD and AD2 the digital IO pins use LVCMOS 3V3 standard. These are supplied at 3.3V and have 200 Ohm PTC and clamping diodes to GND and to 3.3V for protection. // It will drive the digital wires at 3.3V and connecting 5V signals directly, without series resistor, it will sink about 10mA through the PTC and 3v3 diode. // As for noise, make sure to have ground connection between the two devices. // // 2. The WF/Protocol/UART uses the Stop length option only for transmission, this is not relevant for reception. // // 3. The UART TX filed lets you type in characters, hexadecimal values are not supported here. // Special chars you can copy/paste from other place or send from file. //************************************************************ } function i2c_notes_read_with_i2c_sub_address() { // // Ref https://forum.digilentinc.com/topic/4942-i2c-subaddress-not-working-properly-in-the-script-tool/ // // // Special sub-addressing is only required for read operations. In this process the sub-address write is followed by a restart and read. // ref https://www.i2c-bus.org/repeated-start-condition/ // For write operations you can just concatenate the "sub-address" with the array of data you have to write. var a = [1,2] // sub-address var b = [3,4] // data var c = a.concat(b) Protocol.I2C.Write(0x48, c) } function i2c_write( address , data_array_to_write) { // // Examples of i2c_write // // address = 0x60 // data_array_to_write = [0,1] // Protocol.I2C.Write(address, data_array_to_write ) ; // notes // ===== // // 1. On the AD and AD2 the digital IO pins use LVCMOS 3V3 standard. These are supplied at 3.3V and have 200 Ohm PTC and clamping diodes to GND and to 3.3V for protection. // It will drive the digital wires at 3.3V and connecting 5V signals directly, without series resistor, it will sink about 10mA through the PTC and 3v3 diode. // As for noise, make sure to have ground connection between the two devices. // // 2. The WF/Protocol/UART uses the Stop length option only for transmission, this is not relevant for reception. // // 3. The UART TX filed lets you type in characters, hexadecimal values are not supported here. // Special chars you can copy/paste from other place or send from file. } function i2c_read( address , number_of_bytes_to_read_back ) { // // Examples of i2c_read // // address = 0x60 // number_of_bytes_to_read_back =32 // var bytes = Protocol.I2C.Read( address, number_of_bytes_to_read_back) ;// returns array of x bytes read from device address 0x0D return bytes ; } function i2c_read_example() { // From the Script tool you can perform I2C transfer like this: var bytes = Protocol.I2C.Read(0x0D, 2) ;// returns array of 2 bytes read from device address 0x0D var temp = (((bytes[0]<<26) | (bytes[1]<<18)) >>18)/32; print("Temp: "+temp+"*C") // ref https://forum.digilentinc.com/topic/17333-digital-discovery-logic-dios-are-different-to-dios-from-the-patterngenerator/ } function spi_pin_io_setup() { print(" The SPI setup should be :- "); print(" "); print(" Select AD_2_DIO3 // SPI: /CS "); print(" Clock AD_2_DIO4 // SPI: Clock "); print(" DQ0 AD_2_DIO5 // SPI: MOSI "); print(" DQ1 AD_2_DIO6 // SPI: MOS0 "); } function UART_initialise() { clear(); // clear Output log // // Note Only DIO pins 0 through to 9 can be used for Protocol functions { SPI , I2C or UART} // // if(!('Protocol' in this)) throw "Please open the Protocol instrument"; Protocol.Mode.text = "UART"; // make sure UART tab is selected Protocol.UART.TX.value = 0; // Set up UART TX pin on Digilent AD2 :: DIO_0 Pin Protocol.UART.RX.value = 1; // Set up UART RX pin on Digilent AD2 :: DIO_1 Pin Protocol.UART.Bits.value=8; // Sets or gets the UART number of bits. Protocol.UART.Parity.text="None" ;// Sets or gets the parity setting: “None”, “Even”, “Odd”, “Mark (High)”, “Space (Low)”. Protocol.UART.Rate.value=9600; // Sets or gets the baud rate setting Protocol.config(); // apply configuration changes now Protocol.UART.Receiver(); // reset receiver - that is too start receiving data print(" UART Serial Bus initialised . Beware this is 3V3 Logic RS232 & Not True +/- 15V Rs232" + "\n\r" ); print(" I2C SCL connect to AD2 DIO Port " + Protocol.I2C.SCL.value + "\n\r" ) ; print(" I2C SDA connect to AD2 DIO Port " + Protocol.I2C.SCL.value + "\n\r" ) ; print("\n\r"+" I2C initialisation complete " + "\n\r" ) ; // // ref https://forum.digilentinc.com/topic/21308-ad2-protocol-uart-script-reading-vaillant-ebus/ // // https://forum.digilentinc.com/topic/21353-use-of-multiple-protocol-uart-ports-via-script-possible-at-different-times/ // // notes // ===== // // 1. On the AD and AD2 the digital IO pins use LVCMOS 3V3 standard. These are supplied at 3.3V and have 200 Ohm PTC and clamping diodes to GND and to 3.3V for protection. // It will drive the digital wires at 3.3V and connecting 5V signals directly, without series resistor, it will sink about 10mA through the PTC and 3v3 diode. // As for noise, make sure to have ground connection between the two devices. // // 2. The WF/Protocol/UART uses the Stop length option only for transmission, this is not relevant for reception. // // 3. The UART TX filed lets you type in characters, hexadecimal values are not supported here. // Special chars you can copy/paste from other place or send from file. } function UART_Test() { UART_initialise(); Protocol.UART.Receiver(); // start receiver wait(); Protocol.UART.Send("hello"); // TX wait(0.1); // 100ms wait for RX, depends on the external device and rate print(Protocol.UART.Receive()); // RX } function UART_Test_example_2() { UART_initialise(); Protocol.UART.Receiver(); // reset receiver - that is start receiving data var rx = []; while(wait(1)) { // wait 1 sec and repeat while not stopped rx = rx.concat(Protocol.UART.ReceiveArray()); // append new words while(rx.length>10) { if(rx.shift()==0xAA) continue; if (rx[1] == 0xB5 && rx[2]== 0x11 && rx[7] == 0x09) { // find the temperatures for displaying print ("Temp 1: " + (rx[8]/2).toFixed(1) + " °C Temp 2: " + (rx[9]/2).toFixed(1) + " °C"); // decimal data devided by 2 bring °Celsius } } } } function UART_Test_example_3() { UART_initialise(); Protocol.UART.Receiver(); // reset receiver - that is start receiving data // Protocol.UART.Send("Hello") ; // send text with ending var rx = Protocol.UART.Receive(); // receive text print(rx) ; // Protocol.UART.Send("Hello ", false); // send text custom ending var rx = Protocol.UART.Receive(); // receive text print(escape(rx)); // Protocol.UART.SendArray([1,2,3,4,5,0], false); // send array custom ending var rx = Protocol.UART.ReceiveArray(); // receive array print(rx); } function spi_write( address , data_to_write) { Protocol.SPI.Start(); Protocol.SPI.Write( address ,data_to_write ); // Read Register, Device ID Protocol.SPI.Stop(); wait(0.1); // wait 100 milli second before next instruction. } function spi_write_read( address , data_to_write, number_of_bytes_to_read_back) { Protocol.SPI.Start(); Protocol.SPI.Write( address ,data_to_write ); // Read Register, Device ID wait(0.1); // wait 100 milli second before reading data. var rg_data = Protocol.SPI.Read(address, number_of_bytes_to_read_back); Protocol.SPI.Stop(); wait(0.1); // wait 100 milli second before next instruction. return rg_data ; } function static_io_example() { // ref https://forum.digilentinc.com/topic/21512-how-to-energize-multiople-staticio-given-only-when-a-certain-dio-is-on/ // ref https://forum.digilentinc.com/topic/2150-staticio-scripting-documentations-for-waveforms3/ // ref https://forum.digilentinc.com/topic/18737-export-issues/ // ref https://forum.digilentinc.com/topic/18789-some-functional-problems/ clear() if(!('StaticIO' in this)) throw "Please open the StaticIO instrument"; const IO = 7; const delay = 0.3; print("Running StaticIO script"); for(var c = 0; c <= IO; c++) { StaticIO.Channel0.DIO[c].Mode.text = "Switch"; } StaticIO.run() while(wait()){ // while script not stopped if(StaticIO.Channel1.DIO8.Input.value == 1) { for(var c = 0; c <= IO; c++) { StaticIO.Channel0.DIO[c].text = "1"; StaticIO.config(); // apply changes now if(!wait(delay)) return; // exit on script stop StaticIO.Channel0.DIO[c].text = "0"; StaticIO.config(); if(!wait(delay)) return; } for(var c = IO; c > 0; c--) { StaticIO.Channel0.DIO[c-1].text = "1"; StaticIO.config(); if(!wait(delay)) return; StaticIO.Channel0.DIO[c-1].text = "0"; StaticIO.config(); if(!wait(delay)) return; } } } } function static_io_example_2() { // ref https://forum.digilentinc.com/topic/21512-how-to-energize-multiople-staticio-given-only-when-a-certain-dio-is-on/ // ref https://forum.digilentinc.com/topic/2150-staticio-scripting-documentations-for-waveforms3/ // ref https://forum.digilentinc.com/topic/18737-export-issues/ // ref https://forum.digilentinc.com/topic/18789-some-functional-problems/ clear(); if(!('StaticIO' in this)) throw "Please open the StaticIO instrument"; // 1.Probe print("Running pin 1, channel 1") StaticIO.Channel0.DIO[3].text = "0"; StaticIO.Channel0.DIO[4].text = "1"; StaticIO.Channel0.DIO[5].text = "1"; StaticIO.Channel0.DIO[0].text = "0"; StaticIO.Channel0.DIO[1].text = "0"; StaticIO.Channel0.DIO[2].text = "0"; StaticIO.config(); // force immediate configuration wait(1); // wait on external device/circuit } function static_io_example_3() { // // This is what's available on the wiki: // // .StaticIO // // .Channel#: groups of 8 signals // .Mode.text: select between: I/Os, Slider, Progress // .Input.value: input value // .DIO#: I/Os // .Input.checked: input value // .Mode.text: select between: LED, Button, Switch // .Button.text: select between: 0/1, 1/0, Z/1, 1/Z, Z/0, 0/Z // .Switch.text: select between: TS, PP, OS, OD // ref https://forum.digilentinc.com/topic/2150-staticio-scripting-documentations-for-waveforms3/ // I got the DIO13 configured as a PushPull Switch, but how do you set the actual value that you want the pin to output? // Configure Static IO StaticIO.Channel1.Mode.text = "I/Os" // Configure Red LED StaticIO.Channel1.DIO13.Mode.text = "Switch" StaticIO.Channel1.DIO13.Switch.text= "PP" } function set_static_io_pin( AD2_Dio_pin , boolean_state ) { if(!('StaticIO' in this)) throw "Please open the StaticIO instrument"; if( boolean_state == 1) { StaticIO.Channel0.DIO[AD2_Dio_pin].text = "1"; StaticIO.config() // force immediate configuration } if( boolean_state == 0) { StaticIO.Channel0.DIO[AD2_Dio_pin].text = "0"; StaticIO.config() // force immediate configuration } } function power_up_psu( Power_supply_voltage ) { //************************************************************ // Set up mini PSU inside Analogue Discovery 2 to supply 3.3V //************************************************************ if(!('Supplies' in this)) throw "Please open the Supplies tool window"; Supplies.Output.PositiveSupply.Voltage.value=Power_supply_voltage; Supplies.Output.PositiveSupply.Enable.setEnable(); Supplies.Output.NegativeSupply.Enable.setDisable(); Supplies.run(); // Turn on PSU unit inside AD2 print(" Power supply is UP VCC = " + Power_supply_voltage + "\n\r" ); wait(5); // wait 1 seocnds for system to stabilise. //*********************************************************** } function power_down_psu() { //************************************************************ // Power down mini PSU inside Analogue Discovery 2 to supply 3.3V //************************************************************ print(" PSU is powering down" ); Supplies.stop(); wait(5); // wait 5 second before reading data. Supplies.Output.PositiveSupply.Voltage.value=0.3; Supplies.Output.PositiveSupply.Enable.setEnable(); Supplies.Output.NegativeSupply.Enable.setDisable(); Supplies.run(); // Turn on PSU unit inside AD2 wait(10); // wait 10 second before reading data. Supplies.stop(); // Turn off PSU unit inside AD2 after measurment has finished. print(" PSU is powered down" ); //*********************************************************** } function PMOD_ADXL362_not_working() { //************************************************************ // Example block read ADXL362 Device ID : Start //************************************************************ clear(); // clear display screen print(" SPI Script for PMOD ACL2 3 axis accelometer with Analog devices ADXL362 running " + "\n\r "); power_up_psu( 3.3 ) ; // Power up PSU to VCC = 3v3 spi_initialise(); // set up spi bus var STATUS_reg =spi_write_read( 8, [0x0B, 0x00], 1) ; // Read ADXL362 STATUS_reg Page 23 & 25 of the ADXL362 Data sheet & read 1 words of 8 bit length print(" ADXL362 Status regiser raw data after reset = " + STATUS_reg + "\n\r" ); wait(0.01); // wait 10 milli second before reading data. var rgID = spi_write_read( 8, [0x0B, 0x00], 4) ; var Device_ok=0; if(rgID[0] != 0xAD || rgID[1] != 0x1D || rgID[2] != 0xF2){ print(" Device ID mismatch rgid(0) " + rgID[0] ); print(" Device ID mismatch rgid(1) " + rgID[1] ); print(" Device ID mismatch rgid(2) " + rgID[2] ); print(" "); print(" Is the physical SPI Bus physical wired set up correctly ?? " ); print(" "); spi_pin_io_setup(); } else { print(" Device is ADXL362 : SPI register 0x00 read { 0dxx in decimal} : " + rgID + "\n\r" ); Device_ok=1; } //********************************************************************************** // // Result shoudl be : Read: hAD, h1D, hF2, h02, // Output : 173,29,242,2 in dec --> hex --> 0xAD 0x1D 0xF2 Ox02 // //********************************************************************************* if ( Device_ok==1) { /*--------------------------------------------------------------------------------------------------------------- * * ADXSL262 SPI register setup for POWER_CTL to be permantly on without sleep * * Bit 7 Reserved 0x0 * Bit 6 External CLK =1 int=0 0x0 * Bit 5:4 Power ns Noise Trade off 0x10 = Ultra Low Noise * Bit 3 Wakeup mode 0x0 = OFF * Bit 2 Autosleep 0x0 = OFF * BIT 1:0 Measurement state 0x10 = Measurment Mode * * Resultant setting = b00 10 00 10 = 0x22 *---------------------------------------------------------------------------------------------------------------*/ spi_write( 8,[0x0A, 0x2D, 0x02] ); // Power Control Register, Measurement Mode var rg = spi_write_read( 8, [0x0B, 0x0E], 8) ; // convert data bits to signed value relative to gravitational constant // MSbit sign, LSBit 0.001g for default 2g mode var gx = (0.001* ((rg[1]<<28) | (rg[0]<<20)) /1048576).toFixed(3); var gy = (0.001* ((rg[3]<<28) | (rg[2]<<20)) /1048576).toFixed(3); var gz = (0.001* ((rg[5]<<28) | (rg[4]<<20)) /1048576).toFixed(3); var tp = (0.065* ((rg[7]<<28) | (rg[6]<<20)) /1048576).toFixed(2); print(" Raw data {16 bit data} {x,y,z,temp} = " + rg + "\n\r" ); print(" Accelerometer initial X value = " + gx ); print(" Accelerometer initial y value = " + gy); print(" Accelerometer initial z value = " + gz); print(" Accelerometer initial temp value = " + tp); } } //************************************************************ // Main program block : Start //************************************************************ clear(); // clear display screen print(" Script Main body start " + "\n\r "); power_up_psu( 3.3 ) ; // Power up PSU to VCC = 3v3 // ********************** // User code start // ********************** // ********************** // User code stop // ********************** power_down_psu(); //************************************************************ //************************************************************ // Main program block : Stop End //************************************************************ Digilent_AD2_Script_master.js
  2. Hello, I need help I work on the pmodgyro, and I've been trying to get the temperature for several days but I can't. I use the stm32. and I even tried with the arduino it does not work. I think I may have fried it as I use i2c communication and I often fail to use resistane pull-up. I would like to have concrete suggestions to test the sensor please, Thank you
  3. Hi, I have a small problem with I2C master tab. I am at waveforms 3.17.1 and I am trying to use the protocol tab with DD device. My intent is to read an address on a device, which is 16bits wide address. It happens that I can only read the first address 0000h. Even if I change the SubAddress to 0001h, it will still read 0000h. I made it work in the custom tab, but not in this. Is it supposed to be this way? Thanks,
  4. Hello. Im trying to read an I2C sensor (ADXL357) with a Zybo Z7-10. Im kinda lost since im not an expert on fpgas. Im using this design on vivado 2019.2 ##Clock signal set_property -dict { PACKAGE_PIN K17 IOSTANDARD LVCMOS33 } [get_ports { sysclk }]; #IO_L12P_T1_MRCC_35 Sch=sysclk create_clock -add -name sys_clk_pin -period 8.00 -waveform {0 4} [get_ports { sysclk }]; ##Pmod Header JC set_property -dict { PACKAGE_PIN V15 IOSTANDARD LVCMOS33 } [get_ports { port_i2c_scl_io }]; #IO_L10P_T1_34 Sch=jc_p[1] set_property -dict { PACKAGE_PIN W15 IOSTANDARD LVCMOS33 } [get_ports { port_i2c_sda_io }]; #IO_L10N_T1_34 Sch=jc_n[1] ls /dev gives only i2c-0 interface. Im working with a pynq framework that uses petalinux as base. For now im not using python but im trying first to detect the sensor address (from linux) and then do the logic (python or with sdk) When i connect to the Pin 1 and 2 of the PMOD JC i dont detect nothing with "sudo i2c -r -y 0" only "--" on all the addresses. I have tried other ports but no response yet. What am i doing wrong? Is Pin 1/2 correct on JC? i dont understand why linux doesn't detect the sensor. The reference manual says that any pin can be routed throug PMOD but how do i said to the linux that P1-2 of JC is the i2c? (i have all pmods available so i can use all). Thanks EDIT: cat ./petalinux_project/build/tmp/work-shared/plnx-zynq7/kernel-source/arch/arm/boot/dts/zynq-7000.dtsi amba: amba { u-boot,dm-pre-reloc; compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; interrupt-parent = <&intc>; ranges; ... ... i2c0: [email protected] { compatible = "cdns,i2c-r1p10"; status = "disabled"; clocks = <&clkc 38>; interrupt-parent = <&intc>; interrupts = <0 25 4>; reg = <0xe0004000 0x1000>; #address-cells = <1>; #size-cells = <0>; }; i2c1: [email protected] { compatible = "cdns,i2c-r1p10"; status = "disabled"; clocks = <&clkc 39>; interrupt-parent = <&intc>; interrupts = <0 48 4>; reg = <0xe0005000 0x1000>; #address-cells = <1>; #size-cells = <0>; }; Is I2C disabled right? what should be the device tree to enable the pins on a pmod? modifying the dts then i should recompile boot.bind and image.ub and replace it on the sd?
  5. Dear Attila Please find enclosed the following . This took more than 4 hours to prepare all the documentation please treat as such. I am using the latest version of Digilent Waveforms and the latest Waveforms SDK. - Master Javascript driver for Digilent Analogue Discover AD2 which can be used inside Waveforms - SPI Setup , read & write & Initialise (1) . Status NOT Working . Needs Digilent Help to fix (%%) - I2C Setup , read & write & Initialise (2) . Status NOT Working . Needs Digilent Help to fix - UART Setup , read & write & Initialise(3) . ** - GPIO Setup, Set individual GPIO Pin Output States (4) Working - PSU Control, Set PSU voltage , turn on and off (5) Working - Python driver directly to control ON-SEMI CAT9532 using Digilent Analogue Discover AD2 & Digilent Waveforms ## Enclosed are all the attached scripts . ** Mostly likely works as driver details taken from working examples . See driver for while for web links reference. (%%) See previous efforts here to get it working &nbsp; &nbsp;https://forum.digilentinc.com/topic/21997-waveforms-with-accelerometer-digilent-analog-discovery-2-with-pmod-acl2-java-script-spi/#comment-63633 https://forum.digilentinc.com/topic/19237-waveforms-with-accelerometer/page/2/#comment-52495 I am trying to get the I2C driver function of the AD2 to work to drive a ON-SEMI CAT9532 LED driver. Set up , I have two Digilent Analogue Discover AD2 - Device 1 : Digilent AD2 (Device A) I2C driver source . A) Device is programed using Digilent Waveforms Javascript B) Direct control though Digilent Waveforms I2C Master interface C) Direct control though Digilent Waveforms I2C Master script interface D) Direct control Waveforms SDK & Python - Device 2 : Dilenet AD2 (Device B) as I2C spy device - Device 3 : TotalPhase Advark I2C/SPI professional I2C development tool Direct control & Programming by XML program script. https://www.totalphase.com/products/aardvark-i2cspi/ I own (2) two Analogue Discovery devices. What worked Device 2 : It could work perfectly as a I2C spy mode device Device 3: Worked perfectly straight out of the box using the GUI interface. Took 20 mins to have working solution. This is professional I2C product that has been in the market for 10 years plus. What failed Device 1: Did not output the correct I2C packet no mater how it was programmed. Device 1 : Had 10K pull up resistor attached to the VCC 3V3 rail on the I2C: SDA & I2C:SCL & I2C:/RESET. Conclusion There seems to be general issue with the AD2 and getting it to work as driver for I2C and SPI . Which is a long term issue. I have spent a long time searching for all the small details to build up the driver set so that should work with Digilent Analogue Discover AD2 & Digilent Waveforms but if the hardware of the AD2 is not co-operative or the staff in Digilent not being supportive there is only so much I can do . Requested Help 1. Fix the Waveforms AD2 Javascript and Python Waveforms SDK so it works for SPI & I2C . There is something missing here, where it would be good to fix to improved your AD2 products for the whole community of AD2 users 2. Have a Digilent published AD2 drivers that work for SPI & I2C & UART & GPIO & PSU control for waveforms and waveforms SDK. So Attila the case is in your lap now .. Please put some effort in to fix it or show me how to fix it . I have the feeling your quite a skilled person. The result should be posted here as a product example : https://projects.digilentinc.com/products/waveforms?sort=updated Background I am a electronic engineer with 20+ years development experience , I have have successfully used Digilent AD2 to design 3 products end to end and have been using it for quite a few years. I can program in Python , Microsoft VB.net and Javascript. I have personally purchased two pieces of AD2 out of my own money as feel they are such a good tool. I am committed to using the AD2 as I can see and experience that it is a super swiss army knife for use in a development of embedded electronics. I have also purchased a full profesional copy of National instruments Labview for use with AD2 but , have suspended learning to use labview until this I2C & SPI issue is resolved with the AD2 Digilent_AD2_Script_I2C_control_of_on-semi_CAT9532.py Digilent_AD2_Script_I2C_control_of_on-semi_CAT9532.js Digilent_AD2_Script_I2C_control_of_on-semi_CAT9532.dwf3work Digilent_AD2_Script_master.js
  6. Hi With the waveforms tool is it possible using python scripting in the Waveforms platform to do the following ?? Use the Digilent Analogue discovery 2 - Attach a device like a PMOD device eg accelerometer https://store.digilentinc.com/pmod-acl-3-axis-accelerometer/ using the Analogue discovery 2 ability to chat SPI & IC2 - pmod DEVICES SUPPORT 12-pin Pmod connector with SPI interface and 2×4-pin I²C interface - Then using the read information from the PMOD device treat it like an extra oscilloscope channel . Either as a Analog channel or Digital channel depending on the the signal type acquired from the PMOD device. This is possible with Labview but that would also require a lot of code writing. If this is possible this is outstanding feature when considering all the available PMOD devices available from the list https://store.digilentinc.com/by-function/input/ This would be a real product enhancement for Digilent and the Analog Discovery and help sell the AD2 in to many new places . Best wishes Simon
  7. Hi, I've written a simple vhdl core to act as an EDID emulator. It's basically a PLB Master core, catching interrupts from a PLB Slave XPS_IIC core attached to HDMI SDA/SCL line to manage I2C/DDC protocole. This core works fine when xps_iic is connected to J3:IN I2C ports (M16 for SCL, M18 for SDA). However, nothing happens when the xps_iic is connected to J1:IN I2C ports (C13 for SCL, A13 for SDA). I guess I'm missing something with JP2 and JP4 jumpers. Can you please tell me the correct jumper settings to have J1:IN hdmi port act the same way as J3:IN ? Please note that I need for my project to have both J1:IN and J3:IN work together as I'm working with 2 video streams. Thank you for your help.
  8. Hello everyone! I wanted to challenge myself and I tried implementing an I2C master capable of configuring SSM2603. I've been so far unsuccessful, not even an ACK shows up when attempting a read. Here's the wave I'm generating (I'm trying to read reg 0x6) compared with the phases as described in the datasheet. They look the same both in Post-implementation timing simulation and when checking the probes. The ACKs from master side A(M) and ~(A(M) are given unconditionally for the time being. Question 1: do you see any issue here? Question 2: The tool infers OBUFT for ac_sda and OBUF for ac_scl, but I get this warning, is it important? Question 3: lastly, do I still have to generate other signals like MCLK, BCLK, PBLRC and so on to be able to read registers over I2C? As you can see from the code I handle them, but I cannot tell from the datasheet whether they are independent. top.sv
  9. Hi, I am looking for an easy way to implement an i2c negative tester with analog discovery 2. The intention is to corrupt i2c telegramms, e.g. pull clock line low, to validate the handling of the affected microcontrollers. Therefore it is possible to analyse the clock and data lines and trigger on specific content. Does anybody already implemented and published it? Best regards Steffen
  10. I am using the AD2 on LabVIEW with dwf.dll. I am using the I2C interface on DIO bits 0 and 1 and the positive power supply. I have configured everything based on the python example code. When I set the power supply and write the I2C data, several other DIO bits go high even though they are not configured in this program. I have auto configuration enabled. I can do the same thing in WaveForms and it works fine. Any suggestions would be appreciated. Thank you
  11. Hi, I recently purchased one of the LabVIEW Home Computing Kits with the Beagle Bone Black along with a PmodDA2 (I2C interface) and a PmodDA1 (SPI interface) from Digilent. My goal is to make low cost, LabVIEW based controller for an EV that I have built. I was able to get the BLINK VI to work without any issue once I realized what Debian Image would work with LINX. (As mentioned on this forum 8.6 is the latest). I am currently running 8.4 on my BBB but I cannot seem to get the LINX I2C interface to work. The code required for the PmodDA1 appears straight forward compared to other, more complex I2C Pmods. I have attached a screen shot of the LINX I2C Write error I keep getting. I get a similar error if I try to perform a read. I know that channel 2 is the only I2C channel available on the BBB according to a LINX pinout for the BBB I found on the LabVIEW MakerHub site, so the only issue I can think of is that I am just not sending the 17 bit slave address (0101000b) correctly. Any assistance would be greatly appreciated.
  12. I have the Arty A7-100T and have successfully built and run a project using the PMOD RTCC module, which uses the I2C interface. I modified the project to use the I2C pins on connector J3 of the Arty and enabled the pullup resistors. I wired the SCL & SDA pins to the PMOD RTCC and all is good. It runs the same as if connected to the PMOD connector. So now I am trying to build my project without using the I2C defined port that is in the board definition files. I want to connect directly to the 6 control and data lines that make up the I2C port on the AXI IIC IP and I want to be able to use any of the available I/O pins on the board for SCL & SDA (I realize that I will need external pullup resistors unless the internal pullups available in the FPGA are sufficient). The problem I am having is that I get failures during synthesis that seem to not like me trying to use bi-directional tristate pins for SCL and SDA. I have a Verilog file that I am using for the bi-directional tristate control: module tristate(IO_Data, Tx_Data, Rx_Data, Tri_En); inout IO_Data; // bidirectional data line input Tx_Data; output Rx_Data; input Tri_En; assign IO_Data = Tri_En? 1'bz:Tx_Data; assign Rx_Data = IO_Data; endmodule This is what it looks like wired up: These are the constraints on the 2 pins: set_property PACKAGE_PIN L18 [get_ports scl] set_property IOSTANDARD LVCMOS33 [get_ports scl] set_property PACKAGE_PIN M18 [get_ports sda] set_property IOSTANDARD LVCMOS33 [get_ports sda] This is the type of error I get: [Designutils 20-1595] In entity system_tristate_0_1, connectivity of net IO_Data cannot be represented in VHDL. VHDL lacks syntax to connect the following inout terminals to a differently-named net: inout IO_Data Resolution: Check whether terminals really need inout direction and substitute input or output as needed. It may also be possible to rename the net to match the terminal. My questions are: 1) Should I be able to connect I2C in this manner without having the port defined in a board definition file? 2) If so, any suggestions to correct my design or how to eliminate the errors I'm seeing? 3) Is there a tristate buffer primitive or IP that I should be able to use here (I cannot find one, which is why I attempted to create my own here)? 4) The PMOD RTCC module does not have pullup resistors on SCL & SDA. When using it with the PMOD connector and the board definition files it works. Are the internal FPGA pullup resistors enabled somewhere? I could not find that anywhere in the PMOD definition files or the Arty board definition files.
  13. Hello All, I am having an issue with running the Master Polled example on I2C with the zynq. I have a base design that is set up and runs the self test and repeated start examples and completes them. My issue is that I hooked up an I2C sensor, added pullup resistors, and it is failing. The only thing I have changed in SDK is that I have found the address of my I2C sensor, 0x57, and put it in place of 0x55. I can place my block design and what not here for referencing. Update - I have assigned I2C pins to W19 and W20 to SCL and SDA respectively.
  14. I am trying to use a DAQ to analyze I2C, SPI, and UART signals and then classify them, so they have to be the actual output signals from the Cora Z7 board. However, I am limited due to the project itself to use only the General Purpose I/O pins (IO0-IOA(IO42)). Is it possible to funnel the SPI, I2C, and UARt signals through these pins, or can you only use the specified pins, such as SDA/SCL, MISO/MOSI, or the USB UART bridge to do this?
  15. Hi all, New to the FPGA world as I was tasked a project to help familiarize myself with the programming and function of how FPGAs work. As you can all infer, I am in need of some help on a specific project that I am doing. I am using a ZYBO Zynq 7000 development board, and Vivado 2019.1. What I am trying to do is control an external sensor, or LED through some user interface. I have seen a lot of tutorials that use the on-board LEDs, and if you press a button, it displays that value in binary in a command terminal. My task that I was to do is be able to turn on and off an external LED connected to the ZYBO through the command terminal. It seems I can connect a simple circuit with a LED and a resistor to the PMOD pins that are power and ground. What the command terminal would let me do is then essentially cut power to that pin, therefore turning the LED off. Please let me know if this is probable, and/or how I should task to complete it. Thanks, Russell
  16. Hi, I am relatively new to working with the Zedboard. I've managed to get an I2C/I2S audio example working (using bare-metal) , that i've downloaded from here. http://www.zynqbook.com/download-tuts.html Now, I would like to get the same example working using the Linux Kernel. However, I can't seem to be able to access the I2C bus. The bus appears to be there, but denies access. zynq> i2cdetect -l i2c-0 i2c Cadence I2C at e0004000 I2C adapter zynq> i2cdetect -y 0 Error: Can't use SMBus Quick Write command on this bus From looking at the SDK, the I2C appears to be at 0xe0004000 Has any one got any suggestions, or point me in the right direction to find the correct settings..? Everywhere I have googled seem to provide i2c solutions for different boards, or bespoke platform setups. What I don't understand is why it just doesn't work "out-of-the-box" with the default settings. Or perhaps, i have missed something. I am using Xilinx SDK 2018.3, and the Xilinx kernel My kernel settings are these: CONFIG_REGMAP_I2C=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MUX=y CONFIG_I2C_MUX_PCA954x=y CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_CADENCE=y CONFIG_VIDEO_IR_I2C=y CONFIG_SND_SOC_I2C_AND_SPI=y CONFIG_RTC_I2C_AND_SPI=y My device tree looks like this: [email protected] { compatible = "cdns,i2c-r1p10"; clocks = <0x1 0x26>; interrupt-parent = <0x4>; /*interrupts = <0x0 0x25 0x4>;*/ interrupts = <0x0 0x19 0x4>; reg = <0xe0004000 0x1000>; i2c-clk = <0x61a80>; #address-cells = <0x1>; #size-cells = <0x0>; }; The default device tree entry for i2c was disabled, so i've tried different combinations. Any help would be gratefully received Dave