Lakshmi Tejas M A Posted July 31, 2018 Share Posted July 31, 2018 Hi all, I am working on SPI transceiver with AD2 in master mode. I am using python sample codes provided. transmitting is working fine but in receiving i am able to get the signals on wire but not to the variable in python rgwRX = (c_uint16*1)() while True: dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(0)) dwf.FDwfDigitalSpiRead16(hdwf, c_int(2), c_int(24),rgwRX, c_int(len(rgwRX))) dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(1)) print rgwRX[0] I am getting only '0's corresponding signal while receiving tapped on CRO is attached and it is proper but when i try it using Waveforms software it works but i see same signal on wire Link to comment Share on other sites More sharing options...
attila Posted July 31, 2018 Share Posted July 31, 2018 Hi @Lakshmi Tejas M A This issue is fixed in WF v3.8.8:https://forum.digilentinc.com/topic/8908-waveforms-beta-download/ Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted July 31, 2018 Author Share Posted July 31, 2018 Hi @attila Thank you for the info on update and bug. Also wanted to know there is transmit option in SPY mode? as you suggested the update of software i did but i see i can get some data but decoding wrong. actual data to be received 1,2,3,4,1,2,3,4,.... but i am receiving 0x5557,0x555d,0x555f,0x5575,0x5557,0x555d,0x555f,0x5575... i think decoding is wrong 3. in the function dwf.FDwfDigitalSpiRead16(hdwf, c_int(2), c_int(24),rgwRX, c_int(len(rgwRX))), i need 12 bits to receive but i need to set 24 to get 12 clk pulses. Link to comment Share on other sites More sharing options...
attila Posted July 31, 2018 Share Posted July 31, 2018 Hi @Lakshmi Tejas M A The FDwfDigitalSpi functions use the digital inputs only when a function with read is called, like: FDwfDigitalSpiWriteRead, FDwfDigitalSpiRead The spy method, as in DigitalIn_Spi_Spy.py example can be used at the same time with FDwfDigitalSpiWrite functions, like here: Digital_Spi_Spy.py Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 1, 2018 Author Share Posted August 1, 2018 Hi @attila As you suggested the update of software i did but i see i can get some data but decoding wrong. actual data to be received 1,2,3,4,1,2,3,4,.... but i am receiving 0x5557,0x555d,0x555f,0x5575,0x5557,0x555d,0x555f,0x5575... i think decoding is wrong the signal on the wires are proper Link to comment Share on other sites More sharing options...
attila Posted August 2, 2018 Share Posted August 2, 2018 Hi @Lakshmi Tejas M A Make sure the SPI mode, bit order, cBitPerWord for master and spy are the same... >python Digital_Spi_Spy.py DWF Version: b'3.8.8' Opening first device Configuring Digital In... Configuring SPI master... Configuring SPI spy... Type data array to send and press enter, like: 1 2 3 1 2 3 4 5 6 7 Sending: [1, 2, 3, 4, 5, 6, 7] bits:57 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 0x4 | 0x4 0x5 | 0x5 0x6 | 0x6 0x7 | 0x7 Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 2, 2018 Author Share Posted August 2, 2018 3 hours ago, attila said: Hi @Lakshmi Tejas M A Make sure the SPI mode, bit order, cBitPerWord for master and spy are the same... >python Digital_Spi_Spy.py DWF Version: b'3.8.8' Opening first device Configuring Digital In... Configuring SPI master... Configuring SPI spy... Type data array to send and press enter, like: 1 2 3 1 2 3 4 5 6 7 Sending: [1, 2, 3, 4, 5, 6, 7] bits:57 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 0x4 | 0x4 0x5 | 0x5 0x6 | 0x6 0x7 | 0x7 hi @attila i was telling about Digital_Spi_Dual.py not Digital_Spi_Spy.py Link to comment Share on other sites More sharing options...
attila Posted August 2, 2018 Share Posted August 2, 2018 Hi @Lakshmi Tejas M A In the FDwfDigitalSpiWrite/Read functions the 2nd argument specifies the SPI mode:cDQ: 0 =SISO, 1 =MOSI/MISO, 2 =dual, 4 =quad DWFAPI BOOL FDwfDigitalSpiWrite(HDWF hdwf, int cDQ, int cBitPerWord, unsigned char *rgTX, int cTX); Here you can see the output of the Digital_Spi_Dual.py captured with another device. It looks correct to me. ... rgbTX = (c_ubyte*16)(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) dwf.FDwfDigitalSpiSelect(hdwf, c_int(0), c_int(0)) # CS DIO-0 level 0 # cDQ dual bits 8 data 0 dwf.FDwfDigitalSpiWrite(hdwf, c_int(2), c_int(8), rgbTX, c_int(len(rgbTX))) # write from array of 8bit(byte) elements in dual mode 8bit data lengths dwf.FDwfDigitalSpiSelect(hdwf, c_int(0), c_int(1)) # CS DIO-0 level 1 ... Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 6, 2018 Author Share Posted August 6, 2018 On 8/1/2018 at 10:36 AM, Lakshmi Tejas M A said: Hi @attila As you suggested the update of software i did but i see i can get some data but decoding wrong. actual data to be received 1,2,3,4,1,2,3,4,.... but i am receiving 0x5557,0x555d,0x555f,0x5575,0x5557,0x555d,0x555f,0x5575... i think decoding is wrong the signal on the wires are proper hi @attila yes transmitting from the ad2 python is perfect. Receiving is the issue. Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 7, 2018 Author Share Posted August 7, 2018 On 7/31/2018 at 3:49 PM, attila said: Hi @Lakshmi Tejas M A This issue is fixed in WF v3.8.8:https://forum.digilentinc.com/topic/8908-waveforms-beta-download/ @attila This update solved thank you Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 9, 2018 Author Share Posted August 9, 2018 On 7/31/2018 at 7:36 PM, attila said: Hi @Lakshmi Tejas M A The FDwfDigitalSpi functions use the digital inputs only when a function with read is called, like: FDwfDigitalSpiWriteRead, FDwfDigitalSpiRead The spy method, as in DigitalIn_Spi_Spy.py example can be used at the same time with FDwfDigitalSpiWrite functions, like here: Digital_Spi_Spy.py hi @attila i tried the code you gave digital_spi_spy.py , I am getting like this i don't understand why ('Sending: ', [1, 2, 3]) is in MOSI and 0xFF in MISO. Link to comment Share on other sites More sharing options...
attila Posted August 9, 2018 Share Posted August 9, 2018 Hi @Lakshmi Tejas M A Did you connect anything to the MISO? Connecting a wire from DIO 2 to 3 for loopback, it receives what it sends out: DWF Version: b'3.8.9' Opening first device Configuring Digital In... Configuring SPI master... Configuring SPI spy... Type data array to send and press enter, like: 1 2 3 1 2 3 Sending: [1, 2, 3] bits:25 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 Type data array to send and press enter, like: 1 2 3 1 2 3 Sending: [1, 2, 3] bits:25 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 Type data array to send and press enter, like: 1 2 3 1 2 3 4 3 Sending: [1, 2, 3, 4, 3] bits:41 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 0x4 | 0x4 0x3 | 0x3 Type data array to send and press enter, like: 1 2 3 Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 10, 2018 Author Share Posted August 10, 2018 13 hours ago, attila said: Hi @Lakshmi Tejas M A Did you connect anything to the MISO? Connecting a wire from DIO 2 to 3 for loopback, it receives what it sends out: DWF Version: b'3.8.9' Opening first device Configuring Digital In... Configuring SPI master... Configuring SPI spy... Type data array to send and press enter, like: 1 2 3 1 2 3 Sending: [1, 2, 3] bits:25 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 Type data array to send and press enter, like: 1 2 3 1 2 3 Sending: [1, 2, 3] bits:25 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 Type data array to send and press enter, like: 1 2 3 1 2 3 4 3 Sending: [1, 2, 3, 4, 3] bits:41 spy mosi|miso : 0x1 | 0x1 0x2 | 0x2 0x3 | 0x3 0x4 | 0x4 0x3 | 0x3 Type data array to send and press enter, like: 1 2 3 @attila Yes i have connected MISO and MOSI of a micro controller. i want to receive and transmit data with micro, making ad2 as a slave. I dont want to work in master modespi_Slave is able to receive but not sending. see if you can help me to transmit from ad2 in slave mode. thank you Link to comment Share on other sites More sharing options...
attila Posted August 10, 2018 Share Posted August 10, 2018 Hi @Lakshmi Tejas M A Unfortunately SPI slave is not supported. Link to comment Share on other sites More sharing options...
Lakshmi Tejas M A Posted August 10, 2018 Author Share Posted August 10, 2018 3 minutes ago, attila said: Hi @Lakshmi Tejas M A Unfortunately SPI slave is not supported. @attila thank you for the clarification Link to comment Share on other sites More sharing options...
Question
Lakshmi Tejas M A
Hi all,
I am working on SPI transceiver with AD2 in master mode. I am using python sample codes provided. transmitting is working fine but in receiving i am able to get the signals on wire but not to the variable in python
rgwRX = (c_uint16*1)()
while True:
dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(0))
dwf.FDwfDigitalSpiRead16(hdwf, c_int(2), c_int(24),rgwRX, c_int(len(rgwRX)))
dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(1))
print rgwRX[0]
I am getting only '0's
corresponding signal while receiving tapped on CRO is attached and it is proper
but when i try it using Waveforms software it works but i see same signal on wire
Link to comment
Share on other sites
14 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.