whatpic Posted March 5, 2018 Share Posted March 5, 2018 I'm using the Analog Discovery 2 to read SPI data. It works for CPOL/CPHA 0, 0 0, 1 and 1, 1. But it does not work for CPOL = 1 CPHA = 0. I get erroneous data with this setting. Anyone know what I'm doing wrong? Link to comment Share on other sites More sharing options...
attila Posted March 5, 2018 Share Posted March 5, 2018 Hi @whatpic You can use the Debug/Logic Analyzer to verify the timing. In case you see any problem please post some screenshots: Alt+PrtScn, Ctrl+V It seems to me that it is working up to 25MHz... Link to comment Share on other sites More sharing options...
whatpic Posted March 6, 2018 Author Share Posted March 6, 2018 Hi attila, I'm very new to the AD2 so whats obvious to you is not to me. You say I can use the Debug/Logic Analyzer but when I read the manuals on the Digilent web site there is no mention of how to do this. (BTW do you know if there are more detailed manuals on the web site. The ones that are there are severely lacking in information on how to use the AD2) I tried setting up the Logic and Protocol screens the way you did but when I press Execute I get: Write: h01, h02, h03 Read: h00, h00, h00 If I press the Debug button on the top right of the Protocol screen I get this: Write: h01, h02, h03, Read: Not available in Debug mode. See Logic Analyzer. Link to comment Share on other sites More sharing options...
attila Posted March 6, 2018 Share Posted March 6, 2018 Hi @whatpic See the Help in the WaveForms application for the latest help corresponding to the software version, press F1, select Help tab, or Help menu / Browse. As it is reported, in Debug mode the Read functions are not available. This mode is inteded to investigate the protocol and timing issues in Logic Analyzer. The MISO in Logic Analyzer corresponds to the Read of zero in Protocol. Do you have any slave SPI device connected? Is it powered? Are the wires correctly connected CS, CLK, MOSI, MISO Link to comment Share on other sites More sharing options...
JColvin Posted March 6, 2018 Share Posted March 6, 2018 Hi @whatpic, As attila notes, the most up to date help is built into the WaveForms software, but there are also some guides for the AD2 available in the AD2 Resource Center on our Wiki. Thanks, JColvin Link to comment Share on other sites More sharing options...
whatpic Posted March 6, 2018 Author Share Posted March 6, 2018 Hi Attila, I built two circuits using PIC 18F4550 microcontrollers. One is a Slave SPI and the other is a Master SPI. I connected them together so they would communicate with each other. I have the Master sending the numbers 1 through 25 to the Slave. Both my Slave and Master are powered by their own power supplies (+5 VDC) I do not use the CS but the CLK, MOSI, and MISO are properly connected. I know they are properly connected because it works for SPI 0,0, 0,1, and 1,1. i.e. the AD2 correctly reads the 1 through 25 the Master is sending. My Slave also reads these values. When I check the Clock and MOSI signals with the O'Scope I see the Clock signal ans a MOSI signal that corresponds with 1 through 25. See below screen shot for numbers 1 through 4. The Logic Analyzer just doesn't work for SPI 1,0. Link to comment Share on other sites More sharing options...
attila Posted March 6, 2018 Share Posted March 6, 2018 Hi @whatpic The Protocol interface does not support SPI without CS. In the Logic Analyzer you can specify none for CS and for SPI 1-0 select Sampling on falling edge. With Analog Discovery when analyzing digital signal above 3.3V, like 5V, it is recommended to use series resistor. Without these the protection circuit on the digital-io lines will drain several mA which could cause voltage drop on the signal. Link to comment Share on other sites More sharing options...
whatpic Posted March 7, 2018 Author Share Posted March 7, 2018 Hi Attila, It's working now! I messed up by not selecting the "sample on falling edge " block. Thank you so much for all your help! Link to comment Share on other sites More sharing options...
Question
whatpic
I'm using the Analog Discovery 2 to read SPI data.
It works for CPOL/CPHA 0, 0 0, 1 and 1, 1.
But it does not work for CPOL = 1 CPHA = 0. I get erroneous data with this setting.
Anyone know what I'm doing wrong?
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.